I need to remove punctuation from the text:
data <- "Type the command AT&W enter. in order to save the new protocol on modem;"
gsub('[[:punct:] ]+',' ',data)
This solution gives the result
[1] "Type the command AT W enter in order to save the new protocol on modem "
This is not the desired result because I would like to save &, hence:
[1] "Type the command AT&W enter in order to save the new protocol on modem "
You could try a user defined regex consisting of anything that is not an $ or an alpha numeric:
data <- "Type the command AT&W enter. in order to save the new protocol on modem;"
gsub('[^&[:alnum:] ]+',' ',data)
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