if (FALSE) {
## Load data
data(transfers)
## Perform contact tracing using tEnd and days
contactTrace <- Trace(movements = transfers,
root = 2645,
tEnd = "2005-10-31",
days = 91)
## Calculate indegree from a ContactTrace object
id.1 <- InDegree(contactTrace)
## Calculate indegree using tEnd and days
id.2 <- InDegree(transfers,
root = 2645,
tEnd = "2005-10-31",
days = 91)
## Check that the result is identical
identical(id.1, id.2)
## Calculate indegree for all included herds
## First extract all source and destination from the dataset
root <- sort(unique(c(transfers$source,
transfers$destination)))
## Calculate indegree
result <- InDegree(transfers,
root = root,
tEnd = "2005-10-31",
days = 91)
}
Run the code above in your browser using DataLab