Option 5
#Read in the Data
survey=read.delim("clipboard")
#Checking the data
str(survey) #gives the structure of the data
nrow(survey) #gives the number of rows in the data
names(survey) #gives just the variable names
head(survey) #gives the first 6 rows of the data
View(survey) #Opens the data frame in the script window
#Load the Lattice Graphics Library
library(lattice)
#Visualising Data
histogram(survey$Height)
histogram(~ Height, data=survey)
histogram(~ Height, data=survey, nint=20)
bwplot(~ Height, data=survey)
bwplot(Height ~ Sex, data=survey)
xyplot(Mass ~ Height, data=survey)
xyplot(Mass ~ Height, data=survey, groups=Sex)
xyplot(Mass ~ Height, data=survey, groups=Sex, auto.key=TRUE)
xyplot(Mass ~ Height, data=survey, groups=Sex, auto.key=TRUE, type=c("p","smooth"))
#More complex graphics
histogram(~ Sleep | Sex, data=survey)
histogram(~ Sleep | Residence, data=survey)
histogram(~ Minutes | Mode, data=survey)
#Summerising Data
mean(survey$Height)
sd(survey$Height)
median(survey$Height)
IQR(survey$Height)
table(survey$Eyes)
#Summary of data
summary(survey)
#Read in the Data
survey=read.delim("clipboard")</p>
<p>#Checking the data
str(survey) #gives the structure of the data
nrow(survey) #gives the number of rows in the data
names(survey) #gives just the variable names
head(survey) #gives the first 6 rows of the data
View(survey) #Opens the data frame in the script window</p>
<p>#Load the Lattice Graphics Library
library(lattice)</p>
<p>#Visualising Data
histogram(survey$Height)
histogram(~ Height, data=survey)
histogram(~ Height, data=survey, nint=20)
bwplot(~ Height, data=survey)
bwplot(Height ~ Sex, data=survey)
xyplot(Mass ~ Height, data=survey)
xyplot(Mass ~ Height, data=survey, groups=Sex)
xyplot(Mass ~ Height, data=survey, groups=Sex, auto.key=TRUE)
xyplot(Mass ~ Height, data=survey, groups=Sex, auto.key=TRUE, type=c("p","smooth"))</p>
<p>#More complex graphics
histogram(~ Sleep | Sex, data=survey)
histogram(~ Sleep | Residence, data=survey)
histogram(~ Minutes | Mode, data=survey)</p>
<p>#Summerising Data
mean(survey$Height)
sd(survey$Height)
median(survey$Height)
IQR(survey$Height)
table(survey$Eyes)</p>
<p>#Summary of data
summary(survey)
\includegraphics[width=0.6\textwidth]{test.jpg}
https://docs.google.com/forms/d/1TGGDNyie8Qdg6hSyQz1oDUlpx-iYzbOIyDSRiwyMYXs
Leave a Reply