title: Turn R data frames back into R incidence objects
body: <p>How to convert an incidence object into a dataframe and then somehow use this for plotting? The reason I need to do this is because I have to export a file in CSV format out of a secure server (incidence objects not allowed and raw data not allowed - but monthly/weekly counts fine) and generate the plot outside of the server.</p>
  <p>I can do this for an incidence object without any groups with no issues as you can see below. But, what is the equivalent function for when I have groups? I have tried the below, but does not give me what I want.</p>
  <pre class="lang-r prettyprint-override"><code>if ( !require(outbreaks) ) {install.packages(&quot;outbreaks&quot;); 
      library(outbreaks)}
  if ( !require(incidence) ){install.packages(&quot;incidence&quot;); 
          library(incidence)}
  library(ggplot2)
  
  
  #'  ## two plots 
  
  #' plot 1 for all 
  dat &lt;- ebola_sim$linelist$date_of_onset
  i &lt;- incidence(dat)
  plot(i)
  
  i_df &lt;- as.data.frame(i)
  
  #' plot 2 goruped by genfer 
  i_gender &lt;- incidence(dat,groups = ebola_sim$linelist$gender)
  plot(i_gender)
  
  i_gender_df &lt;- as.data.frame(i_gender)
  
  #' turn dataframe back into incidence object for all (working fine)
  
  i &lt;- incidence(rep(i_df$dates, i_df$counts))
  
  #' turn data frame back into incidence object for gender (not giving me what I want) ???
  
  i_gender &lt;- incidence(rep(i_gender_df$dates, i_gender_df$f &amp; i_gender_df$m))
  
  </code></pre>