Put in Data:
data<-c(2,3,5,4,3,6)
data<-read.csv("place where the data is")
Computations:
five point summary [and the mean]:
summary(data)
standard deviation:
sd(data)
Interquartile range:
IQR(data)
basic math [just put it in r]
Graphically:
boxplot(data):
boxwex=0.2 [changes height of the box]
col="red"
ylim=c(0,20) [the x ranges of your boxplot]
horizontal=TRUE
xlab="stuff", ylab="stuff", main="stuff"
at=1.4 [changes location of your boxplot up or down]
add=TRUE [adds boxplot to previous graph]
border="red"
hist(data):
breaks=10 [numbers of buckets to put data in]
col="red"
ylim=c(0,20), xlim=c(0,20) [the x ranges of your boxplot]
xlab="stuff", ylab="stuff", main="stuff"
freq=FALSE [changes the data to percentiles]
curve(dnorm(x,mean=5,sd=5),add=TRUE) [get yourself a normal curve]
border="red"
cor(data) [find correlation]
lm(ydata~xdata) [get your equation]
abline(lm(ydata~xdata), col="ugly") [plot your line on your graph]
SAT<-c(2100,2060)
barplot(SAT, main="SAT Scores", names.arg=c("Castor", "Pollux"), ylab="Points on SAT", col=rainbow(2))
Miscellaneous:
colors() [see all different colors]
?hist [goes to help]
pch=16 [solid dots on the computer]
LEGEND (for you advanced people):
colors<-c("color of thing one","color of thing2")
legend("topright", inset=.05, title="Gender", c("thing one","thing two"), fill=colors)
plot(sleep$asleepa,yvalues,xlim=c(-3,10),ylab="",xlab="Time of Day", axes=FALSE, ann=FALSE, col="blue")
points(sleep$awakea,yvalues,col="red")
segments(sleep$asleepa, yvalues, sleep$awakea, yvalues)
axis(1, at=-3:10, lab=c("9","10","11","12","1","2","3","4","5","6","7","8","9","10"))
axis(4, at=yvalues, lab=sleep$awakea-sleep$asleepa, las=2)
making a barplot!
daily<-c(23,25)
names(daily)<-c("Yes","No")
dailycol=c("green","blue")
barplot(daily,col=dailycol)
change the size of your labels, inside barplot() add cex.names=0.75