I've got a list of 2546 csv files, with different number of columns and rows each. Already imported as a list all those files as follows:
temp = list.files(pattern="*.csv")
myfiles = lapply(temp, read.csv)
As each csv have two header rows and need both info to join all csv's at the end, would like to ask you help because I was just able to do it for one of them as follows:
headers <- read.csv("filename.csv", nrows=2, header=FALSE)
headers_names <- sapply(headers,paste,collapse="_")
data <- read.csv(file="filename.csv", skip = 2, header=FALSE, stringsAsFactors = F)
names(data) <- headers_names
Here is an example from one of the datasets:
TimeDate Hostname VCORE X.1.5V AVSB X3VCC X.5V X.12V
1 TimeDate Hostname Voltage Voltage Voltage Voltage Voltage Voltage
2 2018-02-15T12:00:45+00:00 TL-1337H1DE2018 1.728 1.56 3.312 3.36 5.16 3.072
3 2018-02-15T12:01:45+00:00 TL-1337H1DE2018 1.728 1.56 3.312 3.36 5.16 3.072
4 2018-02-15T12:02:45+00:00 TL-1337H1DE2018 1.728 1.56 3.312 3.36 5.16 3.072
5 2018-02-15T12:03:45+00:00 TL-1337H1DE2018 1.728 1.56 3.312 3.36 5.16 3.072
6 2018-02-15T12:04:45+00:00 TL-1337H1DE2018 1.728 1.56 3.312 3.36 5.16 3.072
It will need a for loop as it is a list but tried already several times without success.