I wrote a function that loads in two .Rdata files to the global environment. Then,within the same function, I want to apply bind_rows() to the two data frames I loaded into my global environment. However, this command does not work within my function. See the code below that is inside my function:
#load files and bind into one file
files <- as.list(c(file1, file2)) #file1 and file2 are file paths already defined earlier in the function
lapply(files, load, .GlobalEnv)
combined_files <- dplyr::bind_rows(file1_df, file2_df) #the _df files are in the global env.
The result is the two files are in my global environment, but combined_files is not created.