title: Using a vector to read in multiple csv files to r
body: <p>I'm very new to R and trying to work out how to use a vector to read in multiple csv files. I want to create a vector with the files I want to read in, a vector with the names of the dataframes I will store the data in and a function which uses both of those to process multiple files. Here's the code I'm trying:</p>
  
  <pre><code>filevar&lt;-c("study_data_raw.csv","study_data_cleaned.csv")
  dfs&lt;-c("study_data_raw","study_data_cleaned")
  myfunc&lt;-function(x,y) {
    y&lt;- read.csv(file.path("C:/study_data",x))
    }
  myfunc(filevar,dfs)
  </code></pre>
  
  <p>I get the following error "Error in file(file, "rt") : invalid 'description' argument"</p>
  
  <p>My untrained eye can't find the logical problem and would welcome any guidance from more experienced r programmers.</p>