arun
2013-Mar-29 22:47 UTC
[R] multiple plots and looping assistance requested (single plot)
HI Irucka, Please check this: temp<- structure(list(`:Bostoncitydata` = structure(list(Month = c(1L, 2L, 3L, NA), Data1 = c(1.5, 12.3, 11.4, NA), Data2 = c(9.1342, 12.31, 3.5, NA)), .Names = c("Month", "Data1", "Data2"), class = "data.frame", row.names = c(NA, -4L)), `:Chicagocitydata` = structure(list(Month = c(1L, 2L, 3L, 4L, 5L, NA), Data1 = c(1.52, 12.63, 20.34, 12.83, 3.34, NA ), Data2 = c(19.41342, 13.031, 0.80021, 12.63104, 19.20021, NA )), .Names = c("Month", "Data1", "Data2"), class = "data.frame", row.names = c(NA, -6L)), `:NewYorkcitydata` = structure(list(Month = c(1L, 2L, 3L, 4L, 5L, 6L, 7L, NA), Data1 = c(NA, NA, NA, NA, NA, NA, NA, NA), Data2 = c(3.1342, 1.31, 13.5, 1.31, 2.40021, 0.25, 26.3, NA)), .Names = c("Month", "Data1", "Data2"), class = "data.frame", row.names = c(NA, -8L)), `:Philadelphiacitydata` = structure(list(Month = c(1L, 2L, 3L, 4L, 5L, 6L, NA), Data1 = c(1.65, 11.63, 5.0434, 13.73, 3.0234, 34.209, NA), Data2 = c(2.61342, 16.331, 19.040021, 17.831, 10.1010021, 3.80742, NA)), .Names = c("Month", "Data1", "Data2" ), class = "data.frame", row.names = c(NA, -7L)), `:Atlantacitydata` = structure(list( Month = c(1L, 2L, 3L, NA), Data1 = c(NA, NA, NA, NA), Data2 = c(NA, NA, NA, NA)), .Names = c("Month", "Data1", "Data2"), class = "data.frame", row.names = c(NA, -4L)), `:Baltimorecitydata` = structure(list(Month = 1:2, Data1 = c(11.325, 32.433), Data2 = c(49.71342, 52.4031)), .Names = c("Month", "Data1", "Data2"), class = "data.frame", row.names = c(NA, -2L))), .Names = c(":Bostoncitydata", ":Chicagocitydata", ":NewYorkcitydata", ":Philadelphiacitydata", ":Atlantacitydata", ":Baltimorecitydata")) temp1<-lapply(temp,function(x) {x1<-x[,colSums(is.na(x))!=nrow(x)]; if(is.data.frame(x1)) x1[complete.cases(x1),] else x1[complete.cases(x1)] }) # temp1<-lapply(temp1,function(x) x[is.data.frame(x)]) #3 columns subset temp3<-temp1[lapply(temp1,length)==3] temp3New<-temp3[sapply(temp3,is.data.frame)] pdf("Irucka.pdf") lapply(names(temp3New),function(i) {x<-temp3New[[i]]; matplot(x[,1],x[,-1],type="n",lty=1,sub=i,main="Seasonal Flux Sum", xlab="Calendar Year Timesteps",ylab="Total Flux (kg/season)"); matlines(x[,1],x[,-1],type="l",lty=1:2,lwd=1,col=1:2)}) dev.off() A.K. ________________________________ From: Irucka Embry <iruckaE at mail2world.com> To: smartpink111 at yahoo.com Sent: Friday, March 29, 2013 5:41 PM Subject: Re: [R] multiple plots and looping assistance requested (single plot) Hi Arun, I'm sorry about the data not being read correctly. OK, thank you so much! Irucka <-----Original Message----->>From: arun [smartpink111 at yahoo.com] >Sent: 3/29/2013 3:36:21 PM >To: iruckaE at mail2world.com >Subject: Re: [R] multiple plots and looping assistance requested (single plot) > >HI Irucka, >No problem. Thanks for the dput(data), but it seems like the data is not read correctly. It still has comma >as separator. > >str(temp) >List of 5 > $ 02143500,,:'data.frame': 17 obs. of 1 variable: > ..$ CYEAR_Decimal.load_00600_W.load_00600_F: Factor w/ 17 levels ",,","2000.875,,4202.7437226",..: 2 >3 4 5 6 7 8 9 10 11 ... > $ 02169000,,:'data.frame': 17 obs. of 1 variable: > ..$ CYEAR_Decimal.load_00600_W.load_00600_F: Factor w/ 17 levels ",,","2000.875,,227675.73764",..: 2 >3 4 5 6 7 8 9 10 11 ... > $ 02169500,,:'data.frame': 17 obs. of 1 variable: > ..$ CYEAR_Decimal.load_00600_W.load_00600_F: Factor w/ 17 levels ",,","2000.875,,414312.49534",..: 2 >3 4 5 6 7 8 9 10 11 ... > $ 02169570,,:'data.frame': 17 obs. of 1 variable: > ..$ CYEAR_Decimal.load_00600_W.load_00600_F: Factor w/ 17 levels >",,","2000.875,2897.79043403356,5155.6776796",..: 2 3 4 5 6 7 8 9 10 11 ... > $ 02172300,,:'data.frame': 12 obs. of 1 variable: > ..$ CYEAR_Decimal.load_00600_W.load_00600_F: Factor w/ 12 levels "2001.875,,899.46439731",..: 1 2 3 >4 5 6 7 8 9 10 ... > > >I actually found the dataset containing Bostoncitydata, etc.. I will work on that. > > > >________________________________ > From: Irucka Embry <iruckaE at mail2world.com> >To: smartpink111 at yahoo.com >Sent: Friday, March 29, 2013 1:35 PM >Subject: Re: [R] multiple plots and looping assistance requested (single plot) > > >Hi Arun, that is fine. > >I want to thank you in advance for your assistance. > >Irucka > > ><-----Original Message-----> >>From: arun [smartpink111 at yahoo.com] >>Sent: 3/29/2013 10:02:35 AM >>To: iruckaE at mail2world.com >>Subject: Re: [R] multiple plots and looping assistance requested (single plot) >> >>Will look into it later. >> >> >> >> >> >> >> >>From: Irucka Embry <iruckaE at mail2world.com> >>To: smartpink111 at yahoo.com >>Sent: Friday, March 29, 2013 11:02 AM >>Subject: Re: [R] multiple plots and looping assistance requested (single plot) >> >> >> >>Hi Arun, how are you? >> >>Thank you for the response. Yes, I would like to have the xy scatter plot with connecting lines for both >>columns to be in the same plot window. >> >>I'm sorry that I forgot the data, but it is included below. >> >>dput(temp) >>structure(list(`02143500,,` = structure(list(CYEAR_Decimal.load_00600_W.load_00600_F = >structure(c(2L, >>3L, 4L, 5L, 6L, 7L, 8L, 9L, 10L, 11L, 12L, 13L, 14L, 15L, 16L, >>17L, 1L), .Label = c(",,", "2000.875,,4202.7437226", "2001.125,,16214.840538", >>"2001.375,,7371.9290209", "2001.625,,3114.1090754", "2001.875,,2464.1114951", >>"2002.125,,9380.6352081", "2002.375,,3859.2809055", "2002.625,,901.86146915", >>"2002.875,,22377.413599", "2003.125,,53563.26564", "2003.375,,148264.35049", >>"2003.625,,103538.36278", "2003.875,,18142.045363", "2004.125,,14672.031667", >>"2004.375,,18796.93618", "2004.625,,75313.330193"), class = "factor")), .Names = >>"CYEAR_Decimal.load_00600_W..load_00600_F", class = "data.frame", row..names = c(NA, >>-17L)), `02169000,,` = structure(list(CYEAR_Decimal.load_00600_W.load_00600_F = structure(c(2L, >>3L, 4L, 5L, 6L, 7L, 8L, 9L, 10L, 11L, 12L, 13L, 14L, 15L, 16L, >>17L, 1L), .Label = c(",,", "2000.875,,227675.73764", "2001.125,,92777.682029", >>"2001.375,,84827.680295", "2001..625,,193298.65669", "2001.875,,170799.05034", >>"2002.125,,103666.8759", "2002.375,,107485.71333", "2002.625,,213765.87505", >>"2002.875,,472307.65662", "2003.125,,799500.99994", "2003.375,,754868.43185", >>"2003.625,,454078.02653", "2003.875,,171521.77777", "2004.125,,265827.90007", >>"2004.375,,120401.25989", "2004.625,,194000.26057"), class = "factor")), .Names = >>"CYEAR_Decimal.load_00600_W.load_00600_F", class = "data.frame", row.names = c(NA, >>-17L)), `02169500,,` = structure(list(CYEAR_Decimal.load_00600_W.load_00600_F = structure(c(2L, >>3L, 4L, 5L, 6L, 7L, 8L, 9L, 10L, 11L, 12L, 13L, 14L, 15L, 16L, >>17L, 1L), .Label = c(",,", "2000.875,,414312.49534", "2001.125,,617213.70273", >>"2001.375,,434832.6564", "2001.625,,388556.44724", "2001.875,,349308.46381", >>"2002.125,,633838.70254", "2002.375,,384887.09244", "2002.625,,303766.12561", >>"2002.875,,1065566.5203", "2003.125,,2156874.9757", "2003.375,,2521072.5523", >>"2003.625,,1377743.9361", "2003.875,,683078.62134", "2004.125,,936362.89268", >>"2004.375,,625201.60587", "2004.625,,1094215.7135"), class = "factor")), .Names = >>"CYEAR_Decimal.load_00600_W.load_00600_F", class = "data..frame", row.names = c(NA, >>-17L)), `02169570,,` = structure(list(CYEAR_Decimal.load_00600_W.load_00600_F = structure(c(2L, >>3L, 4L, 5L, 6L, 7L, 8L, 9L, 10L, 11L, 12L, 13L, 14L, 15L, 16L, >>17L, 1L), .Label = c(",,", "2000.875,2897.79043403356,5155.6776796", >>"2001.125,7551.09451122126,10514.485482", "2001.375,4062.39365601964,5937.0104684", >>"2001.625,4386.39358258187,8642.4433388", "2001.875,2148.48034139629,2018.779571", >>"2002.125,5887.51583868203,6126.7033234", "2002.375,4551.71006202726,5345.9677373", >>"2002.625,5159.07068303165,6881.9457464", "2002.875,10946.0644606408,10500.817808", >>"2003.125,20223.5133431944,16945.048319", "2003.375,14275.7834627696,15041.816646", >>"2003.625,16653.6617307992,17141.673609", "2003.875,13901.0420234613,8335.6620592", >>"2004.125,13396.5350817751,7485.3528412", "2004.375,10918.1025781646,7429.6229871", >>"2004.625,37343..1840220637,15796.869042"), class = "factor")), .Names = >>"CYEAR_Decimal..load_00600_W.load_00600_F", class = "data.frame", row.names = c(NA, >>-17L)), `02172300,,` = structure(list(CYEAR_Decimal.load_00600_W.load_00600_F = structure(1:12, >>.Label = c("2001.875,,899.46439731", >>"2002.125,,1667.869248", "2002.375,,952.12246929", "2002.625,,543.12231908", >>"2002.875,,1663.8731209", "2003.125,,3123.5771201", "2003.375,,4338.1307758", >>"2003.625,,4469.2046052", "2003.875,,2642.983822", "2004.125,,2863.529214", >>"2004.375,,2131.6573312", "2004.625,,2476.4154125"), class = "factor")), .Names = >>"CYEAR_Decimal.load_00600_W.load_00600_F", class = "data.frame", row.names = c(NA, >>-12L))), .Names = c("02143500,,", "02169000,,", "02169500,,", >>"02169570,,", "02172300,,")) >> >> >>Irucka >> >> >><-----Original Message-----> >>>From: arun [smartpink111 at yahoo.com] >>>Sent: 3/29/2013 6:02:22 AM >>>To: iruckaE at mail2world.com >>>Subject: Re: [R] multiple plots and looping assistance requested (single plot) >>> >>>HI Irucka, >>> >>>Could you send me the data? Lots of emails, so it is difficult to search your previous email (I also >>deleted >>>all emails from my inbox recently). >>> >>>By single plot means you wanted them in the same plot window, right? >>> >>> >>> >>>________________________________ >>> From: Irucka Embry <iruckaE at mail2world.com> >>>To: smartpink111 at yahoo.com >>>Sent: Friday, March 29, 2013 3:50 AM >>>Subject: Re: [R] multiple plots and looping assistance requested (single plot) >>> >>> >>>Hi Arun, how are you? >>> >>>A couple of weeks ago you assisted me by drafting the following code for me. This code prints >the >>>contents of the 3 columns subset in two different plots. Is it possible to print the contents of the 3 >>>columns subset in one single plot? If so, then how would that be done? >>> >>>I would like to thank you in advance. >>> >>>Irucka Embry >>> >>> >>> >>>temp = read..funkyfile("seasonalFluxComparisonDataSet.csv", "station_id", header=TRUE, >sep="\t") >>>temp1<-lapply(temp,function(x) {x1<-x[,colSums(is.na(x))!=nrow(x)]; if(is.data.frame(x1)) >>>x1[complete..cases(x1),] else x1[complete.cases(x1)]}) >>># temp1<-lapply(temp1,function(x) x[is.data.frame(x)]) >>> >>>#3 columns subset >>>temp3<-temp1[lapply(temp1,length)==3] >>>temp3New<-lapply(temp3,function(x) lapply(names(x)[-1], function(i) {x1<- >>>cbind(x[,1],x[,i]);colnames(x1)<- c("Month",i);x1} )) >>>pdf("seasonalFluxComparisonDataSetfull.pdf") >>>par(mfrow=c(1,1)) >>>lapply(names(temp3New),function(i) lapply(temp3New[[i]],function(x) >{plot(x[,1],x[,2],main="Seasonal >>>Flux Sum",sub=paste(i,colnames(x)[2],sep=" "),xlab="Calendar Year Timesteps",ylab="Total Flux >>>(kg/season)");lines(x[,1],x[,2])})) >>>dev.off() >>> >>>#2 columns subset >>>temp2<-temp1[lapply(temp1,length)==2] >>>temp2New<-lapply(temp2,function(x) lapply(names(x)[-1], function(i) {x1<- >>>cbind(x[,1],x[,i]);colnames(x1)<- c("Month",i);x1} )) >>> >>>pdf("seasonalFluxComparisonDataSetpartial.pdf") >>>par(mfrow=c(1,1)) >>>lapply(names(temp2New),function(i) lapply(temp2New[[i]],function(x) >{plot(x[,1],x[,2],main="Seasonal >>>Flux Sum",sub=paste(i,colnames(x)[2],sep=" "),xlab="Calendar Year Timesteps",ylab="Total Flux >>>(kg/season)");lines(x[,1],x[,2])})) >>>dev.off() _______________________________________________________________ >Get the Free email that has everyone talking at http://www.mail2world.com >Unlimited Email Storage ? POP3 ? Calendar ? SMS ? Translator ? Much More! >. > _______________________________________________________________Get the Free email that has everyone talking at http://www.mail2world.com Unlimited Email Storage ? POP3 ? Calendar ? SMS ? Translator ? Much More! -------------- next part -------------- A non-text attachment was scrubbed... Name: Irucka.pdf Type: application/pdf Size: 7016 bytes Desc: not available URL: <https://stat.ethz.ch/pipermail/r-help/attachments/20130329/1ea1c80c/attachment.pdf>
Irucka Embry
2013-Mar-30 00:07 UTC
[R] multiple plots and looping assistance requested (single plot)
Hi Arun, thank you very much. That code worked perfectly. Below is the full version of the code with the addition of a legend. Irucka rm(list=ls()) source("read.funkyfile.R") temp = read.funkyfile("seasonalFluxComparisonDataSet.csv", "station_id", header=TRUE, sep="\t") temp1<-lapply(temp,function(x) {x1<-x[,colSums(is.na(x))!=nrow(x)]; if(is.data.frame(x1)) x1[complete.cases(x1),] else x1[complete.cases(x1)] }) # temp1<-lapply(temp1,function(x) x[is.data.frame(x)]) #3 columns subset temp3<-temp1[lapply(temp1,length)==3] temp3New<-temp3[sapply(temp3,is.data.frame)] pdf("Calibration_Results/Nitrogen/Graphics/seasonalFluxComparisonDataSet full.pdf") lapply(names(temp3New),function(i) {x<-temp3New[[i]]; matplot(x[,1],x[,-1],type="n",lty=1,sub=i,main="Seasonal Flux Sum", xlab="Calendar Year Timesteps",ylab="Total Flux (kg/season)"); matlines(x[,1],x[,-1],type="l",lty=1:2,lwd=1,col=1:2); legend("topright", inset=.05, title="Seasonal Flux Methods", lty=c(1,1), col= c("black", "red"), c("EGRET/WRTDS","Fluxmaster"), horiz=TRUE)}) dev.off() #2 columns subset temp2<-temp1[lapply(temp1,length)==2] temp2New<-lapply(temp2,function(x) lapply(names(x)[-1], function(i) {x1<-cbind(x[,1],x[,i]);colnames(x1)<- c("Month",i);x1} )) pdf("Calibration_Results/Nitrogen/Graphics/seasonalFluxComparisonDataSet partial.pdf") par(mfrow=c(1,1)) lapply(names(temp2New),function(i) lapply(temp2New[[i]],function(x) {plot(x[,1],x[,2],main="Seasonal Flux Sum",sub=paste(i,colnames(x)[2],sep=" "),xlab="Calendar Year Timesteps",ylab="Total Flux (kg/season)");lines(x[,1],x[,2])})) dev.off() <-----Original Message----->>From: arun [smartpink111@yahoo.com] >Sent: 3/29/2013 4:47:57 PM >To: iruckaE@mail2world.com >Cc: r-help@r-project.org >Subject: Re: [R] multiple plots and looping assistance requested(single plot)> > > >HI Irucka, > >Please check this: >temp<- structure(list(`:Bostoncitydata` = structure(list(Month = c(1L, >2L, 3L, NA), Data1 = c(1.5, 12.3, 11.4, NA), Data2 = c(9.1342, >12.31, 3.5, NA)), .Names = c("Month", "Data1", "Data2"), class "data.frame", row.names = c(NA, >-4L)), `:Chicagocitydata` = structure(list(Month = c(1L, 2L, >3L, 4L, 5L, NA), Data1 = c(1.52, 12.63, 20.34, 12.83, 3.34, NA >), Data2 = c(19.41342, 13.031, 0.80021, 12.63104, 19.20021, NA >)), .Names = c("Month", "Data1", "Data2"), class = "data.frame",row.names = c(NA,>-6L)), `:NewYorkcitydata` = structure(list(Month = c(1L, 2L, >3L, 4L, 5L, 6L, 7L, NA), Data1 = c(NA, NA, NA, NA, NA, NA, NA, >NA), Data2 = c(3.1342, 1.31, 13.5, 1.31, 2.40021, 0.25, 26.3, >NA)), .Names = c("Month", "Data1", "Data2"), class = "data.frame",row.names = c(NA,>-8L)), `:Philadelphiacitydata` = structure(list(Month = c(1L, >2L, 3L, 4L, 5L, 6L, NA), Data1 = c(1.65, 11.63, 5.0434, 13.73, >3.0234, 34.209, NA), Data2 = c(2.61342, 16.331, 19.040021, 17.831, >10.1010021, 3.80742, NA)), .Names = c("Month", "Data1", "Data2" >), class = "data.frame", row.names = c(NA, -7L)), `:Atlantacitydata` structure(list( >Month = c(1L, 2L, 3L, NA), Data1 = c(NA, NA, NA, NA), Data2 = c(NA, >NA, NA, NA)), .Names = c("Month", "Data1", "Data2"), class "data.frame", row.names = c(NA, >-4L)), `:Baltimorecitydata` = structure(list(Month = 1:2, Data1 c(11.325, >32.433), Data2 = c(49.71342, 52.4031)), .Names = c("Month", "Data1", >"Data2"), class = "data.frame", row.names = c(NA, -2L))), .Names c(":Bostoncitydata", >":Chicagocitydata", ":NewYorkcitydata", ":Philadelphiacitydata", >":Atlantacitydata", ":Baltimorecitydata")) > > >temp1<-lapply(temp,function(x) {x1<-x[,colSums(is.na(x))!=nrow(x)];if(is.data.frame(x1))>x1[complete.cases(x1),] else x1[complete.cases(x1)] }) ># temp1<-lapply(temp1,function(x) x[is.data.frame(x)]) >#3 columns subset >temp3<-temp1[lapply(temp1,length)==3] > > >temp3New<-temp3[sapply(temp3,is.data.frame)] >pdf("Irucka.pdf") >lapply(names(temp3New),function(i) {x<-temp3New[[i]];matplot(x[,1],x[,->1],type="n",lty=1,sub=i,main="Seasonal Flux Sum", xlab="Calendar YearTimesteps",ylab="Total Flux>(kg/season)"); matlines(x[,1],x[,-1],type="l",lty=1:2,lwd=1,col=1:2)}) >dev.off() > >A.K. > > > >________________________________ >From: Irucka Embry <iruckaE@mail2world.com> >To: smartpink111@yahoo.com >Sent: Friday, March 29, 2013 5:41 PM >Subject: Re: [R] multiple plots and looping assistance requested(single plot)> > >Hi Arun, I'm sorry about the data not being read correctly. > >OK, thank you so much! > >Irucka > > ><-----Original Message-----> >>From: arun [smartpink111@yahoo.com] >>Sent: 3/29/2013 3:36:21 PM >>To: iruckaE@mail2world.com >>Subject: Re: [R] multiple plots and looping assistance requested(single plot)>> >>HI Irucka, >>No problem. Thanks for the dput(data), but it seems like the data isnot read correctly. It still has comma>>as separator. >> >>str(temp) >>List of 5 >> $ 02143500,,:'data.frame': 17 obs. of 1 variable: >> ..$ CYEAR_Decimal.load_00600_W.load_00600_F: Factor w/ 17 levels",,","2000.875,,4202.7437226",..:>2 >>3 4 5 6 7 8 9 10 11 ... >> $ 02169000,,:'data.frame': 17 obs. of 1 variable: >> ..$ CYEAR_Decimal.load_00600_W.load_00600_F: Factor w/ 17 levels",,","2000.875,,227675.73764",..:>2 >>3 4 5 6 7 8 9 10 11 ... >> $ 02169500,,:'data.frame': 17 obs. of 1 variable: >> ..$ CYEAR_Decimal.load_00600_W.load_00600_F: Factor w/ 17 levels",,","2000.875,,414312.49534",..:>2 >>3 4 5 6 7 8 9 10 11 .... >> $ 02169570,,:'data.frame': 17 obs. of 1 variable: >> ..$ CYEAR_Decimal.load_00600_W.load_00600_F: Factor w/ 17 levels >>",,","2000.875,2897.79043403356,5155.6776796",..: 2 3 4 5 6 7 8 9 1011 ...>> $ 02172300,,:'data.frame': 12 obs. of 1 variable: >> ..$ CYEAR_Decimal.load_00600_W.load_00600_F: Factor w/ 12 levels"2001.875,,899.46439731",..: 1 2>3 >>4 5 6 7 8 9 10 ... >> >> >>I actually found the dataset containing Bostoncitydata, etc.. I willwork on that.>> >> >> >>________________________________ >> From: Irucka Embry <iruckaE@mail2world.com> >>To: smartpink111@yahoo.com >>Sent: Friday, March 29, 2013 1:35 PM >>Subject: Re: [R] multiple plots and looping assistance requested(single plot)>> >> >>Hi Arun, that is fine. >> >>I want to thank you in advance for your assistance. >> >>Irucka >> >> >><-----Original Message-----> >>>From: arun [smartpink111@yahoo.com] >>>Sent: 3/29/2013 10:02:35 AM >>>To: iruckaE@mail2world.com >>>Subject: Re: [R] multiple plots and looping assistance requested(single plot)>>> >>>Will look into it later. >>> >>> >>> >>> >>> >>> >>> >>>From: Irucka Embry <iruckaE@mail2world.com> >>>To: smartpink111@yahoo.com >>>Sent: Friday, March 29, 2013 11:02 AM >>>Subject: Re: [R] multiple plots and looping assistance requested(single plot)>>> >>> >>> >>>Hi Arun, how are you? >>> >>>Thank you for the response. Yes, I would like to have the xy scatterplot with connecting lines for both>>>columns to be in the same plot window. >>> >>>I'm sorry that I forgot the data, but it is included below. >>> >>>dput(temp) >>>structure(list(`02143500,,` structure(list(CYEAR_Decimal.load_00600_W.load_00600_F = >>structure(c(2L, >>>3L, 4L, 5L, 6L, 7L, 8L, 9L, 10L, 11L, 12L, 13L, 14L, 15L, 16L, >>>17L, 1L), .Label = c(",,", "2000.875,,4202.7437226","2001.125,,16214.840538",>>>"2001.375,,7371.9290209", "2001.625,,3114.1090754","2001.875,,2464.1114951",>>>"2002.125,,9380.6352081", "2002.375,,3859.2809055","2002.625,,901.86146915",>>>"2002.875,,22377.413599", "2003.125,,53563.26564","2003.375,,148264.35049",>>>"2003.625,,103538.36278", "2003.875,,18142.045363","2004.125,,14672.031667",>>>"2004.375,,18796.93618", "2004.625,,75313.330193"), class "factor")), .Names = >>>"CYEAR_Decimal.load_00600_W..load_00600_F", class = "data.frame",row..names = c(NA,>>>-17L)), `02169000,,` structure(list(CYEAR_Decimal.load_00600_W.load_00600_F = structure(c(2L, >>>3L, 4L, 5L, 6L, 7L, 8L, 9L, 10L, 11L, 12L, 13L, 14L, 15L, 16L, >>>17L, 1L), .Label = c(",,", "2000.875,,227675.73764","2001.125,,92777.682029",>>>"2001.375,,84827.680295", "2001..625,,193298.65669","2001.875,,170799.05034",>>>"2002.125,,103666.8759", "2002.375,,107485.71333","2002.625,,213765.87505",>>>"2002.875,,472307.65662", "2003.125,,799500.99994","2003.375,,754868..43185",>>>"2003.625,,454078.02653", "2003.875,,171521.77777","2004.125,,265827.90007",>>>"2004.375,,120401.25989", "2004.625,,194000.26057"), class "factor")), .Names = >>>"CYEAR_Decimal.load_00600_W.load_00600_F", class = "data.frame",row.names = c(NA,>>>-17L)), `02169500,,` structure(list(CYEAR_Decimal.load_00600_W.load_00600_F = structure(c(2L, >>>3L, 4L, 5L, 6L, 7L, 8L, 9L, 10L, 11L, 12L, 13L, 14L, 15L, 16L, >>>17L, 1L), .Label = c(",,", "2000.875,,414312.49534","2001.125,,617213.70273",>>>"2001.375,,434832.6564", "2001.625,,388556.44724","2001.875,,349308.46381",>>>"2002.125,,633838.70254", "2002.375,,384887.09244","2002.625,,303766.12561",>>>"2002.875,,1065566.5203", "2003.125,,2156874..9757","2003.375,,2521072.5523",>>>"2003.625,,1377743.9361", "2003.875,,683078.62134","2004.125,,936362.89268",>>>"2004.375,,625201.60587", "2004.625,,1094215.7135"), class "factor")), .Names = >>>"CYEAR_Decimal.load_00600_W.load_00600_F", class = "data..frame",row.names = c(NA,>>>-17L)), `02169570,,` structure(list(CYEAR_Decimal.load_00600_W.load_00600_F = structure(c(2L, >>>3L, 4L, 5L, 6L, 7L, 8L, 9L, 10L, 11L, 12L, 13L, 14L, 15L, 16L, >>>17L, 1L), .Label = c(",,", "2000.875,2897.79043403356,5155.6776796", >>>"2001.125,7551.09451122126,10514.485482","2001.375,4062.39365601964,5937.0104684",>>>"2001.625,4386.39358258187,8642..4433388","2001.875,2148.48034139629,2018.779571",>>>"2002.125,5887.51583868203,6126.7033234","2002.375,4551.71006202726,5345.9677373",>>>"2002.625,5159.07068303165,6881.9457464","2002.875,10946.0644606408,10500.817808",>>>"2003.125,20223.5133431944,16945.048319","2003.375,14275.7834627696,15041.816646",>>>"2003.625,16653.6617307992,17141.673609","2003.875,13901.0420234613,8335.6620592",>>>"2004.125,13396.5350817751,7485.3528412","2004.375,10918.1025781646,7429.6229871",>>>"2004.625,37343..1840220637,15796.869042"), class = "factor")),.Names =>>>"CYEAR_Decimal..load_00600_W.load_00600_F", class = "data.frame",row.names = c(NA,>>>-17L)), `02172300,,` structure(list(CYEAR_Decimal.load_00600_W.load_00600_F = structure(1:12, >>>.Label = c("2001.875,,899.46439731", >>>"2002.125,,1667.869248", "2002.375,,952.12246929","2002.625,,543.12231908",>>>"2002.875,,1663.8731209", "2003.125,,3123.5771201","2003.375,,4338..1307758",>>>"2003.625,,4469.2046052", "2003.875,,2642.983822","2004.125,,2863.529214",>>>"2004.375,,2131.6573312", "2004.625,,2476.4154125"), class "factor")), .Names = >>>"CYEAR_Decimal.load_00600_W.load_00600_F", class = "data.frame",row.names = c(NA,>>>-12L))), .Names = c("02143500,,", "02169000,,", "02169500,,", >>>"02169570,,", "02172300,,")) >>> >>> >>>Irucka >>> >>> >>><-----Original Message-----> >>>>From: arun [smartpink111@yahoo.com] >>>>Sent: 3/29/2013 6:02:22 AM >>>>To: iruckaE@mail2world.com >>>>Subject: Re: [R] multiple plots and looping assistance requested(single plot)>>>> >>>>HI Irucka, >>>> >>>>Could you send me the data? Lots of emails, so it is difficult tosearch your previous email (I also>>>deleted >>>>all emails from my inbox recently). >>>> >>>>By single plot means you wanted them in the same plot window, right? >>>> >>>> >>>> >>>>________________________________ >>>> From: Irucka Embry <iruckaE@mail2world.com> >>>>To: smartpink111@yahoo.com >>>>Sent: Friday, March 29, 2013 3:50 AM >>>>Subject: Re: [R] multiple plots and looping assistance requested(single plot)>>>> >>>> >>>>Hi Arun, how are you? >>>> >>>>A couple of weeks ago you assisted me by drafting the following codefor me. This code prints>>the >>>>contents of the 3 columns subset in two different plots. Is itpossible to print the contents of the 3>>>>columns subset in one single plot? If so, then how would that bedone?>>>> >>>>I would like to thank you in advance. >>>> >>>>Irucka Embry >>>> >>>> >>>> >>>>temp = read..funkyfile("seasonalFluxComparisonDataSet.csv","station_id", header=TRUE,>>sep="\t") >>>>temp1<-lapply(temp,function(x) {x1<-x[,colSums(is.na(x))!=nrow(x)];if(is.data.frame(x1))>>>>x1[complete..cases(x1),] else x1[complete.cases(x1)]}) >>>># temp1<-lapply(temp1,function(x) x[is.data.frame(x)]) >>>> >>>>#3 columns subset >>>>temp3<-temp1[lapply(temp1,length)==3] >>>>temp3New<-lapply(temp3,function(x) lapply(names(x)[-1], function(i){x1<->>>>cbind(x[,1],x[,i]);colnames(x1)<- c("Month",i);x1} )) >>>>pdf("seasonalFluxComparisonDataSetfull.pdf") >>>>par(mfrow=c(1,1)) >>>>lapply(names(temp3New),function(i) lapply(temp3New[[i]],function(x) >>{plot(x[,1],x[,2],main="Seasonal >>>>Flux Sum",sub=paste(i,colnames(x)[2],sep=" "),xlab="Calendar YearTimesteps",ylab="Total Flux>>>>(kg/season)");lines(x[,1],x[,2])})) >>>>dev.off() >>>> >>>>#2 columns subset >>>>temp2<-temp1[lapply(temp1,length)==2] >>>>temp2New<-lapply(temp2,function(x) lapply(names(x)[-1], function(i){x1<->>>>cbind(x[,1],x[,i]);colnames(x1)<- c("Month",i);x1} )) >>>> >>>>pdf("seasonalFluxComparisonDataSetpartial.pdf") >>>>par(mfrow=c(1,1)) >>>>lapply(names(temp2New),function(i) lapply(temp2New[[i]],function(x) >>{plot(x[,1],x[,2],main="Seasonal >>>>Flux Sum",sub=paste(i,colnames(x)[2],sep=" "),xlab="Calendar YearTimesteps",ylab="Total Flux>>>>(kg/season)");lines(x[,1],x[,2])})) >>>>dev.off()<span id=m2wTl><p><font face="Arial, Helvetica, sans-serif" size="2" style="font-size:13.5px">_______________________________________________________________<BR>Get the Free email that has everyone talking at <a href=http://www.mail2world.com target=new>http://www.mail2world.com</a><br> <font color=#999999>Unlimited Email Storage – POP3 – Calendar – SMS – Translator – Much More!</font></font></span> [[alternative HTML version deleted]]