[Rd] rownames for as.matrix.zoo
Gabor Grothendieck
ggrothendieck at gmail.com
Fri Apr 7 19:50:31 CEST 2006
We'll have a look at it. Use
as.matrix(as.data.frame(x))
as a workaround in the meantime.
On 4/7/06, Brandt, T. (Tobias) <TobiasBr at taquanta.com> wrote:
>
> Hi
>
> Is there a reason why as.matrix.zoo doesn't set the rownames to the index
> like as.data.frame.zoo does?
>
> Thanks
>
> Tobias
>
>
> > library(zoo)
> > x.Date <- as.Date("2003-02-01") + c(1, 3, 7, 9, 14) - 1
> > x <- zoo(matrix(1:10, nc=2), x.Date)
> > colnames(x) <- c('A','B')
> > print(x)
> A B
> 2003-02-01 1 6
> 2003-02-03 2 7
> 2003-02-07 3 8
> 2003-02-09 4 9
> 2003-02-14 5 10
> > as.data.frame(x)
> A B
> 2003-02-01 1 6
> 2003-02-03 2 7
> 2003-02-07 3 8
> 2003-02-09 4 9
> 2003-02-14 5 10
> > as.matrix(x)
> A B
> [1,] 1 6
> [2,] 2 7
> [3,] 3 8
> [4,] 4 9
> [5,] 5 10
> > R.version
> _
> platform i386-pc-mingw32
> arch i386
> os mingw32
> system i386, mingw32
> status
> major 2
> minor 2.0
> year 2005
> month 10
> day 06
> svn rev 35749
> language R
> > library(help=zoo)
> >
> Information on package 'zoo'
>
> Description:
>
> Package: zoo
> Version: 1.0-2
> Date: 2005-09-07
> Title: Z's ordered observations
> Author: Achim Zeileis, Gabor Grothendieck
> Maintainer: Achim Zeileis <Achim.Zeileis at R-project.org>
> Description: An S3 class with methods for totally ordered indexed
> observations. It is particularly
> aimed at irregular time series of numeric vectors/matrices
> and factors. zoo's key
> design goals are independence of a particular index/date/time
> class and consistency
> with with ts and base R by providing methods to extend
> standard generics.
> Depends: R (>= 2.1.0)
> Suggests: chron, fCalendar, its, tseries, strucchange, DAAG
> License: GPL
> Packaged: Thu Sep 8 13:07:59 2005; zeileis
> Built: R 2.1.1; ; 2005-09-09 12:21:08; windows
>
>
> ________________________________
>
> Nedbank Limited Reg No 1951/000009/06. The following link displays the names
> of the Nedbank Board of Directors and Company Secretary.
> This email is confidential and is intended for the addressee only. The
> following link will take you to Nedbank's legal notice.
> ________________________________
>
>
More information about the R-devel
mailing list