Dear list, I have a file that is comma delimited but contains some erroneous non-delimiter commas. I would like to replace these commas with semicolons and then read the correct file into R as a data frame.
I want to do this from within R, without changing the original data file. My current idea of how to do this would be to use system("sed ...") and feed the result to read.csv(), but I cannot figure out how to combine the two. Minimal example: system("echo \"one,two,three\" > file.csv") # create mockup file read.csv(file=system("sed -e 's/,/;/' file.csv")) # this does not work I think the answer must be in ?connections, maybe pipe() but I have fiddled with these and cannot figure it out. Marianne -- Marianne Promberger PhD, King's College London http://promberger.info R version 2.10.0 (2009-10-26) Ubuntu 9.04 ______________________________________________ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.