[R] how to use a list to create a plot

Uwe Ligges ligges at statistik.tu-dortmund.de
Tue Jul 21 14:37:35 CEST 2009



Graves, Gregory wrote:
> I issued the following command to obtain the std dev for each month.
> 
>  
> 
> psd<-numSummary(Sal, groups=month, statistics=c("sd"))


numSummary is not in base R, is it? If not, which package? Please read 
the posting guide! Please provide reproducible code (we do not have Sal 
etc.).




>  
> 
> which resulted in
> 
>  
> 
>> psd
> 
>                 sd                           n              NA
> 
> 1              6.930340              9367 2319
> 
> 2              7.847003              10827 1008
> 
> 3              5.962308              12988  404
> 
> 4              3.632105              12576  384
> 
> 5              3.328189              13030  362
> 
> 6              10.101336            12955    5
> 
> 7              11.759585            13071  321
> 
> 8              10.277566            12286 1105
> 
> 9              8.561922              12286  674
> 
> 10           9.252890              13343   27
> 
> 11           9.568852              12591  369
> 
> 12           9.622851              12020  946
> 
>  
> 
>> typeof(psd)
> 
> [1] "list"
> 


I guess it is a data.frame.

Please read "An Introduction to R" or other introductory material in 
orde3r to learn how to extract vectors from data.frames or lists.

In this case for both data.frames and lists:

psd[[1]] for first vector etc.

Uwe Ligges





> 
> I want plot sd versus column 1 (month of year) of the list psd.
> 
>  
> 
> The only way I can figure out how to do this is to manually copy the
> table into Excel, reformat, and then export that back out as a new csv.
> There has to be a better way?
> 
>  
> 
>  
> 
> Gregory A. Graves
> 
> Lead Scientist
> 
> REstoration COoordination and VERification (RECOVER) 
> 
> Watershed Division
> 
> South Florida Water Management District
> 
> Phones:  DESK: 561 / 682 - 2429 
> 
>              CELL:  561 / 719 - 8157
> 
>              
> 
>  
> 
>  
> 
> 
> 	[[alternative HTML version deleted]]
> 
> ______________________________________________
> 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