nosoi (version 1.0.0)

getHostData: Extracts specific data from a nosoiSim object

Description

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

Usage

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

Run this code
# NOT RUN {
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)


data.extracted <- getHostData(test.nosoi, "table.hosts", "A")
# }

Run the code above in your browser using DataLab