There is also the fixed argument to gsub (read the help page!)
gsub('.', ' ','a.b',fixed=TRUE)
[1] "a b"
-Don
At 2:34 PM -0300 10/13/09, Henrique Dallazuanna wrote:
You need escape the period:
gsub("\\.", " ", x$x)
On Tue, Oct 13, 2009 at 2:26 PM, Dimitri
Liakhovitski <ld7...@gmail.com> wrote:
Dear R-ers!
I have x as a variable in a data frame x.
x<-data.frame(x=c("aa.bb","cc.dd.ee"))
x$x<-as.character(x$x)
x
I am sorry for such a simple question - but how can I replace all
periods in x$x with spaces?
sub('.', ' ', x$x) - removes all letters to the left of each period...
Thanks a lot for your advice!
--
Dimitri Liakhovitski
Ninah.com
dimitri.liakhovit...@ninah.com
______________________________________________
R-help@r-project.org mailing list
https://*stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide
http://*www.*R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.
--
Henrique Dallazuanna
Curitiba-Paraná-Brasil
25° 25' 40" S 49° 16' 22" O
______________________________________________
R-help@r-project.org mailing list
https://*stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://*www.*R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.
--
--------------------------------------
Don MacQueen
Environmental Protection Department
Lawrence Livermore National Laboratory
Livermore, CA, USA
925-423-1062
______________________________________________
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.