Section 37 Data Analysis: Summary Statistics
Read the help file for the different functions to create summary statistics of the data.
Calculate
mean
andmedian
of the numeric data.Explore the help for the function
fivenum
. Apply the function.Calculate the quartile of the numeric data.
Calculate variance and standard deviation of the numeric data
Calculate range, inter-quartile range and coefficient of variation
Obtain the counts for each level of
Sex
factorObtain the counts for each level of
Vac
factorObtain the counts for combination of
Sex
&Vac
factorsCalculate the correlation between
Age
andWt
37.1 Summary Statistics
mean(DF$Wt, na.rm=TRUE)
median(DF$Wt, na.rm=TRUE)
fivenum(DF$Wt, na.rm=TRUE)
range(DF$Wt, na.rm=TRUE)
quantile(DF$Wt, probs = c(0.25, 0.50, 0.75), na.rm = TRUE)
IQR(DF$Wt, na.rm = TRUE)
sd(DF$Wt, na.rm = TRUE)
sd(DF$Wt, na.rm = TRUE)/mean(DF$Wt, na.rm=TRUE)
table(DF$Sex)
sum(DF$Sex == 'M')
sum(DF$Sex == 'F')
table(DF$Vac)
with(data=DF, table(Sex, Vac))
with(data=DF, cor(Age, Wt, use = 'complete.obs'))