replace - gsub required for character + using R -


i'm new r. i'm stucked on step project. i'm unable gsub character + example if have string khjvg+56a result should khjvg56a.

here i'm trying.

gsub('^+[[:punct]]', "", 'khjvg+56a') 

but getting same string passed

does solve problem?

gsub('[[:punct:]]', "", 'khjvg+56a') 

i think don't need ^ (beginning of line) , 1 : missing.

as stated @nicola, gsub('\\+', "", 'khjvg+56a') more specific +, `[[:punct:]] target punctuation sign.


Comments

Popular posts from this blog

java - Static nested class instance -

c# - Bluetooth LE CanUpdate Characteristic property -

JavaScript - Replace variable from string in all occurrences -