Replacing punctuation by space in text analytics



How to replace a punctuation mark say " | " by a space in a corpus for text analytics.
ex : “maths|enlgish|science” --> "maths english science"
and similarly removing spaces to from a corpus
ex :“physical education” --> "physicaleducation"
pls help!!


Hi @syed.danish

here it is:

gsub("\|", " ", c(“maths|enlgish|science”))

Have a good day


output for your code is:
" m a t h s | e n l g i s h | s c i e n c e "


Correct code should be : m1$skills=gsub("[|]"," ",m1$skills)
Thanks for your help!!


Hi Syed

sorry one character was lost:
gsub("\|", " ", c(“maths|enlgish|science”))