Albrecht, Dr. Stefan (AZ Private Equity Partner)
2006-Nov-23 12:56 UTC
[R] Problem with as.ts(zoo-object)
Dear all, I have an error message, when I try to convert a zoo object (called test) to ts (on R 2.4.0, Package zoo version 1.2-1, Windows XP)> test1994-05-10 1994-06-09 1994-07-09 0.0024943889 0.0024881824 0.0006955831> str(test)atomic [1:3] 0.002494 0.002488 0.000696 - attr(*, "index")=Class 'Date' num [1:3] 8895 8925 8955> is.regular(test)[1] TRUE> as.ts(test)Error in z[match0(index(a), indexes), ] <- a[match0(indexes, index(a))] : number of items to replace is not a multiple of replacement length> traceback()7: FUN(X[[1]], ...) 6: lapply(args, f, ret.zoo = retclass %in% c("list", "data.frame")) 5: merge.zoo(zoo(coredata(x), tt), zoo(, tt2)) 4: merge(zoo(coredata(x), tt), zoo(, tt2)) 3: as.ts.zooreg(x) 2: as.ts.zoo(test) 1: as.ts(test) I will use coredata() to resolve the situation in the larger context. Anyway, does anybody know to remove the above error message? Many thanks and best regards, Stefan ____________________________________ Dr. Stefan Albrecht, CFA Allianz Private Equity Partners GmbH Giselastr. 4 | 80802 Munich | Germany Phone: +49.(0)89.3800.18317 Fax: +49.(0)89.3800.818317 EMail: stefan.albrecht@apep.com <mailto:stefan.albrecht@apep.com> Web: www.apep.com <http://www.apep.com> [[alternative HTML version deleted]]
Its a bug. Thanks. It will be fixed in the next version of zoo. In the meantime I will send you a fix offline. On 11/23/06, Albrecht, Dr. Stefan (AZ Private Equity Partner) <stefan.albrecht at apep.com> wrote:> Dear all, > > I have an error message, when I try to convert a zoo object (called > test) to ts (on R 2.4.0, Package zoo version 1.2-1, Windows XP) > > > test > 1994-05-10 1994-06-09 1994-07-09 > 0.0024943889 0.0024881824 0.0006955831 > > str(test) > atomic [1:3] 0.002494 0.002488 0.000696 > - attr(*, "index")=Class 'Date' num [1:3] 8895 8925 8955 > > is.regular(test) > [1] TRUE > > > as.ts(test) > Error in z[match0(index(a), indexes), ] <- a[match0(indexes, index(a))] > : > number of items to replace is not a multiple of replacement > length > > traceback() > 7: FUN(X[[1]], ...) > 6: lapply(args, f, ret.zoo = retclass %in% c("list", "data.frame")) > 5: merge.zoo(zoo(coredata(x), tt), zoo(, tt2)) > 4: merge(zoo(coredata(x), tt), zoo(, tt2)) > 3: as.ts.zooreg(x) > 2: as.ts.zoo(test) > 1: as.ts(test) > > I will use coredata() to resolve the situation in the larger context. > Anyway, does anybody know to remove the above error message? > > Many thanks and best regards, > Stefan > > ____________________________________ > Dr. Stefan Albrecht, CFA > Allianz Private Equity Partners GmbH > Giselastr. 4 | 80802 Munich | Germany > > Phone: +49.(0)89.3800.18317 > Fax: +49.(0)89.3800.818317 > EMail: stefan.albrecht at apep.com <mailto:stefan.albrecht at apep.com> > Web: www.apep.com <http://www.apep.com> > > > [[alternative HTML version deleted]] > > ______________________________________________ > R-help at stat.math.ethz.ch 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. >