title: Keep duplicate column names when subsetting in R
body: <p>I have a dataframe with duplicate column names in R, when I select specific columns from this dataframe using subset it renames the duplicates making them distinct. When I am creating a dataframe using the function data.frame() I can stop this happening by using the argument check.names = FALSE, is there a way I can also do this using subset (or any other way which selects names columns).</p>
  
  <p>For example say I have the dataframe </p>
  
  <pre><code>data &lt;- data.frame('sample' = 50, 'x_mean' = 1.5, 'Lower CI' = 1.0, 'Upper CI' = 2.0, 'sample' = 50, 'y_mean' = 0.6, 'Lower CI' = 0.3, 'Upper CI' = 0.9, check.names = FALSE)
  
  selectVec &lt;- c(TRUE, TRUE, TRUE, TRUE, FALSE, TRUE, TRUE, TRUE)
  </code></pre>
  
  <p>Using the code </p>
  
  <pre><code>subset(data, select = selectVec)
  </code></pre>
  
  <p>renames the duplicate confidence intervals 'Lower CI.1' and 'Upper CI.1', whereas I want to keep these as 'Lower CI' and 'Upper CI'. Does anyone know a way of doing this?</p>
  
  <p>Thanks in advance.</p>