I have a text file that looks as follows
(abc,123)
(def,456)
(ghi,789)
...
In R, I would like to read this file as a csv. Therefore I need to get rid of the opening and closing brackets at the end of the lines. Do you have an idea how to achieve that?
Reading the file, removing the brackets and writing to a temporary file should be avoided if possible.
Ok, this seems to work (on my Mac):
read.table(pipe("tr -d '()' < ~/Desktop/paren.txt"),header = FALSE,sep = ",")
V1 V2
1 123 abc
2 456 def
3 789 ghi
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