require(mosaic)
## Loading required package: 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: ggplot2
## Loading required package: car
## Loading required package: mosaicData
##
## Attaching package: 'mosaic'
## The following object is masked from 'package:car':
##
## logit
## The following objects are masked from 'package:dplyr':
##
## count, do, tally
## The following objects are masked from 'package:stats':
##
## binom.test, cor, cov, D, 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
require(mosaicData)
head(KidsFeet)
## name birthmonth birthyear length width sex biggerfoot domhand
## 1 David 5 88 24.4 8.4 B L R
## 2 Lars 10 87 25.4 8.8 B L L
## 3 Zach 12 87 24.5 9.7 B R R
## 4 Josh 1 88 25.2 9.8 B L R
## 5 Lang 2 88 25.1 8.9 B L R
## 6 Scotty 3 88 25.7 9.7 B R R
names(KidsFeet)
## [1] "name" "birthmonth" "birthyear" "length" "width"
## [6] "sex" "biggerfoot" "domhand"
attributes(KidsFeet)
## $names
## [1] "name" "birthmonth" "birthyear" "length" "width"
## [6] "sex" "biggerfoot" "domhand"
##
## $class
## [1] "data.frame"
##
## $row.names
## [1] 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23
## [24] 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39
y<-KidsFeet
summary(y)
## name birthmonth birthyear length
## Caitlin: 2 Min. : 1.000 Min. :87.00 Min. :21.60
## David : 2 1st Qu.: 3.000 1st Qu.:88.00 1st Qu.:24.00
## Josh : 2 Median : 6.000 Median :88.00 Median :24.50
## Abby : 1 Mean : 6.103 Mean :87.82 Mean :24.72
## Alisha : 1 3rd Qu.: 9.000 3rd Qu.:88.00 3rd Qu.:25.60
## Andy : 1 Max. :12.000 Max. :88.00 Max. :27.50
## (Other):30
## width sex biggerfoot domhand
## Min. :7.900 B:20 L:22 L: 8
## 1st Qu.:8.650 G:19 R:17 R:31
## Median :9.000
## Mean :8.992
## 3rd Qu.:9.350
## Max. :9.800
##
mean(KidsFeet$length)
## [1] 24.72308
sd(KidsFeet$length)
## [1] 1.317586
favstats(~width|sex, data=KidsFeet)
## sex min Q1 median Q3 max mean sd n missing
## 1 B 8.4 8.875 9.15 9.625 9.8 9.190000 0.4517801 20 0
## 2 G 7.9 8.550 8.80 9.150 9.5 8.784211 0.4935846 19 0
aspectRatio<-(KidsFeet$length/KidsFeet$width)
bwplot(~length|sex, data=KidsFeet, main="Kids Foot Length Broken Down By Sex")

histogram(~length|sex, data=KidsFeet)

tally(~KidsFeet$sex, data=KidsFeet)
##
## B G
## 20 19
tally(~KidsFeet$sex| KidsFeet$domhand , data=KidsFeet)
## KidsFeet$domhand
## KidsFeet$sex L R
## B 5 15
## G 3 16
KF_sub<-subset(y,sex=="B" & length >=25.5)
KF_sub
## name birthmonth birthyear length width sex biggerfoot domhand
## 6 Scotty 3 88 25.7 9.7 B R R
## 7 Edward 2 88 26.1 9.6 B L R
## 11 Mark 9 87 27.5 9.8 B R R
## 13 Cal 8 87 26.1 9.1 B L R
## 14 Cam 3 88 27.0 9.8 B L R
## 26 Glen 7 88 27.1 9.4 B L R
## 28 David 12 87 25.5 9.5 B R R