Skip to contents

When fn contains multiple file paths, or when seed contains multiple values and fn is NULL, the matching result files are read and row-bound into a single data frame. To keep identifiers unique across simulations, positive ID columns are offset by (index - 1) * id_offset, while sentinel zeros remain unchanged.

Usage

read_opop(
  folder = NULL,
  supfile = "socsim.sup",
  seed = 42,
  suffix = "",
  fn = NULL,
  id_offset = 10000000L,
  quiet = FALSE
)

Arguments

folder

simulation base folder ("~/socsim/simulation_235/")

supfile

name of supervisory-file ("socsim.sup")

seed

random number seed (42)

suffix

optional suffix for the results-directory (default="")

fn

complete path to the file. If not provided, it will be created from the other arguments

id_offset

positive integer stride used to offset IDs when combining multiple files. Ignored for single-file reads. Default is 10 million, which allows combining up to 214 files with a total population of 10 million each.

quiet

logical. If FALSE, emit a message with the file path being read.

Value

A data frame with columns pid, fem, group, nev, dob, mom, pop, nesibm, nesibp, lborn, marid, mstat, dod, and fmult, matching the SOCSIM result.opop file. If the file is missing or empty, a zero-row data frame with these columns is returned.

Details

after the end of the simulation, socsim writes every person of the simulation into a file called result.opop |

1pidPerson id unique identifier assigned as integer in birth order
2fem1 if female 0 if male
3groupGroup identifier 1..60 current group membership of individual
4nevNext scheduled event
5dobDate of birth integer month number
6momPerson id of mother
7popPerson id of father
8nesibmPerson id of next eldest sibling through mother
9nesibpPerson id of next eldest sibling through father
10lbornPerson id of last born child
11maridId of marriage in .omar file
12mstatMarital status at end of simulation integer 1=single;2=divorced; 3=widowed; 4=married
13dodDate of death or 0 if alive at end of simulation
14fmultFertility multiplier

This table explains the columns of the opop file and the columns of the output data frame. You can either provide the complete path to the file or the folder, supfilename, seed and suffix with which you started the simulation