[R] acf(ts.union()): Missing Values in Object

Rich Shepard rshepard at appl-ecosys.com
Thu Mar 27 18:31:43 CET 2014


On Thu, 27 Mar 2014, Rich Shepard wrote:

> I'll report back on whether that avoids the errors.

   Changing from ts.union() to ts.intersect() did not make a difference. So,
I went back to bare metal by using awk to generate two-column text files,
each consisting of a date and an interger or real value. No column names as
a header. Read each with this syntax:

s95ec.z <- read.zoo("s95ec.dat", sep = ".", format = "%Y-%m-%d"

   Two such files are:
(s95ec.z):
structure(c(85L, 80L, 85L, 90L, 110L, 90L, 100L, 875L, 85L, 83L, 
75L, 49L, 65L, 57L, 55L, 64L, 60L, 80L, 80L, 45L, 65L, 83L, 60L, 
40L, 62L, 80L, 119L, 55L, 65L, 44L, 48L, 68L, 43L, 50L, 70L, 
52L, 45L, 66L, 92L, 92L, 134L, 77L, 52L, 382L, 72L, 83L, 78L, 
78L, 77L, 62L, 51L, 59L, 79L, 65L, 77L, 81L, 59L, 55L, 67L, 67L, 
16L, 70L, 42L, 42L), index = structure(c(8106, 8147, 8177, 8345, 
8428, 8449, 8462, 8474, 8498, 8520, 8531, 8547, 8561, 8576, 8590, 
8612, 8852, 8862, 8881, 8912, 8939, 9231, 9249, 9280, 9304, 9337, 
9468, 9511, 9623, 9652, 9679, 9981, 9995, 10028, 10071, 10371, 
10374, 10434, 10484, 10520, 10554, 10721, 10736, 10764, 10794, 
10904, 10926, 11020, 11026, 11068, 11086, 11136, 11288, 11298, 
11369, 11388, 11442, 11453, 11498, 11811, 11859, 12175, 12597, 
12600), class = "Date"), class = "zoo")

and (s95tds.z):
structure(c(47L, 45L, 30L, 10L, 42L, 45L, 51L, 33L, 18L, 49L, 
49L, 58L, 54L, 32L, 35L, 40L, 28L, 34L, 48L, 34L, 43L, 41L, 56L, 
82L, 61L, 66L, 33L, 56L, 26L, 41L, 42L, 31L, 52L, 39L, 24L, 27L, 
50L, 31L, 50L, 95L, 22L, 33L, 96L, 68L, 22L, 56L, 29L, 35L, 10L, 
1L, 1L, 0L, 0L, 0L, 9L, 1L, 0L, 1L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 
0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 6L, 0L, 0L, 8L, 0L, 0L, 0L, 
0L, 0L, 2L, 0L, 6L, 2L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 
0L), .Dim = c(49L, 2L), .Dimnames = list(NULL, c("V2", "V3")), index = structure(c(8852, 
8862, 8881, 8912, 8939, 9231, 9249, 9280, 9304, 9337, 9468, 9511, 
9623, 9652, 9679, 9981, 9995, 10028, 10071, 10371, 10374, 10434, 
10484, 10520, 10554, 10721, 10736, 10764, 10794, 10904, 10926, 
11020, 11026, 11068, 11086, 11136, 11288, 11298, 11369, 11388, 
11442, 11453, 11498, 11811, 11859, 12175, 12218, 12597, 12600
), class = "Date"), class = "zoo")

   However, when I try to plot the acf for each and the joint ccf with this
syntax:

plot(acf(ts.intersect(s95ec.z, s95tds.z)))

this error message is returned:

Error in plot(acf(ts.intersect(s95ec.z, s95tds.z))) :
   error in evaluating the argument 'x' in selecting a method for function
'plot': Error in .cbind.ts(list(...), .makeNamesTs(...), dframe = dframe,
union = FALSE) :
   no time series supplied

   Since both s95ec.z and s95tds.z are zoo objects of irregular period time
series in class "zoo", I don't see where the 'no time series suppled' error
originates. Do I need to specify dframe = FALSE in the command? What have I
gotten wrong in my process or command syntax?

Rich




More information about the R-help mailing list