This function extracts data user-defined data (i.e. table.hosts, N.infected, table.state or popStructure) from a nosoiSim object.

getHostData(
  nosoi.output,
  what = c("table.hosts", "N.infected", "table.state", "popStructure"),
  pop = "A"
)

Arguments

nosoi.output

an object of class nosoiSim

what

the data to get, among table.hosts, N.infected, table.state or popStructure.

pop

the population to be extracted (one of "A" or "B")

Value

Returns a data.table with the requested data.

See also

To directly extract table.hosts or table.state, you can also use getTableHosts and getTableState respectively.

Examples

# \donttest{ t_incub_fct <- function(x){rnorm(x,mean = 5,sd=1)} p_max_fct <- function(x){rbeta(x,shape1 = 5,shape2=2)} p_Exit_fct <- function(t){return(0.08)} proba <- function(t,p_max,t_incub){ if(t <= t_incub){p=0} if(t >= t_incub){p=p_max} return(p) } time_contact <- function(t){round(rnorm(1, 3, 1), 0)} test.nosoi <- nosoiSim(type="single", popStructure="none", length=40, max.infected=100, init.individuals=1, nContact=time_contact, param.nContact=NA, pTrans = proba, param.pTrans = list(p_max=p_max_fct, t_incub=t_incub_fct), pExit=p_Exit_fct, param.pExit=NA)
#> Starting the simulation #> Initializing ...
#> running ...
#> done. #> The simulation has run for 2 units of time and a total of 1 hosts have been infected.
data.extracted <- getHostData(test.nosoi, "table.hosts", "A") # }