library(mosaic)
## Loading required package: dplyr
##
## Attaching package: 'dplyr'
## The following objects are masked from 'package:stats':
##
## filter, lag
## The following objects are masked from 'package:base':
##
## intersect, setdiff, setequal, union
## Loading required package: lattice
## Loading required package: ggformula
## Loading required package: ggplot2
## Loading required package: ggstance
##
## Attaching package: 'ggstance'
## The following objects are masked from 'package:ggplot2':
##
## geom_errorbarh, GeomErrorbarh
##
## New to ggformula? Try the tutorials:
## learnr::run_tutorial("introduction", package = "ggformula")
## learnr::run_tutorial("refining", package = "ggformula")
## Loading required package: mosaicData
## Loading required package: Matrix
##
## The 'mosaic' package masks several functions from core packages in order to add
## additional features. The original behavior of these functions should not be affected by this.
##
## Note: If you use the Matrix package, be sure to load it BEFORE loading mosaic.
##
## Attaching package: 'mosaic'
## The following object is masked from 'package:Matrix':
##
## mean
## The following object is masked from 'package:ggplot2':
##
## stat
## The following objects are masked from 'package:dplyr':
##
## count, do, tally
## The following objects are masked from 'package:stats':
##
## binom.test, cor, cor.test, cov, fivenum, IQR, median,
## prop.test, quantile, sd, t.test, var
## The following objects are masked from 'package:base':
##
## max, mean, min, prod, range, sample, sum
attach(Births78)
names(Births78)
## [1] "date" "births" "wday" "year"
## [5] "month" "day_of_year" "day_of_month" "day_of_week"
summary(Births78)
## date births wday year
## Min. :1978-01-01 Min. : 7135 Sun:53 Min. :1978
## 1st Qu.:1978-04-02 1st Qu.: 8554 Mon:52 1st Qu.:1978
## Median :1978-07-02 Median : 9218 Tue:52 Median :1978
## Mean :1978-07-02 Mean : 9132 Wed:52 Mean :1978
## 3rd Qu.:1978-10-01 3rd Qu.: 9705 Thu:52 3rd Qu.:1978
## Max. :1978-12-31 Max. :10711 Fri:52 Max. :1978
## Sat:52
## month day_of_year day_of_month day_of_week
## Min. : 1.000 Min. : 1 Min. : 1.00 Min. :1.000
## 1st Qu.: 4.000 1st Qu.: 92 1st Qu.: 8.00 1st Qu.:2.000
## Median : 7.000 Median :183 Median :16.00 Median :4.000
## Mean : 6.526 Mean :183 Mean :15.72 Mean :3.992
## 3rd Qu.:10.000 3rd Qu.:274 3rd Qu.:23.00 3rd Qu.:6.000
## Max. :12.000 Max. :365 Max. :31.00 Max. :7.000
##
summary(births)
## Min. 1st Qu. Median Mean 3rd Qu. Max.
## 7135 8554 9218 9132 9705 10711
## Max Tues
## Min Sun
9537
## [1] 9537
gf_histogram(~births, data = Births78)
hist(1978-10-01:1978-10-31)
births<- c(1978-10-01:1978-10-31)
#Days #Cum Freq
#Sun
#Mon
#Tues
#Wed
#Thurs
#Fri
#Sat
9.The data print does not make sense. How about you graph the cumulative data with a proper graph?
boxplot(births)
boxplot(births, horizontal = TRUE)
12.Likewise, create the same type of 5 number summary plot for births from Births2015. Caution: how do you know that this “births” vector is not the same as “births” from 1978?
boxplot(Births2015)
plot(Births78)
plot(Births2015)
boxplot(births, horizontal=TRUE)
boxplot(Births2015, horizontal =TRUE)