I have written an R Script which will download a zip file from a certain location, and extract it to a specified folder in my Desktop using this solution from stackoverflow - Automate zip file reading in R
I have created a vector which contains the full file names as shown below.
File_Names
[1] "file1.csv"
[2] "file2.csv"
I am also able to read these files as separate dataframes into R using a for
loop. Since I do not know how many files the downloaded zip file contains, my program reads all files which are present in the File_Names
vector. How do I call these dataframes just by using their names using the File_Names
vector? As example,
df <- File_Names[1] # df should have the same content as file1.csv, similar to copying one dataframe to another
rm (File_Names[2]) # when I run this, the dataframe which was read in to R using file2.csv should be removed from R memory
I want to use the names from File_Names
to perform appropriate tasks in R. How do I go about achieving this?