title: R: read csv with column names in variables
body: <p>I would like to read a csv file and to use the column names from variables. Of Course the strings in the variables are equal to the column names of the csv file.</p>
  
  <p>The name in the column in the csv are e.g. "name" , "ps" and "year". When I just would like to read the csv and to assign column types (without any variables) I use: </p>
  
  <pre><code>library(readr)   
  CarTest &lt;- read_csv("~/_file.csv", 
                                    col_types = cols( 
                                    name = col_character(),
                                    year_a = col_character(),       
                                    ps =col_double()))
  </code></pre>
  
  <p>The idea is to assign the name of the columns in a variable to ensure that if the column names in the csv file are changed, just the strings of variables have to be changed, too. So, I would like to assign the column names in variables before (still the column names in the csv_file and the strings in the variables are the same). I tried different approaches: This example (hopefully) shows, that I try to paste the string of the variable <code>car_names</code> in the <code>read_csv</code> function. But obviously <code>get</code> is the wrong approach:</p>
  
  <pre><code>library(readr)    
  car_names &lt;- "name"      
  engine_power &lt;- "ps"
  year_a &lt;-"year" 
  
  
  
      CarTest &lt;- read_csv("~/_file.csv", 
                                    col_types = cols( 
  
                                    get("car_names") = col_character(),
                                    get("year_a") = col_character(),       
                                    get("engine_power") =col_double()))
  </code></pre>
  
  <p>Thank you for your help ;) </p>