[R] regexpr mystery can not remove trailing spaces
Petr PIKAL
petr.pikal at precheza.cz
Wed Jun 2 14:07:43 CEST 2010
Dear all
I encountered strange problem with regexpr replacement
I made this character object
str <- "02.06.10 12:40 "
> str(str)
chr "02.06.10 12:40 "
I read in an object which seems to be quite similar
> str(as.character(becva$V1)[1])
chr "02.06.10 12:40 "
However I can not remove trailing spaces from it
> sub(' +$', '', as.character(becva$V1[1]))
[1] "02.06.10 12:40 "
> sub(' +$', '', str)
[1] "02.06.10 12:40"
>
Do somebody have an idea what to do?
$version.string
[1] "R version 2.12.0 Under development (unstable) (2010-04-25 r51820)"
on Windows
Regards
Petr
More information about the R-help
mailing list