[R] Can anyone please tell me how to strip the white spaces from acharacter vector?

Dimitris Rizopoulos dimitris.rizopoulos at med.kuleuven.be
Tue Oct 25 15:14:39 CEST 2005


one way is to use strsplit(), i.e.,

xx <- c("AIR ", "ABCB ", "ABXA ", "ACMR ", "ADCT ", "ADEX ")
unlist(strsplit(xx, " "))

Best,
Dimitris

----
Dimitris Rizopoulos
Ph.D. Student
Biostatistical Centre
School of Public Health
Catholic University of Leuven

Address: Kapucijnenvoer 35, Leuven, Belgium
Tel: +32/(0)16/336899
Fax: +32/(0)16/337015
Web: http://www.med.kuleuven.be/biostat/
     http://www.student.kuleuven.be/~m0390867/dimitris.htm


----- Original Message ----- 
From: "roger bos" <roger.bos at gmail.com>
To: "(r-help at stat.math.ethz.ch.)" <R-help at stat.math.ethz.ch>
Sent: Tuesday, October 25, 2005 2:51 PM
Subject: [R] Can anyone please tell me how to strip the white spaces 
from acharacter vector?


> for example:
>> a$tic[1:10]
> [1] "AIR " "ABCB " "ABXA " "ACMR " "ADCT " "ADEX "
> [7] "ABM " "AFCE " "AG " "ATG "
> Can anyone please tell me how to strip the white spaces from a$tic?
> Thanks,
> Roger
>
> [[alternative HTML version deleted]]
>
> ______________________________________________
> 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
> 


Disclaimer: http://www.kuleuven.be/cwis/email_disclaimer.htm




More information about the R-help mailing list