I am trying to iterate over measurements and append all the data to one list, which I could later plot. Everything is done in R.
for (file in filenames){
filename <- file
data <- read_delim(file = file, delim = ";", col_types = cols(
name = col_character(),
surname = col_character(),
)) %>% mutate(filename = filename) //integer since the files are saved with timestamp
}
So from the initial version of the file that I read, I want to append an additional column "filename" where I would save the name of the file. My problem is that apparently in every iteration it overwrites the previously saved values ending up with a list where all entries have the name of the last file that was read.
Does someone have an idea how could I improve this?
Update: I am trying to append the rows vertically. Not to create a list of lists