[R] data.frame bug?

ripley@stats.ox.ac.uk ripley at stats.ox.ac.uk
Sat Oct 19 10:28:38 CEST 2002


The example is a bug in format.AsIs which I have just fixed.

On Fri, 18 Oct 2002, Thomas Lumley wrote:

> On Fri, 18 Oct 2002, Patrick Connolly wrote:
>
> > On Thu, 17-Oct-2002 at 04:30PM -0500, Chong Gu wrote:
> >
> > |>
> > |> I'd like to create a data frame with components
> > |>
> > |> > jk$x1
> > |> [1] 2
> > |> > jk$x2
> > |>          [,1] [,2]
> > |> [1,]    0    0
> > |>
> > |> I used to be able to do it with
> > |>
> > |> > jk <- data.frame(x1=2,x2=I(matrix(0,1,2)))
> > |>
> > |> But now I get a error message.
> > |>
> > |> Can I still do what I want?  Thanks for any help.
> >
> > Not if you want to call and use it a data frame.  A list as you've
> > made could still suit your purposes, but if you want a dataframe, it
> > has to have elements that are of equal lengths.
> >
>
> This is slightly misleading.  It's quite possible to have complicated
> objects in a data frame, including things that are in fact matrices
> eg
>    data.frame(a=1:2,b=Surv(1:2))
> where the second column is a matrix with some extra attributes. This is a
> Good Thing.
>
> It has in the past been possible to have matrices in data frames, and it
> still is possible to create them -- the reported bug is in printing them,
> and I think it is a bug.
>
> 	-thomas
>
>
>
> -.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-
> r-help mailing list -- Read http://www.ci.tuwien.ac.at/~hornik/R/R-FAQ.html
> Send "info", "help", or "[un]subscribe"
> (in the "body", not the subject !)  To: r-help-request at stat.math.ethz.ch
> _._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._
>

-- 
Brian D. Ripley,                  ripley at stats.ox.ac.uk
Professor of Applied Statistics,  http://www.stats.ox.ac.uk/~ripley/
University of Oxford,             Tel:  +44 1865 272861 (self)
1 South Parks Road,                     +44 1865 272860 (secr)
Oxford OX1 3TG, UK                Fax:  +44 1865 272595

-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-
r-help mailing list -- Read http://www.ci.tuwien.ac.at/~hornik/R/R-FAQ.html
Send "info", "help", or "[un]subscribe"
(in the "body", not the subject !)  To: r-help-request at stat.math.ethz.ch
_._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._



More information about the R-help mailing list