[R] Problem with zoo and rbind() converting matrix to vector

Achim Zeileis Achim.Zeileis at wu-wien.ac.at
Sun Mar 22 01:04:48 CET 2009


On Sat, 21 Mar 2009, Ken-JP wrote:

>
>
> require( zoo )
>
> inp <- c( 5, 9, 4, 2, 1 );
> m <- zoo( cbind( inp ), as.Date("2003-02-01") + (0:(length(inp)-1)));
> dim( m ) # [1] 5 1
> dim( m[1,,drop=FALSE] ) # [1] 1 1 - ok
> dim( lag( m, -1 )) # [1] 4 1 - ok
> dim( rbind( m[1,,drop=FALSE], lag(m,-1) )) # NULL -  converted from zoo
> matrix to zoo vector!?!?
> # any way to keep the last line as a zoo matrix???

This was a problem in the rbind() method, I've just commited a fix to the 
devel-version on R-Forge.

Thanks for the report,
Z

>
>
> -- 
> View this message in context: http://www.nabble.com/Problem-with-zoo-and-rbind%28%29-converting-matrix-to-vector-tp22638959p22638959.html
> Sent from the R help mailing list archive at Nabble.com.
>
> ______________________________________________
> 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.
>
>




More information about the R-help mailing list