I have read many stackoverflow questions and answers, but I still cannot manage to get a solution for my problem: I want to read in 5 columns approx. 80 .csv files into R without having to type all code manually and then combine these files in one dataframe. Then, this dataframe needs to be combined with one other dataframe with the same amount of columns.
So I figured to do it with a for loop and that worked, but I can't manage to do further computations on it. I did this, and I saw the files being read in:
filenames <- list.files(path = getwd(), pattern = "*.csv")
for (i in filenames) {
filepath <- file.path(getwd(), paste (i, sep = ""))
assign(i, fread(filepath, select = c(1,2,3,25,29), sep = ","))
I don't know how to reach the files that have just been read in, i.e. typing in a variable name (e.g. df2). And how do I combine these into one dataframe to which I can assign the column names of the other dataframe I want to combine it with?