[R] help

masumeh akhgar akhgar.masumeh at gmail.com
Fri May 17 20:15:22 CEST 2013


Hello,

I fail to tranfer data from a dataframe to a matrix.

var is from a dataframe (and belongs still to the class dataframe) and
should look like m (see below).

> var
  vec1 vec3  d1  d2
1  172  173 223 356
> dput (var)
structure(list(vec1 = 172L, vec3 = 173L, d1 = 223L, d2 = 356L), .Names =
c("vec1",
"vec3", "d1", "d2"), row.names = 1L, class = "data.frame")
> m      #THIS IS THE AIM
     [,1] [,2]
[1,]  172  223
[2,]  173  356

> dput (m)
structure(c(172, 173, 223, 356), .Dim = c(2L, 2L))

How can I transform var to m?
Thanks
akhgar



More information about the R-help mailing list