I want to read in a CSV file whose first line is the variable names and subsequent lines are the contents of those variables. Some of the variables are numeric and some of them are text and some are even empty.
file = "path/file.csv"
f = file(file,'r')
varnames = strsplit(readLines(f,1),",")[[1]]
data = strsplit(readLines(f,1),",")[[1]]
Now that data contains all the variables, how do I make it so that data can recognise the data type being read in just like if I did read.csv
.
I need to read the data line by line (or n lines at a time) as the whole dataset is too big to be read into R.