I want to import CSV files into R, with the first non-empty line supplying the column names of the data frame. I know that you can provide the skip = 0 argument to indicate which line to read first. However, the line number of the first non-empty line may vary between files.
How to determine how many lines are empty and skip them dynamically for each file?
As stated in the comments, I need to clarify what “empty” means. My csv files look like this:
,,, w,x,y,z a,b,5,c a,b,5,c a,b,5,c a,b,4,c a,b,4,c a,b,4,c
which means there are commas at the beginning of the line.
source share