title: Find data by multiple variable names in R
body: <p>I have a question regarding variables names in R. </p>
  
  <p>In my dataset I have a list of 70 variable names as characters and I want to find the corresponding data (including the header) in the data. </p>
  
  <p>For example I used the dataset iris. I don't want to select all variables by iris$Sepal.Length since I have 70 variables in the dataset that I use. In my code I can print the data but I am struggling with saving the data as a dataframe with the corresponding header names. Somebody any thoughts?</p>
  
  <pre><code>iris
  head(iris)
  colnames(iris)
  b &lt;- list("Sepal.Length","Petal.Length")
  
  i=1
  for (i in 1:length(b)){
  #print(b[[i]])
  print(iris[,c(b[[i]])])
  c[,i]&lt;-(iris[,c(b[[i]])])
  }
  </code></pre>