print.poplab {poplab} | R Documentation |
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.
## S3 method for class 'poplab': print(x, option, year, folder, ...)
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 |
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.
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".
create.baseline.complete
, simped
,
plot.poplab
## 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"))