I'm using read_CSV2 to read CSV files, with the same structures, but I would like to read them until a certain row (which varie according to the CSV):
row_2 <- 24
row_3 <- 21
info2 <- read_csv2(data2,
skip=2)[ ,c(1:2, 12:14)] #select columns 1to2 and then 12 to 14
info3 <- read_csv2(data3,
skip=2)[ ,c(1:2, 12:14)]
Here I would like to do 2 things:
- Create a macro to automatize my read CSV.
- And create a macro variable to read the CSV file until the appropriate row.
But I don't know how to catch the right row number automatically.
Basically, the appropriate row would be the row number x where the 1st column contains the 1st 'Total' word. Or also another way would be to select all the rows until the next empty row ...
Does someone knows how I can select and get the row number ?