multiple plots and looping assistance requested (revised codes)
Hi Irucka,
I tried it and was able to plot it without any errors.? Here, your code indicates you need two lines. temper[[i]][1]
?temper[[1]][1] # which is the column 1.
? Month
1???? 1
2???? 2
3???? 3
?temper[[1]][2]
#? Data1
#1?? 1.5
#2? 12.3
#3? 11.4
Suppose I use names(temper) instead of seq_along(temper)
pdf("irucka.pdf")
?lapply(names(temper),function(i) {plot(as.matrix(temper[[i]][1]),as.matrix(temper[[i]][2]),main="Fluxmaster versus EGRET/WRTDS \n Seasonal FLux Sum",sub=i,xlab="Calendar Year Timesteps",ylab="Total Flux (kg/season)"); lines(temper[[i]][1]); lines(temper[[i]][2])})
dev.off()
which may not be the one you wanted.
A.K.
From: Irucka Embry <iruckaE at mail2world.com>
To: smartpink111 at yahoo.com
Sent: Wednesday, March 6, 2013 9:32 PM
Subject: Re: [R] multiple plots and looping assistance requested (revised codes)
To: smartpink111 at yahoo.com
Sent: Wednesday, March 6, 2013 9:32 PM
Subject: Re: [R] multiple plots and looping assistance requested (revised codes)
Hi Arun, I was only able to plot by changing from names(temper) to seq_along(temper) and by providing a numeric column entry for the [i] index. My problem has been trying to figure out how to index each column by skipping column 1. Do you have any suggestions?
> tempernow <- lapply(seq_along(temper),function(i) {plot(as.matrix(temp[[i]][1]), as.matrix(temp[[i]][2]), main="Fluxmaster versus EGRET/WRTDS \n Seasonal Flux Sum", sub = i,??xlab="Calendar Year Timesteps", ylab="Total Flux (kg/season)");??lines(temp[[i]][1], temp[[i]][2])})
Error in xy.coords(x, y) :
(list) object cannot be coerced to type 'double'
Thank you.
Irucka
-------------- next part --------------
A non-text attachment was scrubbed...
Name: irucka.pdf
Type: application/pdf
Size: 5735 bytes
Desc: not available
URL: <https://stat.ethz.ch/pipermail/r-help/attachments/20130306/49891a78/attachment.pdf>