title: Epidemiological curve using R and epitools gives wrong epiweeks
body: <p>I have been trying to make epidemic curves in <code>R</code> with the <code>epitools</code> package. According to the documentation, you can automatically generate epidemiological weeks from a date variable, similar as I have been doing for long in <code>STATA</code>. Fyi, epidemiological weeks are different from yearly week numbers: </p>
  
  <blockquote>
    <p>The first epi week of the year ends, by definition, on the first
    Saturday of January, as long as it falls at least four days into the
    month. Each epi week begins on a Sunday and ends on a Saturday.</p>
  </blockquote>
  
  <ul>
  <li><a href="http://www.cmmcp.org/epiweek.htm" rel="nofollow noreferrer">http://www.cmmcp.org/epiweek.htm</a></li>
  <li><p><a href="https://wiki.ecdc.europa.eu/fem/f/1287/p/576/681.aspx#681" rel="nofollow noreferrer">https://wiki.ecdc.europa.eu/fem/f/1287/p/576/681.aspx#681</a></p>
  
  <p>graphlabels&lt;-epicurve.weeks(DATE_variable, 
                              axisnames=FALSE, 
                              xlab = "Week of Year", 
                              ylab = "Cases per week",
                              tick.offset = 0.5, 
                              col=mypalette)
              axis(1, 
                   at = graphlabels$xvals, 
                   labels = graphlabels$cweek, 
                   tick = FALSE, 
                   line = 0,<br>
  )</p></li>
  </ul>
  
  <p>This automatically generated a nice curve: </p>
  
  <p><img src="https://i.stack.imgur.com/Ttgqk.png" alt="http://imgur.com/AG2P5mM"></p>
  
  <p>"Hurray!!", I thought. But, alas, being a scientist I double checked the data using <code>STATA</code> as well as manually and noticed that the data does not correspond! </p>
  
  <ul>
  <li>Am I doing something wrong with <code>epitool</code> package that it gives me wrong epic weeks?</li>
  </ul>