title: R subsetting a data frame based on a factor variable formatted like a range (xx-xx)
body: <p>I am facing this problem for many hours now, but I know I am missing something obvious.</p>
  
  <p>Here is my problem:</p>
  
  <p>I have a data-frame in .xlsx file that can be downloaded <a href="https://www.dropbox.com/s/uc2cnbpcl51tb7v/Evolution_Population_2004_2020.xlsx" rel="nofollow">here</a>.</p>
  
  <p>I loaded this data-frame into R using RStudio on MAc and called it demoData.
  There are 5 variables (AgeRange, Women, Men, Total, and Year). </p>
  
  <p>I am not able to subset this data frame with a condition on the AgeRange. The format of this variable is as follow: xx-xx (00-04 meaning people between 00 and 04 years old). The message I have when I try to do that is that there is no row filling this condition. 
  The class of the variable "AgeRange" is factor.</p>
  
  <p>Here is my code:</p>
  
  <pre><code>demoData[demoData$AgeRange=="00-04",]
  </code></pre>
  
  <p>Thank you for your help.</p>
  
  <p><strong>Edit:</strong> from Arun. Here's input from <code>head(demoData)</code>:</p>
  
  <pre><code>     Age Feminin Masculin. Ensemble Annee
  1 00-04     720       745     1465  2004 
  2 05-09     745       767     1512  2004 
  3 10-14     813       830     1643  2004 
  4 15-19     824       820     1644  2004 
  5 20-24     839       823     1662  2004 
  6 25-29     752       699     1450  2004 
  
  # str(demoData)
  'data.frame':   272 obs. of  5 variables:
   $ Age      : Factor w/ 16 levels "00-04 ","05-09 ",..: 1 2 3 4 5 6 7 8 9 10 ...
   $ Feminin  : Factor w/ 216 levels "138 ","139 ",..: 112 124 164 165 174 130 106 86 78 66 ...
   $ Masculin.: Factor w/ 201 levels "120 ","122 ",..: 132 141 174 169 170 124 111 89 90 75 ...
   $ Ensemble : Factor w/ 242 levels "1041 ","1044 ",..: 53 66 115 116 119 50 38 14 9 238 ...
   $ Annee    : Factor w/ 17 levels "2004 ","2005",..: 1 1 1 1 1 1 1 1 1 1 ...
  </code></pre>