[Rd] Inconsistent behaviour when manipulating a ts object with frequency = 12 or 4
Simone Giannerini
sgiannerini at gmail.com
Wed May 31 15:41:40 CEST 2006
Dear All,
I found the following under R 2.3.0 on WINXP (tested on 2 PCs, I do
not have access to Linux from this PC, sorry ... )
> set.seed(10)
> x <- ts(rnorm(6),frequency=7)
> x
Time Series:
Start = c(1, 1)
End = c(1, 6)
Frequency = 7
[1] 0.01874617 -0.18425254 -1.37133055 -0.59916772 0.29454513 0.38979430
> x[24] <- NA
> x
Time Series:
Start = c(1, 1)
End = c(1, 6)
Frequency = 7
[1] 0.01874617 -0.18425254 -1.37133055 -0.59916772 0.29454513
0.38979430 NA NA NA NA NA
[12] NA NA NA NA NA
NA NA NA NA NA NA
[23]
## OK ********************
> x <- ts(rnorm(6),frequency=12) # THE SAME BUT WITH frequency = 12
> x
Jan Feb Mar Apr May Jun
1 -1.2080762 -0.3636760 -1.6266727 -0.2564784 1.1017795 0.7557815
> x[24] <- NA
> x
Error in matrix(c(rep.int("", start.pad), format(x, ...), rep.int("", :
length of 'dimnames' [1] not equal to array extent
In addition: Warning message:
data length [30] is not a sub-multiple or multiple of the number of
columns [12] in matrix
> x <- ts(rnorm(6),frequency=4) # THE SAME BUT WITH frequency = 4
> x
Qtr1 Qtr2 Qtr3 Qtr4
1 -0.23823356 0.98744470 0.74139013 0.08934727
2 -0.95494386 -0.19515038
> x[24] <- NA
> x
Error in matrix(c(rep.int("", start.pad), format(x, ...), rep.int("", :
length of 'dimnames' [1] not equal to array extent
In addition: Warning message:
data length [26] is not a sub-multiple or multiple of the number of
rows [7] in matrix
Is this behaviour expected for frequencies 12 and 4?
Thank you
Simone
***************************************************
platform i386-pc-mingw32
arch i386
os mingw32
system i386, mingw32
status
major 2
minor 3.0
year 2006
month 04
day 24
svn rev 37909
language R
version.string Version 2.3.0 (2006-04-24)
> Sys.getlocale()
[1] "LC_COLLATE=English_United States.1252;LC_CTYPE=English_United
States.1252;LC_MONETARY=English_United
States.1252;LC_NUMERIC=C;LC_TIME=English_United States.1252"
______________________________________________________
Simone Giannerini
Dipartimento di Scienze Statistiche "Paolo Fortunati"
Universita' di Bologna
Via delle belle arti 41 - 40126 Bologna, ITALY
Tel: +39 051 2098248 Fax: +39 051 232153
More information about the R-devel
mailing list