I have a directory path
directory<-"C:/User/Files"
in the directory i have these files
dir(directory)
"R_folder","Roster_NBA1.csv", "Roster_NBA2.csv", "Roster_NBA3.csv", "Roster_NBA3.csv","Roster_NBA4.csv"
I would like to write a script that loops through the whole directory and pulls the data that starts in Roster and assigns NBA1, NBA2, NBA3, and NBA4 df from the csv files. At the moment I have something like this I couldn't figure out how to say if it starts with word Roster then run through loop where you assign a data frame based on right 4 letters or starting from NBA
for (i in grepl('^Roster',dir(directory))) { Add expression here}