I want to import the contents of the csv file into R, the csv file contains several sections of data vertically, separated by blank lines and asterisks. for example
******************************************************** * SAMPLE DATA ****************************************** ******************************************************** Name, DOB, Sex Rod, 1/1/1970, M Jane, 5/7/1980, F Freddy, 9.12,1965, M ******************************************************* * Income Data **************************************** ******************************************************* Name, Income Rod, 10000 Jane, 15000 Freddy, 7500
I would like to import this into R as two separate frames. Currently, I manually cut the csv file into smaller files, but I think I could do it with read.csv, as well as for the skip and nread options for read.csv. If I could work where the sequence breaks.
This gives me a boolean TRUE for every empty line
ifelse(readLines("DATA.csv")=="",TRUE,FALSE)
I hope someone has already solved this problem.
file import r csv
PaulHurleyuk
source share