Hello R-helpers,

I am trying to search for string that includes the caret symbol, using the
following code:

grepl("latitude^2",temp)


And R doesn't like that. It gives me:

> temp<-c("latitude^2","latitude and latitude^2","longitude^2","longitude
and longitude^2")
> temp
[1] "latitude^2"                "latitude and latitude^2"   "longitude^2"
            "longitude and longitude^2"
> grepl("latitude^2",temp)
[1] FALSE FALSE FALSE FALSE


I think this must a regex problem, but I can't find out to specify the
caret using regex.

I would appreciate any help you could provide.

Many thanks,

Mark Na

        [[alternative HTML version deleted]]

______________________________________________
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.

Reply via email to