I have a text file which want to convert it to data frame. The text is messy, and needs cleaning, removing a couple of repetitive sentences, replace new line (the wildcard in word is "^p" to tab or comma and ...
for example my text file is like:
-The data 1 is taken on Aug, 2009 at UBC
and is significant with p value <0.01
-The data 2 is taken on Sep, 2012 at SFU
and is not significant with p value > 0.06
how can I can I do multiple find and replace. I used this code:
tx = readLines("My_text.txt")
tx2 = gsub(pattern = "is taken on", replace = " ", x = tx)
tx3 = gsub(pattern = "at", replace = " ", x = tx2)
writeLines(tx3, con="tx3.txt")
But I do not know how can I replace "at" to tab (^t) or how can I replace (^p) with , or for example space^p ( ^p) with ,