title: Projecting data in R
body: <p>Here my dataset, I have 194 countries with values from 2014 to 2018</p>
  
  <pre><code># A tibble: 10 x 3
     iso3  time  y
     &lt;chr&gt; &lt;chr&gt; &lt;dbl&gt;
   1 AFG   2014     0.50
   2 AFG   2015     0.55
   3 AFG   2016     0.63
   4 AFG   2017     0.68
   5 AFG   2018     0.69
   6 AGO   2014     0.54
   7 AGO   2015     0.58
   8 AGO   2016     0.57
   9 AGO   2017     0.51
  10 AGO   2018     0.61
  </code></pre>
  
  <p>What I would like to do is project data till 2023 using this function </p>
  
  <pre><code>proj &lt;- function(y, time=2014:2018, target=2023){
    stopifnot(any(y&gt;0) | any(y&lt;1))
    period &lt;- time[1]:target
    yhat &lt;- predict(glm(y ~ time, family=quasibinomial), newdata=data.frame(time=period))
    return(data.frame(time=period, y=invlogit(yhat)))
  }
  </code></pre>
  
  <p>Now the problem is that I don't know how to use functions..how to apply the abive function to my dataset to create a new dataset where I have both historical data from 2014 to 2018 and projected data till 2023 for all countries, in the same format as above.</p>
  
  <p>Could you help?</p>
  
  <p>Thank you very much</p>