[R] Problems with data.matrix

Spencer Graves spencer.graves at pdf.com
Fri Mar 28 18:37:45 CET 2003


 > tst.list <- list(a=1:2, b=3:4)
 > data.matrix(as.data.frame(tst.list))
   a b
1 1 3
2 2 4

Is this what you want?
Spencer Graves

Laura Gross wrote:
> Dear List
> 
> I have what is probably a simple problem that I just can't seem to
> solve.
> 
> I have a data list which is in the form: lev2.list
> 
> [[1]]
>         1      2
>       number number
> [[2]]
>         3      4
>       number number
> 
> etc down to [[1100]]
> 
> I'm wanting to convert this to a data.matrix so I can plot the values,
> however, when I use new<-data.matrix(lev2.list), I get a data matrix
> that reads:
> 
> [1, ] Numeric, 2
> [2, ] Numeric, 2
> 
> with every line down to [1100, ] reading 'Numeric,2'
> 
> Why am I getting this output? Why will R not display the numbers in a
> data.matrix?
> 
> Many thanks for any help
> Laura
> 
> ______________________________________________
> R-help at stat.math.ethz.ch mailing list
> https://www.stat.math.ethz.ch/mailman/listinfo/r-help



More information about the R-help mailing list