I have an SQL query result exported to csv format with ";" as a separator. it should contain 5 columns:
order_id (str),
user_rating (int),
user_feedback (str),
created_by (str),
created_on (date)
Problem is that users can have comments spanning multiple lines in the user_feedback field. While in SQL it is coerced to a nice single line view. But for the exported csv the dataset would not read in properly.
fread()
from data.table and read.table()
both failed. I finally got it to read in as 1 column using:
data1 <- read.table('myFile.csv', stringsAsFactors = F, header = F,
sep = "\t", allowEscapes = T, quote = "")
The problem now is as follows: the query result contains 50000 rows, but the csv is read in as 50267 rows. From checking the data, it seems it took user_feedback
that contained 'enters' and read those in as separate rows.
How do I import this data properly, so with the user_feedback
data for every row into a single string field?