JAN FEB MAR APR MAY JUN JUL AUG SEP OCT NOV DEC 1968 NA 10.7 10.0 9.3 7.4 8.1 9.3 9.5 8.5 10.0 10.0 13.0 1969 13.0 9.9 7.0 5.9 NA 6.5 7.3 6.6 NA NA NA NA 1970 10.7 8.9 8.1 NA NA 7.1 7.7 NA 6.5 NA 8.3 NA 1971 NA 11.6 NA NA 7.8 NA NA 6.2 NA NA 8.4 NA x<-read.zoo("textconnection", sep=",", format= "%Y", header=TRUE) plot(x) #this plots all of the years by each month. I would like to plot one long time series from 1968 to 1971 #is there an easy way to do this? I can reformat the data in excel so that the index will be year then month, but this will take a while. the end goal is #to be able to apply some signal processing things like spectral density after fitting the seasonal trend etc. thanks Stephen -- Let's not spend our time and resources thinking about things that are so little or so large that all they really do for us is puff us up and make us feel like gods. We are mammals, and have not exhausted the annoying little problems of being mammals. -K. Mullis
Please use dput(x) to display data in your posts in easily copied form. Try this: library(zoo) z <- zoo(matrix(1:48, 4, dimnames = list(NULL, month.abb)), 1968:1971) zz <- zooreg(c(coredata(z)), start = as.yearmon(1968), freq = 12) You could also consider using a ts series: tt <- as.ts(zz) On Thu, Mar 13, 2008 at 5:18 PM, stephen sefick <ssefick at gmail.com> wrote:> JAN FEB MAR APR MAY JUN JUL AUG SEP OCT NOV DEC > 1968 NA 10.7 10.0 9.3 7.4 8.1 9.3 9.5 8.5 10.0 10.0 13.0 > 1969 13.0 9.9 7.0 5.9 NA 6.5 7.3 6.6 NA NA NA NA > 1970 10.7 8.9 8.1 NA NA 7.1 7.7 NA 6.5 NA 8.3 NA > 1971 NA 11.6 NA NA 7.8 NA NA 6.2 NA NA 8.4 NA > > x<-read.zoo("textconnection", sep=",", format= "%Y", header=TRUE) > plot(x) > > #this plots all of the years by each month. I would like to plot one > long time series from 1968 to 1971 > #is there an easy way to do this? I can reformat the data in excel so > that the index will be year then month, but this will take a while. > the end goal is #to be able to apply some signal processing things > like spectral density after fitting the seasonal trend etc. > thanks > > Stephen > > > -- > Let's not spend our time and resources thinking about things that are > so little or so large that all they really do for us is puff us up and > make us feel like gods. We are mammals, and have not exhausted the > annoying little problems of being mammals. > > -K. Mullis > > ______________________________________________ > 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. >
This is only the second time that I remember haveing even seen a reference to dput(). The first time was about 3-4 days ago in something of a throw-away comment. Should it be in the posting guide and FAQ etc as a guide to new users? --- Gabor Grothendieck <ggrothendieck at gmail.com> wrote:> Please use dput(x) to display data in your posts in > easily copied form.
On Fri, 14 Mar 2008, John Kane wrote:> This is only the second time that I remember haveing > even seen a reference to dput(). The first time was > about 3-4 days ago in something of a throw-away > comment. > > Should it be in the posting guide and FAQ etc as a > guide to new users?The posting guide mentions dump() for this purpose purpose (the main difference being that the object name is written for dump() but not for dput()). ?dump also links to ?dput so I guess that having dump() in the posting guide should be sufficient. Z> --- Gabor Grothendieck <ggrothendieck at gmail.com> > wrote: > > > Please use dput(x) to display data in your posts in > > easily copied form. > > ______________________________________________ > 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. > >
Ah so it does. I must have missed it entirely. Thanks --- Achim Zeileis <Achim.Zeileis at wu-wien.ac.at> wrote:> On Fri, 14 Mar 2008, John Kane wrote: > > > This is only the second time that I remember > haveing > > even seen a reference to dput(). The first time > was > > about 3-4 days ago in something of a throw-away > > comment. > > > > Should it be in the posting guide and FAQ etc as a > > guide to new users? > > The posting guide mentions dump() for this purpose > purpose (the > main difference being that the object name is > written for dump() but not > for dput()). ?dump also links to ?dput so I guess > that having dump() in > the posting guide should be sufficient. > Z > > > --- Gabor Grothendieck <ggrothendieck at gmail.com> > > wrote: > > > > > Please use dput(x) to display data in your posts > in > > > easily copied form. > > > > ______________________________________________ > > 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!
Apparently Analagous Threads
- zoo plot warning messages - I don't know what they mean or how to inspect the data to figure this out
- Wrong output due to what I think might be a data type issue (zoo read in problem)
- labeling panels in lattice plots
- Zoo plotting behavior
- plotting big zoo object memory problem