I am trying to merge multiple text files in one data file, but the first few lines and the last couple of lines don't have the same data-structure as the rest of my file. I want to combine multiple files with this type of structure. Doing so, I also would like to interpolate the timestamp given at each end of a file over the entire dataset.
First problems arise when trying to import the data, what I have tried so far:
file_list <- list.files()
for (file in file_list) {
  # if the merged dataset doesn't exist, create it
  if (!exists('dataset')) {
    dataset <- read.table(file, sep = ';', skip = 6, nrow = length(readLines(file)) - 4 -6)
  }
  # if the merged dataset does exist, append to it
  if (exists('dataset')) {
    temp_dataset <- read.table(file, sep = ';', skip = 6, nrow = length(readLines(file)) - 4 - 6)
    dataset <- rbind(dataset, temp_dataset)
    rm(temp_dataset)
  }
}
But then I got the following error message:
Error in rbind(deparse.level, ...) : 
  numbers of columns of arguments do not match
Does anyone know how to do this?
 
     
    