View source: R/output_utilityFunctions.R
| getHostData | R Documentation | 
nosoiSim objectThis 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"
)
nosoi.output | 
 an object of class   | 
what | 
 the data to get, among   | 
pop | 
 the population to be extracted (one of "A" or "B")  | 
Returns a data.table with the requested data.
To directly extract table.hosts or table.state, you can also use getTableHosts and getTableState respectively.
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")
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.