Skip to content

a quick Q on dataframe

3 messages · Yan Yu, Andrew C. Ward, Spencer Graves

#
How to make a dataframe from a vector or matrix?

thanks,
yan
#
?as.data.frame
?cbind.data.frame


Regards,

Andrew C. Ward

CAPE Centre
Department of Chemical Engineering
The University of Queensland
Brisbane Qld 4072 Australia
andreww at cheque.uq.edu.au


Quoting Yan Yu <yanyu at cs.ucla.edu>:
#
> data.frame(amat)
   C D
a 1 3
b 2 4
 > as.data.frame(amat)
   C D
a 1 3
b 2 4
 >
Read "?data.frame" to see the difference between "data.frame" and 
"as.data.frame".

hth
Spencer Graves
Yan Yu wrote: