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 wrote:
Dear R-er
Try chartr:
> chartr(".", " ", "a.b.c")
[1] "a b c"
On Tue, Oct 13, 2009 at 1:26 PM, Dimitri Liakhovitski 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
ri Liakhovitski wrote:
> From: Dimitri Liakhovitski
> Subject: [R] replacing period with a space
> To: "R-Help List"
> 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&
Thanks a lot for your help, Henrique and Sarah!
Dimitri
On Tue, Oct 13, 2009 at 1:37 PM, Sarah Goslee wrote:
> As you've discovered, the . means something special in regular
> expressions (and R's version of them). You need to escape it with \\:
>
>> x<-data.frame(x=c("aa.bb","cc.dd.ee"))
>> x$x<
You need escape the period:
gsub("\\.", " ", x$x)
On Tue, Oct 13, 2009 at 2:26 PM, Dimitri Liakhovitski 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 c
As you've discovered, the . means something special in regular
expressions (and R's version of them). You need to escape it with \\:
> x<-data.frame(x=c("aa.bb","cc.dd.ee"))
> x$x<-as.character(x$x)
> x
x
1aa.bb
2 cc.dd.ee
> sub("\\.", " ", x$x)
[1] "aa bb""cc dd.ee"
> gsub("\\.",
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 lo
7 matches
Mail list logo