[R] please help me about data format.

Jim Lemon jim at bitwrit.com.au
Tue Jun 30 14:17:41 CEST 2009


yongkook Kwon wrote:
> Hi~ helpers.
>
> I was surprised by R data type.
>
> I use to data type like table.
>
> I don't know R allow several data type such as list, number, matrix in the
> same matrix.
>
> I want to use plsr in pls package to anlaysis data.
>
> So, I read R help and example of plsr.
>
> that example show me that data as yarn has three colname as NIR, density and
> train.
>
> the NIR was 268(No. of col) X 71(No. of row) matrix, but  density was just
> 71 list
>
> yarn[1] indicate NIR, and yarn[2] indicate density
>
> so I just tested like that TEST=c(matrix , list)
>
> But It was wrong.
>
> how can I make like matrix?
>
> Of cource, the python, perl or JAVA could like that.
>
> just simplely but  I don't know in R.
>
> please tell me about that.
>
>   
Hi yongkook,
The easiest way is:

yarn.mat<-as.matrix(yarn)

yarn.mat will now contain the values but in a matrix format.

Jim




More information about the R-help mailing list