import - Importing multiple csv files in R but skipping first 25 rows and skipping different number of rows after that -
i have folder 396 csv files.
the first 25 rows of each csv file same , want skip them.next, 26th row header row want keep.
the problem information interested in starts in different rows in csv files.some start @ row 48, others @ 36, 32... etc.i want skip rows after header start of row of needed information. there way skip first 25 rows, keep header row (26th), , automate such r skips rows after header until sees start row information.
additionally, once reach row want,the values represented every other row or other 2 rows.is there way solve since not consistent?
example:
1. name 2.... . . 25... 26.header 27.... . . 32/41/etc 12/04/2015 13:49 4 6 i not sure code use started thinking of using code:
files<-list.files("filepath",pattern="*csv", full.names=t) names(files)<-files headers = read.csv(files, skip = 1:25, header = f, as.is = t) edata <- do.call(rbind, lapply(files, read_csv)) i not sure how handle skip issue in do.call.
has run similar issue , how did solve it?
thank you.
# first skip 25 lines data = read.csv(file, skip = 25, header = t) # remove other empty rows data[rowsums(is.na(data)) != ncol(data),]
Comments
Post a Comment