[R] not sure if this intended behavior in column referencing

Gabor Grothendieck ggrothendieck at gmail.com
Wed Nov 15 01:02:07 CET 2006


Please make your examples minimal.  That includes not using
huge variable names that make it harder to work with.

This is not a zoo object with one column.  Its is a zoo object
based on a vector.

zoo(matrix(1:3, 3, 1))

is not the same as

zoo(1:3)

The former has one column but the latter does not have two dimensions
therefore the idea of columns is meaningless.


On 11/14/06, Leeds, Mark (IED) <Mark.Leeds at morganstanley.com> wrote:
> I made smaller zoo object with one column with the structure below
>
> smooththirtylogbidask<-structure(c(4.77126598671015, 4.77127449545028,
> 4.77128569715842,
> 4.771299144447), index = structure(c(1144022520, 1144022580,
> 1144022640, 1144022700), class = c("POSIXt", "POSIXct")), class = "zoo")
>
> And then I printed it out 3 different ways as below.
>
> print(smooththirtylogbidask[,])
> print(smooththirtylogbidask[,"logbidask"])
> print(smooththirtylogbidask[,"xxx"])
>
> All of them worked in that they printed out the EXACT same correct thing
> which tells me that the column reference you
> put in is ignored when the object is just one column. I am unsure if
> this intended
> general R behavior, intended general zoo behavior or just unintended
> behavior but I figured I would send this info out.
> --------------------------------------------------------
>
> This is not an offer (or solicitation of an offer) to buy/se...{{dropped}}
>
> ______________________________________________
> 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.
>



More information about the R-help mailing list