[R] Strange behaviour of spectrum()?

MichaelNielsen@synergy.com.au MichaelNielsen at synergy.com.au
Thu Jul 19 03:13:29 CEST 2001


Dear r-help list:

In the following R session, I seem to be somehow breaking the spectrum() 
function, but I'm not sure how.  Could somebody please point out my 
mistake?  My apologies if it's something that should be obvious.

The mysterious bit is how spectrum(my.ts) at first works, but then later 
fails with an error message that I find difficult to interpret.

I'm running R 1.3.0 that I compiled myself on what was once Caldera Linux 
(2.2.14), but I dare say I've deviated somewhat from the original Caldera 
distribution (added GNOME and generally updated software).

Thanks in advance.

Regards,

Mike

---- session transcript follows ----

R : Copyright 2001, The R Development Core Team
Version 1.3.0  (2001-06-22)

R is free software and comes with ABSOLUTELY NO WARRANTY.
You are welcome to redistribute it under certain conditions.
Type `license()' or `licence()' for distribution details.

R is a collaborative project with many contributors.
Type `contributors()' for more information.

Type `demo()' for some demos, `help()' for on-line help, or
`help.start()' for a HTML browser interface to help.
Type `q()' to quit R.

> ls()
character(0)
> library(tseries)

        `tseries' version: 0.7-4 
 
        `tseries' is a package for time series analysis with emphasis
        on non-linear modelling.
        See `library (help=tseries)' for details.

> my.ts<-ts(rnorm(200))
> spectrum(my.ts)       # nice graphic display appears
> plot(my.ts)           # another nice graphic display appears
> spectrum(my.ts)       # As expected, yet another nice graphic display 
appears
> perf<-read.delim('vmout3.txt')
> attach(perf)
> ls(perf)
 [1] "X"   "avm" "b"   "cs"  "cy"  "fr"  "fre" "idl" "in"  "pi"  "po"  "r" 
 
[13] "re"  "sr"  "sy"  "sys" "t"   "usr" "wai"
> idl.ts<-ts(idl)

> spectrum(idl.ts)      # No graphic appears
Error in "[<-"(*tmp*, , i, value = c(w, rep(1, nr - 2 * m), rev(w)) *  : 
        number of items to replace is not a multiple of replacement length
In addition: Warning messages: 
1: longer object length
        is not a multiple of shorter object length in: pi * seq(1, 2 * m - 
1, by = 2) 
2: longer object length
        is not a multiple of shorter object length in: c(w, rep(1, nr - 2 
* m), rev(w)) * x[, i] 


> spectrum(my.ts)       # I would have thought this would have worked
Error in "[<-"(*tmp*, , i, value = c(w, rep(1, nr - 2 * m), rev(w)) *  : 
        number of items to replace is not a multiple of replacement length
In addition: Warning messages: 
1: longer object length
        is not a multiple of shorter object length in: pi * seq(1, 2 * m - 
1, by = 2) 
2: longer object length
        is not a multiple of shorter object length in: c(w, rep(1, nr - 2 
* m), rev(w)) * x[, i] 
> 
-------------- next part --------------
An HTML attachment was scrubbed...
URL: https://stat.ethz.ch/pipermail/r-help/attachments/20010719/4bf2b5bc/attachment.html


More information about the R-help mailing list