Permalink
Switch branches/tags
Nothing to show
Find file Copy path
Fetching contributors…
Cannot retrieve contributors at this time
103 lines (69 sloc) 2.25 KB
\documentclass[10pt]{article}
\usepackage{fancyhdr}
\usepackage{graphicx, verbatim}
\setlength{\textwidth}{6.5in}
\setlength{\textheight}{9in}
\setlength{\oddsidemargin}{0in}
\setlength{\evensidemargin}{0in}
\setlength{\topmargin}{0cm}
\pagestyle{fancy}
\lhead{\textsc{NAME: \ \ \ \ \ \ \ \ \ }}
\chead{\textsc{(Horton) STAT 135: \texttt{R} Quiz}}
\rhead{\textsc{Fall 2014}}
\lfoot{}
\cfoot{}
\cfoot{\thepage}
\rfoot{}
\renewcommand{\headrulewidth}{0.2pt}
\renewcommand{\footrulewidth}{0.0pt}
\newcommand{\TextEntry}{\vspace*{.5in}}
\begin{document}
<<error=FALSE,warning=FALSE,message=FALSE,echo=FALSE,results="hide">>=
require(mosaic,quietly=TRUE)
require(mosaicData,quietly=TRUE)
trellis.par.set(theme=col.mosaic())
require(knitr)
opts_chunk$set(fig.width=5, fig.height=2.5)
@
No interaction with anyone but the instructor is allowed.
\begin{enumerate}
\item
Load the \texttt{mosaic} and \texttt{mosaicData} packages.
\item Display the first few rows of the \texttt{KidsFeet} data frame (available
in the \texttt{mosaicData} package.)
<<echo=FALSE,message=FALSE,results="hide">>=
@
\TextEntry
\item Display the names of the variables from the data frame.
\TextEntry
\item Calculate (not count by hand!) the number of cases in the data frame.
For your reference, here is a sample of the data:
\begin{small}
<<echo=FALSE,results="asis",message=FALSE>>=
require(xtable,quietly=TRUE)
print(xtable(head(KidsFeet)),floating=FALSE)
@
\end{small}
\TextEntry
\item Calculate the mean foot length of all kids.
\TextEntry
\item Calculate the standard deviation of foot length for all kids.
\TextEntry
\item Calculate the mean foot width stratified by sex.
\TextEntry
\item Create a new variable, called \texttt{aspectRatio}, in the \texttt{KidsFeet} data frame that is defined as the ratio of the length to the width of each kid's foot.
\TextEntry
\item Make a box-and-whisker plot of the kids' foot lengths, broken down by sex.
\TextEntry
\newpage
\item Make this plot:
<<echo=FALSE,out.width="3.5in">>=
histogram(~ length | sex, data=KidsFeet)
@
\TextEntry
\item Calculate (not count by hand!) the number of kids by sex.
\TextEntry
\item Calculate (not count by hand!) the number of kids by sex and dominant hand simultaneously.
\TextEntry
\end{enumerate}
\end{document}