View source: R/convertToWide.r
convertToWideFormat | R Documentation |
The function reshapes the output given by micSim or by micSimParallel into wide format. In wide format, the data comprises for each episode which an individual experiences additional column entries.
convertToWideFormat(pop)
pop |
The data frame |
A data frame comprising the microsimulation output in wide format.
- ID
is the unique numerical person identifier of an individual.
- birthDate
is the birth date of an individual.
- initState
is the state in which an individual initially entered the virtual population of the simulation.
- ns
gives the number of (completed) episodes an individual has passed.
- The variables From.i
and To.i
mark the start und the arrival state of the transition corresponding to episode i
. The variables transitionTime.i
and transitionAge.i
give the corresponding transition time and age. The enumerator i
ranges from 1 to the maximal number of transitions which an individual experienced during simulation. Only completed episodes are counted.
Sabine Zinn
# Run microsimulation before, e.g., the complex example described on the
# help page of the function "micSim".
## Not run:
pop <- micSim(initPop, immigrPop, transitionMatrix, absStates, initStates,
initStatesProb, maxAge, simHorizon, fertTr)
popWide <- convertToWideFormat(pop)
## End(Not run)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.