I issued the following command to obtain the std dev for each month. psd<-numSummary(Sal, groups=month, statistics=c("sd")) which resulted in> psdsd 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 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]]
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.
Hi r-help-bounces at r-project.org napsal dne 21.07.2009 14:37:35:> > > 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.I too, with row names 1:12. See str(psd).> > 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. > >If row.names(psd) give you character vector 1:12, you can transfer it to numeric by as numeric. Than plot(as.numeric(row.names(psd)), psd$sd) can give you desired plot. Regards Petr> > > > > > 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 newcsv.> > 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 guidehttp://www.R-project.org/posting-guide.html> > and provide commented, minimal, self-contained, reproducible code. > > ______________________________________________ > R-help at r-project.org mailing list > https://stat.ethz.ch/mailman/listinfo/r-help > PLEASE do read the posting guidehttp://www.R-project.org/posting-guide.html> and provide commented, minimal, self-contained, reproducible code.
It looks like a data.frame to me. Try str(psd) or class(psd) to check. Typeof returns "list" for a data.frame since "data.frame" apparently is a subset of "list". The 'months' that you are seeing are simply the rownames which by chance are the same as the months. I's suggest adding the months to the data.frame and then plotting psd <- xx psd[,4] <- 1:12 names(psd)[4] <- "months" plot(sd~months, data=psd) --- On Tue, 7/21/09, Graves, Gregory <ggraves at sfwmd.gov> wrote:> From: Graves, Gregory <ggraves at sfwmd.gov> > Subject: [R] how to use a list to create a plot > To: r-help at r-project.org > Received: Tuesday, July 21, 2009, 8:20 AM > I issued the following command to > obtain the std dev for each month. > > > > psd<-numSummary(Sal, groups=month, statistics=c("sd")) > > > > 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 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. >__________________________________________________________________ Looking for the perfect gift? Give the gift of Flickr! http://www.flickr.com/gift/