Displaying 2 results from an estimated 2 matches for "n_female".
2011 Mar 07
4
png inside loop
...;COD" "no3" "no2" "po4"
for (i in names(water)[3:10]){
fname<-paste("Henni/GFX/fem",i,".png",sep="")
mname<-paste("Henni/GFX/mal",i,".png",sep="")
png(fname,1000,1000)
xyplot(N_female~eval(parse(text=i)) |group,xlab=i,ylab="Abundance")
graphics.off()
png(mname,1000,1000)
xyplot(N_male~eval(parse(text=i)) |group,xlab=i,ylab="Abundance")
graphics.off()
}
well, to anyone's surprise, there are no plots in the folder. the loop
finishes (i...
2011 Feb 27
3
accessing variables inside a function, inside a loop
...e("functions.R")
attach(water)
names(water):
[1] "site" "sample" "temp" "pH" "DO" "BOD"
[7] "COD" "no3" "no2" "po4" "N_male" "N_female"
vars<-names(water)[3:10]
par(mfrow=c(4,2))
for (i in vars)
{
comp.plot(i,N_male,DATA=water)
}
comp.plot<-function(parameter,y,DATA){ #this is actually in functions.R
x<-DATA[[parameter]]
y<-DATA[[y]]
plot(y~parameter)
}
and of course, this doesn't work....