print.poplab             package:poplab             R Documentation

_S_a_v_e _t_o _f_i_l_e _a _s_i_m_u_l_a_t_e_d _p_o_p_u_l_a_t_i_o_n

_D_e_s_c_r_i_p_t_i_o_n:

     Save to file a simulated population in the folder specified  in
     the function call. The name of the resulting file indicates
     whether a baseline or an evolved population was saved.

_U_s_a_g_e:

     ## S3 method for class 'poplab':
     print(x, option, year, folder, ...)

_A_r_g_u_m_e_n_t_s:

       x: an object returned by the  'create.baseline.complete' or the
          'simped' function

  option: 2 possible values '"base"' or '"current"' (see Details)

    year: last simulated year

  folder: folder (quoted) where the function saves the population. For
          example,  it might be your R_HOME/library/poplab/data/
          directory, where R_HOME is the location where R is installed
          on your computer (see Examples below).

     ...: further arguments passed to or from other methods

_D_e_t_a_i_l_s:

     'year' The population simulated only up to this calendar 'year' 
     is saved (i.e. individuals born after this 'year' are excluded).

     'option' Which simulated population should be saved to file? 
      '"base"' specifies a virtual baseline population (either an
     object returned by the 'create.baseline.complete' function or the
     first list component returned by the 'simped' function). 
      '"current"' specifies en evolved population simulated up to the
     calendar year set by 'year'; this population is the second list
     component returned by the 'simped' function.

_N_o_t_e:

     An error will be generated when attempting to save an object
     returned by the 'create.baseline.complete' function (the value of
     the 'pop' argument) with 'option' set to '"current"'.

_S_e_e _A_l_s_o:

     'create.baseline.complete', 'simped', 'plot.poplab'

_E_x_a_m_p_l_e_s:

     ## Not run: 
     For these examples it is necessary to use the simped function
     and assign the result to a variable called 'simpop'.
     ## End(Not run)

     ## simulate the population for the calendar period 1955-2002:
     simpop <- 
     simped(baseyear = 1955, basehealth = 0, basefamrisk = 2, 
     sex.a = 2, endyear = 2002, healthy = 0, famrisk = 2, 
     mortratio = 2, d.mod = "rr", fam.rel = "p", print.option = 
     FALSE, population.fem = "populationfem.txt", population.male = 
     "populationmale.txt", mortality.fem = "mortalityfem.txt", 
     mortality.male = "mortalitymale.txt", fertility = 
     "fertility.txt", incidence = "incidence.txt", seed = 
     52482337, folder = system.file("data", package = "poplab"))

     ## save the population simulated up to the calendar year 1990
     ## (although the simped function simulated the population up
     ## to the year 2002); the name of the created file will be
     ## 'simpop_endYr_1990.txt'
     print.poplab(simpop, "current", year = 1990, folder =
     system.file("data", package = "poplab"))

     ## save the 1955 baseline population to a file named
     ## "base_pop_1955.txt"  
     print.poplab(simpop, "base", year = 1955, folder =
     system.file("data", package = "poplab"))

