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

From: Francisco J. Zagmutt <gerifalte28_at_hotmail.com>
Date: Wed 26 Oct 2005 - 06:34:29 EST


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 <roger.bos@gmail.com>
>To: "(r-help@stat.math.ethz.ch.)" <R-help@stat.math.ethz.ch>
>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]]
>
>______________________________________________
>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



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 Wed Oct 26 06:45:32 2005

This archive was generated by hypermail 2.1.8 : Wed 26 Oct 2005 - 09:15:22 EST