阅读背景:

如何排除某些东西被gsub()取代

来源:互联网 

Sorry if this is a dumb question, I'm really new to R. What I'm wondering is, is there any way to specify exclusions within gsub or a similar function? My data will look something like this: (15: .0234 , 12: .0151), and I want to replace the leading 15 with another item matching this (a: .b , c: .d) pattern. However, just calling gsub replaces both the leading 15 with the new pattern, and the 15 following the decimal point. It wouldn't work to simply tell it to replace only the first occurence, because there a lot of these patterns nested. What I'm thinking is to exclude numbers following a decimal point and followed by a whitespace from the gsub - is this even possible?Sorry if this is a dumb question, I'm really ne




你的当前访问异常,请进行认证后继续阅读剩余内容。

分享到: