Description Usage Arguments Details Note See Also Examples
Save a simulated population to file in the folder specified in the function call. The name of the resulting file indicates whether a baseline or an evolved population was saved.
1 2 |
x |
an object returned by the |
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 R_HOME/library/poplab/extdata/ directory, where R_HOME is the location where R is installed on your computer (see Examples below). |
... |
further arguments for print command |
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 an 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
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 | ## 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 1954-2007:
simpop <-
simped (baseyear = 1954, endyear = 2007, population.male = "populationmale.txt",
population.fem = "populationfem.txt", fertility = "fertility.txt",
incidence.male = "incidence.male.txt", incidence.fem = "incidence.fem.txt",
mortality.male = "mortalitymale.txt", mortality.fem = "mortalityfem.txt",
healthy = 0, sex.a = 3, fam.rel = "p", d.mod = "rr", famrisk = 2, mortratio = 1,
print.option = FALSE, seed =19780720,
folder = system.file("extdata", package = "poplab"))
## save the population simulated up to the calendar year 1990 (although the
## simped function simulated the population up to the year 2007); the name of
## the created file will be 'simpop_endYr_1990.txt'
print.poplab(simpop, "current", year = 1990, folder = system.file("extdata",
package = "poplab"))
## save the 1954 baseline population to a file named "base_pop_1954.txt"
print.poplab(simpop, "base", year = 1954, folder =
system.file("extdata", package = "poplab"))
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.