title: Test if column name contains string in R
body: <p>I'm attempting to test if each of the column names in my dataframe contain a particular string (in this case "Fld". My attempt below is not compiling and I'm not sure where I'm going wrong. Any help would be appreciated.</p>
  
  <pre><code>varnames &lt;-colnames(data)
  for (i in 1:len(varnames)){
    if grepl("Fld",varnames[i])==TRUE {
      print varnames[i]
    }
  }
  </code></pre>