[R] flatten a matrix and unflatten it

Bill Simpson William.Simpson at drdc-rddc.gc.ca
Tue Mar 22 14:22:22 CET 2005


Sorry -- I meant to say "dataframe" instead of matrix.

Anyway I see that my troubles are gone when I scan the data in as a vector 
then convert to matrix. (I had troubles doing such manipulations when I 
read in the data using read.table)

x<-scan("/home/wsimpson/papers/face/max.dat")
xx<-matrix(x, ncol=3, nrow=length(x)/3, byrow=T)

Thanks for the help.

Bill




More information about the R-help mailing list