I have multiple CSV files with different names but all formatted exactly the same with the columns and rows in the same order and have the same labels. I would like to be able to read specific columns from each file and rename those columns by adding the filename to them into 1 file R.
For example, I would like to keep Season, reach, and weekday (which is the same for all files) and the extract Var3 and Var7 columns from each file.
File1: Season reach weekday Var1 Var2 Var3 Var4 Var5 Var6 Var7 Var8
File2: Season reach weekday Var1 Var2 Var3 Var4 Var5 Var6 Var7 Var8
File3: Season reach weekday Var1 Var2 Var3 Var4 Var5 Var6 Var7 Var8
Would be merged as:
MergedFile: Season reach weekday File1Var3 File1Var7 File2Var3 File2Var7 File3Var3 File3Var7
Is this possible?