[R] Getting error message using R: Please help (it's coursework due in on Friday)

Gavin Simpson gavin.simpson at ucl.ac.uk
Wed Dec 12 14:12:49 CET 2007


On Wed, 2007-12-12 at 05:03 -0800, ethanhaas wrote:
> I was, and the answer is yes, but I figured the easiest way for you to
> understand is for me to say exactly what I am trying to do. Perhaps I don't
> even need to decompose (although I think I do). If I can get past this
> problem it would make everything else so much easier.

Peter was trying to get you to see that you should be doing one of the
following:

dcm <- decompose(timeseries)

or

dcm <- decompose(using)

*Not* decompose(information), which will try to decompose your data
frame, which is not a timeseries object in the sense of ?ts and
therefore doesn't have periods and the like, hence the error.

Do either of the two suggestions that Peter clearly suggested you try
(and I repeat above) work for you and give you what you want?

HTH

G

> 
> 
> 
> P.Dalgaard wrote:
> > 
> > ethanhaas wrote:
> >> What I'm trying to do is have plots and summary statistics of x
> >> (autocorrelations for example) where x refers to the data in using, and I
> >> thought decomposing would be the way to go about it.
> >>
> >>
> >>   
> > You are not listening. I give up.
> > 
> >> P.Dalgaard wrote:
> >>   
> >>> ethanhaas wrote:
> >>>     
> >>>> I simply called it information but I can also call it data if you wish,
> >>>> it
> >>>> doesn't make a difference.
> >>>> The timeseries is simply the time series of this data between the two
> >>>> dates
> >>>> and using is the data up to 1990 as opposed to 1994.
> >>>>
> >>>>   
> >>>>       
> >>> And isn't it one of the latter two you want to decompose()?
> >>>
> >>>     
> >>>> P.Dalgaard wrote:
> >>>>   
> >>>>       
> >>>>> ethanhaas wrote:
> >>>>>     
> >>>>>         
> >>>>>> I've been trying for the past 3 weeks to use R (much better than
> >>>>>> Matlab
> >>>>>> but I
> >>>>>> am very bad with computers so I am very new to all of this) and know
> >>>>>> how
> >>>>>> to
> >>>>>> input the data (hey, it's a start!) but every time I type in the
> >>>>>> following:
> >>>>>>
> >>>>>> dcm <- decompose(information)
> >>>>>>
> >>>>>> I get the following error message:
> >>>>>>
> >>>>>> Error in decompose(information) : time series has no or less than 3
> >>>>>> periods
> >>>>>>
> >>>>>> Could you please aid me so that I can progress to the next step. What
> >>>>>> I
> >>>>>> am
> >>>>>> in fact trying to do at the moment is plot a graph of the information
> >>>>>> so
> >>>>>> I
> >>>>>> had assumed it would be:
> >>>>>>
> >>>>>> dcm <- decompose(information)
> >>>>>> Plot(dcm$trend)
> >>>>>>
> >>>>>> but obviously it does not appear to be the case.
> >>>>>>
> >>>>>> By the way the code I have right now in case it helps is:
> >>>>>>
> >>>>>> information <- scan("everything.txt")
> >>>>>> timeseries <- ts(information, frequency = 11, start = c(1970, 1994))
> >>>>>> using <- window(timeseries, end = c(1990, 11))
> >>>>>> dcm <- decompose(information)
> >>>>>> Plot(dcm$trend)
> >>>>>>
> >>>>>>   
> >>>>>>       
> >>>>>>           
> >>>>> Er, are you sure it is "information" that you want to decompose()? (If
> >>>>> so, what are the computations of "timeseries" and "using" supposed to
> >>>>> be
> >>>>> good for?)
> >>>>>
> >>>>>     
> >>>>>         
> >>>>>> Thank you very much in advance, I really appreciate the help.
> >>>>>>   
> >>>>>>       
> >>>>>>           
> >>>>> -- 
> >>>>>    O__  ---- Peter Dalgaard             Øster Farimagsgade 5, Entr.B
> >>>>>   c/ /'_ --- Dept. of Biostatistics     PO Box 2099, 1014 Cph. K
> >>>>>  (*) \(*) -- University of Copenhagen   Denmark          Ph:  (+45)
> >>>>> 35327918
> >>>>> ~~~~~~~~~~ - (p.dalgaard at biostat.ku.dk)                  FAX: (+45)
> >>>>> 35327907
> >>>>>
> >>>>> ______________________________________________
> >>>>> 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.
> >>>>>
> >>>>>
> >>>>>     
> >>>>>         
> >>>>   
> >>>>       
> >>> -- 
> >>>    O__  ---- Peter Dalgaard             Øster Farimagsgade 5, Entr.B
> >>>   c/ /'_ --- Dept. of Biostatistics     PO Box 2099, 1014 Cph. K
> >>>  (*) \(*) -- University of Copenhagen   Denmark          Ph:  (+45)
> >>> 35327918
> >>> ~~~~~~~~~~ - (p.dalgaard at biostat.ku.dk)                  FAX: (+45)
> >>> 35327907
> >>>
> >>> ______________________________________________
> >>> 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.
> >>>
> >>>
> >>>     
> >>
> >>   
> > 
> > 
> > -- 
> >    O__  ---- Peter Dalgaard             Øster Farimagsgade 5, Entr.B
> >   c/ /'_ --- Dept. of Biostatistics     PO Box 2099, 1014 Cph. K
> >  (*) \(*) -- University of Copenhagen   Denmark          Ph:  (+45)
> > 35327918
> > ~~~~~~~~~~ - (p.dalgaard at biostat.ku.dk)                  FAX: (+45)
> > 35327907
> > 
> > ______________________________________________
> > 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.
> > 
> > 
> 
-- 
%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%
 Dr. Gavin Simpson             [t] +44 (0)20 7679 0522
 ECRC, UCL Geography,          [f] +44 (0)20 7679 0565
 Pearson Building,             [e] gavin.simpsonATNOSPAMucl.ac.uk
 Gower Street, London          [w] http://www.ucl.ac.uk/~ucfagls/
 UK. WC1E 6BT.                 [w] http://www.freshwaters.org.uk
%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%



More information about the R-help mailing list