Created
December 4, 2010 17:48
-
-
Save moorepants/728352 to your computer and use it in GitHub Desktop.
Yumi's data analysis in R
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# bring in the data | |
Redox = read.csv('Redox.csv', header=TRUE) | |
print(names(Redox)) | |
# make an example plot for iron, PH average | |
ironsub = subset(Redox, trt == "High Fe(II)" | trt == "Low Fe(II)") | |
xlim = range(Redox$day, na.rm=TRUE) | |
ylim = range(Redox$pH, na.rm=TRUE) | |
ylim = c(floor(ylim[1]), ceiling(ylim[2])) | |
plot(0, 0, type="n", xlim=xlim, ylim=ylim, axes=FALSE, frame.plot=TRUE, | |
xlab="Time(d)", ylab="pH") | |
lowFe100 = subset(Redox, trt == "Low Fe(II)" & per.dose == 100, | |
select=c(day, pH)) | |
# setup a dummy avgpH vector that gives a place for the avg values to go | |
#avgpH = 1:length(unique(lowFe100$day)) | |
#stdpH = avgpH | |
# | |
#for (i in avgpH) | |
#{ | |
#phforthatday = subset(lowFe100, day == unique(lowFe100$day)[i], select = pH) | |
#avgpH[i] = mean(phforthatday, na.rm=TRUE) | |
#stdpH[i] = sd(phforthatday, na.rm=TRUE) | |
#} | |
#points(unique(lowFe100$day), avgpH) | |
avgperday = aggregate(lowFe100, by=list(lowFe100$day), mean, na.rm=TRUE) | |
points(avgperday$day, avgperday$pH) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment