[R] YourCast Data Format

Dieter Menne dieter.menne at menne-biomed.de
Mon Jan 10 08:33:10 CET 2011

Thomas Jensen-6 wrote:
> ... data set ...
> The data set has in total 27 countries for the years 1999 to 2008, but  
> with unbalanced panels.
> I want to be able to estimate a model and do forecasting for each  
> country in the data set. I have been looking into the YourCast package  
> from King et al. but since I have all my data in a single file, I am  
> at a loss as to how to create a data object that the yourcast()  
> function will accept. 

The base R-method uses "by" followed by "do.call":

dt = your data structure in the mail which has only one country, so the
result is a bit confusing

dt.by = by(dt,dt$Country, function(x){
  # put you own calculation here


This sequence is not really intuitive, so an add-on industry has evolved,
for examples in packages doBy (fast, straightforward) and plyr (can be slow,
but comprehensive and consistent). Best is you try the base method first,
and work with the packages later.


View this message in context: http://r.789695.n4.nabble.com/YourCast-Data-Format-tp3205174p3206697.html
Sent from the R help mailing list archive at Nabble.com.

More information about the R-help mailing list