The string is "\r\n\t\t\t\t\t\t\t\t\r\n\t\t\t\t\t\t\t\t\tLocation\r\n\t\t\t\t\t\t\t\t\t\t\t\r\n\t\t\t\t\t\t\t\t\t\t\tSan Francisco, CA;Oakland, CA"
and I want it to be shown as "Location","San Francisco, CA;Oakland, CA"
.
Is there a function for this? Thanks!
You can use a regular expression to remove the special characters:
x <-"\r\n\t\t\t\t\t\t\t\t\r\n\t\t\t\t\t\t\t\t\tLocation\r\n\t\t\t\t\t\t\t\t\t\t\t\r\n\t\t\t\t\t\t\t\t\t\t\tSan Francisco, CA;Oakland, CA"
gsub('[\r\n\t]', '', x)
However, if you really have a string with all those \
the answer becomes something more like:
gsub('\\\\[a-z]', '', x)
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With