[R] more woes trying to convert a data.frame to a numerical matrix

Marc Schwartz marc_schwartz at comcast.net
Wed May 16 17:45:00 CEST 2007


On Wed, 2007-05-16 at 11:29 -0400, Liaw, Andy wrote:
> I think this might be a bit more straight forward:
> 
> R> mat <- do.call(cbind, scan("clipboard", what=list(NULL, 0, 0, 0),
> sep=",", skip=2))
> Read 3 records
> R> mat
>      [,1] [,2] [,3]
> [1,]    1    2    3
> [2,]    4    5    6
> [3,]    7    8    9
> 
> Andy

<snip>

Good approach Andy and with a large source file should also be faster I
would think.

Regards,

Marc



More information about the R-help mailing list