[R] Help with gsub function or a similar function

Sarah Goslee sarah.goslee at gmail.com
Fri Apr 6 12:52:21 CEST 2012


You don't provide a reproducible example, or even str(), but I'd guess you need to match "^15" instead of just "15".

Sarah

On Apr 5, 2012, at 10:38 PM, ieatnapalm <erawls at tulane.edu> wrote:

> Hey, sorry if this has been addressed before, but I'm really new to R and
> having trouble with the gsub function. I need a way to make this function
> exclude certain values from being substituted:
> ie my data looks something like (15:.0234,10:.0157) and I'm trying to
> replace the leading 15 with something else - but of course it replaces the
> second 15 with something else too. If there's a way to exclude anything with
> a leading decimal point or something like that, that would do the trick.
> Thanks yall.
> 
> --
> View this message in context: http://r.789695.n4.nabble.com/Help-with-gsub-function-or-a-similar-function-tp4536584p4536584.html
> Sent from the R help mailing list archive at Nabble.com.
> 
> ______________________________________________
> R-help at 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.



More information about the R-help mailing list