title: Data Frame containing hyphens using R
body: <p>I have created a list (Based on items in a column) in order to subset my dataset into smaller datasets relating to a particular variable. This list contains strings with hyphens in them <code>-</code>.</p>
  <pre><code>dim.list &lt;- c('Age_CareContactDate-Gender', 'Age_CareContactDate-Group',
           'Age_ServiceReferralReceivedDate-Gender',
           'Age_ServiceReferralReceivedDate-Gender-0-18',
           'Age_ServiceReferralReceivedDate-Group',
           'Age_ServiceReferralReceivedDate-Group-ReferralReason')
  </code></pre>
  <p>I have then written some code to loop through each item in this list subsetting my main data.</p>
  <pre><code>for (i in dim.list) {assign(paste(&quot;df1.&quot;,i,sep=&quot;&quot;),df[df$Dimension==i,])}
  </code></pre>
  <p>This works fine, however when I come to aggregate this in order to get some summary statistics I can't reference the dataset as <code>R</code> stops reading after the hyphen (I assume that the hyphen is some special character)</p>
  <p>If I use a different list without hyphens e.g.</p>
  <pre><code>dim.list.abr &lt;- c('ACCD_Gen','ACCD_Grp',
                'ASRRD_Gen',
                'ASRRD_Gen_0_18',
                'ASRRD_Grp',
                'ASRRD_Grp_RefRsn')
  </code></pre>
  <p>When my for loop above executes I get 6 <code>data.frames</code> with no observations.</p>
  <p>Why is this happening?</p>