[R] coercing columns

John Fox jfox at mcmaster.ca
Fri Jan 7 17:19:21 CET 2005


Dear Christoph,

> as.vector(as.matrix(DF))
[1] "A" "B" "A" "B" "C" "A" "C" "A" "B"

does the trick.

Regards,
 John

--------------------------------
John Fox
Department of Sociology
McMaster University
Hamilton, Ontario
Canada L8S 4M4
905-525-9140x23604
http://socserv.mcmaster.ca/jfox 
-------------------------------- 

> -----Original Message-----
> From: r-help-bounces at stat.math.ethz.ch 
> [mailto:r-help-bounces at stat.math.ethz.ch] On Behalf Of 
> Christoph Scherber
> Sent: Friday, January 07, 2005 9:47 AM
> To: 'r-help at stat.math.ethz.ch'
> Subject: [R] coercing columns
> 
> Dear all,
> 
> I have a data frame that looks like this:
> 
> c1   c2   c3
> A    B    C
> B    C    A
> A    A    B
> 
> and so on;
> 
> I´d like to produce one single vector consisting of the 
> columns c1,c2, c3, such that
> 
> vector=("A","B","A","B","C","A","C","A","B")
> 
> I guess it´s easy to do but I don´t know how...Can anyone help me?
> 
> Thanks a lot!
> Christoph
> 
> ______________________________________________
> R-help at stat.math.ethz.ch mailing list
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide! 
> http://www.R-project.org/posting-guide.html




More information about the R-help mailing list