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

From: Dimitris Rizopoulos <dimitris.rizopoulos_at_med.kuleuven.be>
Date: Tue 25 Oct 2005 - 23:14:39 EST

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


> 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@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



R-help@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 Received on Tue Oct 25 23:59:43 2005

This archive was generated by hypermail 2.1.8 : Fri 03 Mar 2006 - 03:40:47 EST