#scripts & functions for STAT 221 source("http://www.uvm.edu/~rsingle/stat221/data/scripts-221.R") #lbs. of butterfat produced by each cow during a 305 day milking period at 2 different farms. dat <- otherdata("butterfat.dat") #missing values mean(dat$Y) #returns the mean (705.4375) mean(dat$X) #returns NA due to missing values mean(dat$X, na.rm=TRUE) #returns the mean after removing missing values (na.rm) sd(dat$Y) #returns the Standard Deviation (SD) sd(dat$X) #returns NA due to missing values sd(dat$X, na.rm=TRUE) #returns the SD after removing missing values #Note that missing values are handled differently by different functions summary(dat) #NAs are accounted for t.test(dat$X) #NAs are accounted for