I have seen posts about this issue before, but none exactly like the issue that I am having. This code has been working for me with previous versions of R. I recently updated my R and R Studio to versions R 4.2.1 and RStudio Desktop 2022.07.1+554, and now I am getting the subject error when I try to read in my data files. The data files all have the same filenames. I point to the top level directory and then the code goes down through the folder structure and pulls out all of the data files to be used by the rest of the program.
Also want to mention that I am not that well versed in R, so I may not be doing everything in the best manner. Any suggestions that anyone can provide would be most appreciated.
Here is my code to select the top level folder, search through those folders and then read the files which is generating the error.
wd <<- choose.dir(caption = "Select top level folder where your data is located")
setwd(wd)
#List the full path and filename of all files in the working directory and sub-directories that starts
#with "DINum" and ends with ".csv"
out_files <- list.files(pattern = "^DINum(.*)csv$", recursive = TRUE)
# initialise list to store csv files
list.data <- NULL
# create a loop to read in data
for (i in 1:length(out_files))
{
list.data[[i]]<-read.csv(out_files[i], check.names = TRUE)
}