## Not run:
#
# ## Load data
# data(transfers)
#
# ## Perform contact tracing using tEnd and days
# contactTrace <- Trace(movements=transfers,
# root=2645,
# tEnd='2005-10-31',
# days=91)
#
# ## Calculate network summary from a ContactTrace object
# ns.1 <- NetworkSummary(contactTrace)
#
# ## Calculate network summary using tEnd and days
# ns.2 <- NetworkSummary(transfers,
# root=2645,
# tEnd='2005-10-31',
# days=91)
#
# ## Check that the result is identical
# identical(ns.1, ns.2)
#
# ## Calculate network summary using inBegin, inEnd
# ## outBegin and outEnd
# ns.3 <- NetworkSummary(transfers,
# root=2645,
# inBegin='2005-08-01',
# inEnd='2005-10-31',
# outBegin='2005-08-01',
# outEnd='2005-10-31')
#
# ## Check that the result is identical
# identical(ns.2, ns.3)
#
# ## When calculating the network summary for a data.frame of movements
# ## a data.frame for each combination of root, tEnd and days are returned.
# root <- c(1,2,3)
# tEnd <- c("2005-09-01", "2005-10-01")
# days <- c(30, 45)
#
# ## The network summary are calculated at the following
# ## 12 combinations.
# ## root = 1, tEnd = "2005-09-01", days = 30
# ## root = 1, tEnd = "2005-09-01", days = 45
# ## root = 1, tEnd = "2005-10-01", days = 30
# ## root = 1, tEnd = "2005-10-01", days = 45
# ## root = 2, tEnd = "2005-09-01", days = 30
# ## root = 2, tEnd = "2005-09-01", days = 45
# ## root = 2, tEnd = "2005-10-01", days = 30
# ## root = 2, tEnd = "2005-10-01", days = 45
# ## root = 3, tEnd = "2005-09-01", days = 30
# ## root = 3, tEnd = "2005-09-01", days = 45
# ## root = 3, tEnd = "2005-10-01", days = 30
# ## root = 3, tEnd = "2005-10-01", days = 45
# NetworkSummary(transfers, root, tEnd, days)
#
# ## Create a network summary for all included herds
# ## First extract all source and destination from the dataset
# root <- sort(unique(c(transfers$source,
# transfers$destination)))
#
# ## Perform contact tracing using tEnd and days
# result.1 <- NetworkSummary(transfers,
# root=root,
# tEnd='2005-10-31',
# days=90)
#
# ## Perform contact tracing using inBegin, inEnd, outBegin and outEnd.
# result.2 <- NetworkSummary(transfers,
# root=root,
# inBegin=rep('2005-08-02', length(root)),
# inEnd=rep('2005-10-31', length(root)),
# outBegin=rep('2005-08-02', length(root)),
# outEnd=rep('2005-10-31', length(root)))
# ## End(Not run)
Run the code above in your browser using DataLab