[R] plotting from dataframes

Jeff Newmiller jdnewmil at dcn.davis.CA.us
Fri Jan 18 17:03:42 CET 2013


You need to (re-) read the Introduction to R document that comes with R, particularly about indexing lists.

Briefly, there are three ways: integer, string, and approximate string indexing. You seem to be stuck now using approximate string indexing with the $ operator. Integer indexing is more appropriate for your loop.

for(i in 1:10){
plot( frames[[ i ]]$hour1 )
}

---------------------------------------------------------------------------
Jeff Newmiller                        The     .....       .....  Go Live...
DCN:<jdnewmil at dcn.davis.ca.us>        Basics: ##.#.       ##.#.  Live Go...
                                      Live:   OO#.. Dead: OO#..  Playing
Research Engineer (Solar/Batteries            O.O#.       #.O#.  with
/Software/Embedded Controllers)               .OO#.       .OO#.  rocks...1k
--------------------------------------------------------------------------- 
Sent from my phone. Please excuse my brevity.

condor <radonnikodym at hotmail.nl> wrote:

>So by hand the command would be 
>
>par(mfrow=c(1,2))
>plot(frames$'1'hour1)
>plot(frames$'2'hour1)
>
>But in my case there are far more than 2 days, so I want to use a loop.
>Suppose I have 10 plots
>par(mfrow=c(2,5))
>for(i in 1:10){
>plot( /what should be put here??/)
>}
>
>
>
>--
>View this message in context:
>http://r.789695.n4.nabble.com/plotting-from-dataframes-tp4655851p4655931.html
>Sent from the R help mailing list archive at Nabble.com.
>
>______________________________________________
>R-help at r-project.org mailing list
>https://stat.ethz.ch/mailman/listinfo/r-help
>PLEASE do read the posting guide
>http://www.R-project.org/posting-guide.html
>and provide commented, minimal, self-contained, reproducible code.



More information about the R-help mailing list