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. Chong Gu -.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.- 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 _._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._
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. best -- Patrick Connolly HortResearch Mt Albert Auckland New Zealand Ph: +64-9 815 4200 x 7188 ~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~ I have the world`s largest collection of seashells. I keep it on all the beaches of the world ... Perhaps you`ve seen it. ---Steven Wright ~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~ ______________________________________________________ The contents of this e-mail are privileged and/or confidential to the named recipient and are not to be used by any other person and/or organisation. If you have received this e-mail in error, please notify the sender and delete all material pertaining to this e-mail. ______________________________________________________ -.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.- 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 _._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._
On Thu, 17 Oct 2002, 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. >If your computer does what mine does then this isn't what gives an error message. The error message comes when you print.> jk <- data.frame(x1=2,x2=I(matrix(0,1,2))) > jkError in data.frame(x1 = "2", x2 = c("0", "0"), check.names = FALSE, row.names = "1") : row.names should specify one of the variables> jk$x1[1] 2> jk$x2[,1] [,2] [1,] 0 0 and it's caused in format.data.frame by the fact that format(jk[[2]]) is a vector, not a matrix. -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 _._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._