I addition to all the many good options presented you can also use
trimWhiteSpace{limma} which is just a higher level call to sub()
x=scan("clipboard", what="character")
Read 6 items
x
[1] "AIR " "ABCB " "ABXA " "ACMR " "ADCT " "ADEX "
trimWhiteSpace(x)
[1] "AIR" "ABCB" "ABXA" "ACMR" "ADCT" "ADEX"
Cheers
Francisco
>From: roger bos <[EMAIL PROTECTED]>
>To: "([EMAIL PROTECTED])" <[email protected]>
>Subject: [R] Can anyone please tell me how to strip the white spaces from
>acharacter vector?
>Date: Tue, 25 Oct 2005 08:51:48 -0400
>
>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]]
>
>______________________________________________
>[email protected] mailing list
>https://stat.ethz.ch/mailman/listinfo/r-help
>PLEASE do read the posting guide!
>http://www.R-project.org/posting-guide.html
______________________________________________
[email protected] mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html