I have to pick suppose 400 csv documents from a particular file.
For one file, i know it is read.csv("document1.csv")
However, I have a file suppose name file400. It has 400 documents starting from document1.csv to document400.csv. I have to make a function that selects all of them and take mean. I know i will use for(i in 400)
. However, i don't know how to select of file to read these documents.I can select my directory from setwd(file400)
.
But what should i do to read all 400 documents. I think i have to select a variable towards all these file400 contents. How will i do this? Once, i have a the variable set, for example xfile. I can put for (i in xfile). However, how can I assign xfile towards all file contents of file400?
It is very simple question. How can i upload all files in a directory in a function? How can i load more than one documents in read.csv()? This is the main question!