Reputation: 356
I would like R to read.csv with comma delimiter but semicolon newline. The data has no white space or newlines. How can I do this?
Upvotes: 1
Views: 3376
Reputation: 3109
One solution is reading the file as a string and replacing semicolon by new line symbol.
fileName = 'myfile.txt'
filecontent = readChar(fileName, file.info(fileName)$size)
filecontent = gsub(";", "\n", filecontent)
con = textConnection(filecontent)
read.table(con,sep=",")
Upvotes: 5