Thanks a lot! This is very easy to understand. However, I am running into another problem now. I know it is different from the original question, but am posting here as the code is the same.
Error with here package
I want to use the here package to locate my files:
> df_sim <- list.files(path = here("data", "raw_data"),
+ pattern="*.hdf5") %>%
+ set_names(.) %>%
+ map_dfr(hdf5_extractor, .id = "file.ID")
Show Traceback
Rerun with Debug
Error in h5checktypeOrOpenLoc(file, readonly = TRUE) :
Error in h5checktypeOrOpenLoc(). Cannot open file. File 'C:\Users\durraniu\Google Drive\Dissertation\Cars_20160601_01.hdf5' does not exist.
This is not what I expected. If I run just the first 2 lines, I get the correct ouput:
> list.files(path = here("data", "raw_data"),
+ pattern="*.hdf5") %>%
+ set_names(.)
Cars_20160601_01.hdf5 Cars_20160601_02.hdf5 Cars_20160601_03.hdf5 Cars_20160601_04.hdf5
"Cars_20160601_01.hdf5" "Cars_20160601_02.hdf5" "Cars_20160601_03.hdf5" "Cars_20160601_04.hdf5" .... <continued>
What am I doing wrong?