# can you do anything with just vectors?
# not too chicken to try an example:
beans <- c(179,160,136,227,217,168,108,124,143,140 )
casein <- c(368,390,379,260,404,318,352,359,216,222,283,332)
boxplot(beans,casein)
t.test(beans,casein) # note the default doesn't assume equal variance
t.test(beans,casein,var.equal=T) # your traditional t test
#plot(beans,casein) # doesn't make sense and wont work - differing lengths
plot(c(beans,casein)) # will work, joins them together
# there is more than one dimension
a<-1:100
dim(a) # no dimensions yet
dim(a)<-c(10,10) # give it some (10*10=100)
dim(a) #
a[10,10] # 100
a[100] # 100
a[1,] # row 1
a[,1] # column 1
rn<-c('one','two','three','four','five','six','seven','eight','nine','ten')
rownames(a) <- rn
a['three',]
# lists allow any kind of data to be mixed
alist<-list(a,'cowboys and indians',42)
alist
# a special case of lists is the dataframe.
# a dataframe is a list of vectors all the same length
data(chickwts)
chickwts
str(chickwts)
plot(chickwts[,1]) # scatterplot of everything
plot(chickwts) # scatterplot of weight against feed
hist(chickwts[,1]) # distribution of weights
chickwts$feed # address columns by name
chickwts$weight
levels(chickwts$feed) # investigate propoerties of a factor
nlevels(chickwts$feed)
hist(chickwts$weight)
plot(density(chickwts$w)) #possibly superior view of density
hist(chickwts$w)
plot(weight ~ feed, data=chickwts) # introduce formula interface
windows() # open an additional plotting window
# some statistics
aov(weight ~ feed, data=chickwts) # returns a model fitting object
# (prints highlights)
chickova<-aov(weight ~ feed, data=chickwts) # save
chickova
summary(chickova) # prints traditional ANOVA table
plot(chickova) # plots a series of diagnostic plots
TukeyHSD(chickova) # post-hoc
plot(TukeyHSD(chickova))
##############
## exercise ##
##############
DNase
# data on an elisa assay for DNAse
# 1. look at the DNase data. What is there?
# 2. plot the DNase standard curve with a best-fit line
# 3. make a new data frame with only run 1 data
# 4. make a new data frame with only duplicate 1 data
# 5. depict the runs with different colors, plotting characters, or lines
# 6. make a dataframe and plot of only the OD readings < 0.8 (linear region)
# 7. the sqrt() of conc
# 8. or the density ** 2
# 9. try log transformations