Here is one more that works: gsub("."," ","Start.Time", fixed = TRUE)
"fixed = TRUE" really helps in a lot of instances for removing specific characters without accidently angering the regular expression gods. Enjoy. --- On Tue, 10/13/09, Dimitri Liakhovitski <ld7...@gmail.com> wrote: > From: Dimitri Liakhovitski <ld7...@gmail.com> > Subject: [R] replacing period with a space > To: "R-Help List" <r-h...@stat.math.ethz.ch> > Date: Tuesday, October 13, 2009, 12:26 PM > 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. > ______________________________________________ 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.