census.calc carries out calculations indicated with the argument
For example, this will be needed when trait are sub-classes and there is
the need to sum a subset of them (e.g. traits are divided by gender and age
and the user wants to have the total by gender) or calculate a proportion
(e.g. sex-ratio or over the total). Therefore, typically, these operations
will be sums, subtractions, divisions or
bin.f can take any function that it is
Reduce() (default is
The existing census file will be overwritten with the new census file, which will include the new variable.
The subset of data to be used by
bin.f is indicated with
This argument takes a character vector with the headers of the census files.
These have to match exactly the headers in the census file (including spaces).
headers is internally modified with
make.names() to guarantee
that names are syntactically valid. Therefore, a character vector where the
headers were already modified and would match the results of
is also acceptable.
var.name is the name of the new variable being calculated.
If none is passed, then, by default,
census.calc will paste together
the names passed with
headers separated by the operator passed with
bin.f is a function (i.e. a R object of class
'function'), the default behaviour will fail and an error is reported. In
this case, the user have to pass a valid
var.name. It is recommended
to use letters, numbers and the dot or underline ("_") characters, to start with
a letter or the dot not followed by a number.
The path to the 'Results' folder
The census number to be processed
A character vector matching exactly the headers of the census
file columns that are to be used by
A character vector to name the new variable. Mandatory if
A character vector to pass the binary function to be applied to
the columns identified by
A character vector with the scenarios to be processed or "all"
If more then one calculations needs to be performed, of the same calculations
needs to be performed on different groups of variables (headers), then
census.calc needs to be run multiple times.
Save census file to disk and return a list with the new census files
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.