Hi, I've just started to learn Rstudio and coding and I'm having some trouble with a few things. I'm trying to merge 20+ files into one data frame and add a column for subject number/ID which correspond to rows from each datafile.
e.g. all the data rows from file #1 would be labelled "1" in the subject column, etc.
All of the original data files already has a column labelled "subject". However, this column is blank (our experiment didn't output a subject number, but created a column called subject anyways), so there aren't any subject names in any of the original data files.
I tried implementing solutions from this thread, but I received an error that says "Error: file must be a string, raw vector or a connection."
I already read and merged all the data files using purrr:
data = list.files(path = "data", full.names = T) %>%
map(read_csv) %>%
reduce(rbind)
Any help is appreciated!