escaping - How do I strip dollar signs ($) from data/ escape special characters in R? -
escaping - How do I strip dollar signs ($) from data/ escape special characters in R? -
i've been using gsub("toreplace","replacement", myvector)
clean out info in r. while works commas , like, removing "$"
has no effect. if gsub("$","",myvector)
dollar signs remain in place.
i think because $
special character in r. tried escaping "\$"
yields same result (no effect). , couldn't find resource on escaping special characters in r.
obviously should in preprocessing. wondering if out there knew how either a) escape special characters in r b) rid of pesky $
in r directly. science.
you have escape twice, first r, sec regex.
gsub('\\$', '', c("a$a", "bb$")) [1] "aa" "bb"
see ?quotes
details on quoting , escaping.
r escaping
Comments
Post a Comment