This is an R Markdown document. Markdown is a simple formatting syntax for authoring HTML, PDF, and MS Word documents. For more details on using R Markdown see http://rmarkdown.rstudio.com.
When you click the Knit button a document will be generated that includes both content as well as the output of any embedded R code chunks within the document. You can embed an R code chunk like this:
data <- read_csv('DodgersData.csv')
## Rows: 81 Columns: 12
## ── Column specification ────────────────────────────────────────────────────────
## Delimiter: ","
## chr (9): month, day_of_week, opponent, skies, day_night, cap, shirt, firewor...
## dbl (3): day, attend, temp
##
## ℹ Use `spec()` to retrieve the full column specification for this data.
## ℹ Specify the column types or set `show_col_types = FALSE` to quiet this message.
head(data)
## # A tibble: 6 × 12
## month day attend day_of_week opponent temp skies day_night cap shirt
## <chr> <dbl> <dbl> <chr> <chr> <dbl> <chr> <chr> <chr> <chr>
## 1 APR 10 56000 Tuesday Pirates 67 Clear Day NO NO
## 2 APR 11 29729 Wednesday Pirates 58 Cloudy Night NO NO
## 3 APR 12 28328 Thursday Pirates 57 Cloudy Night NO NO
## 4 APR 13 31601 Friday Padres 54 Cloudy Night NO NO
## 5 APR 14 46549 Saturday Padres 57 Cloudy Night NO NO
## 6 APR 15 38359 Sunday Padres 65 Clear Day NO NO
## # ℹ 2 more variables: fireworks <chr>, bobblehead <chr>
summary(data)
## month day attend day_of_week opponent
## Length :81 Min. : 1.00 Min. :24312 Length :81 Length :81
## N.unique : 7 1st Qu.: 8.00 1st Qu.:34493 N.unique : 7 N.unique :17
## N.blank : 0 Median :15.00 Median :40284 N.blank : 0 N.blank : 0
## Min.nchar: 3 Mean :16.14 Mean :41040 Min.nchar: 6 Min.nchar: 4
## Max.nchar: 3 3rd Qu.:25.00 3rd Qu.:46588 Max.nchar: 9 Max.nchar: 9
## Max. :31.00 Max. :56000
## temp skies day_night cap shirt
## Min. :54.00 Length :81 Length :81 Length :81 Length :81
## 1st Qu.:67.00 N.unique : 2 N.unique : 2 N.unique : 2 N.unique : 2
## Median :73.00 N.blank : 0 N.blank : 0 N.blank : 0 N.blank : 0
## Mean :73.15 Min.nchar: 5 Min.nchar: 3 Min.nchar: 2 Min.nchar: 2
## 3rd Qu.:79.00 Max.nchar: 6 Max.nchar: 5 Max.nchar: 3 Max.nchar: 3
## Max. :95.00
## fireworks bobblehead
## Length :81 Length :81
## N.unique : 2 N.unique : 2
## N.blank : 0 N.blank : 0
## Min.nchar: 2 Min.nchar: 2
## Max.nchar: 3 Max.nchar: 3
##
library (ggplot2)
ggplot(data, aes(x = attend)) +
geom_histogram(fill = "pink", color = "white") +
theme_minimal() +
labs(
title = "Histogram of Dodgers Attendance",
x = "Attendance",
y = "Frequency"
)
## `stat_bin()` using `bins = 30`. Pick better value `binwidth`.