Skip to content
Prev 79613 / 398502 Next

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

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?
Disclaimer: http://www.kuleuven.be/cwis/email_disclaimer.htm