# an artificial example of an event history from the package
data("foodata")
str(foodata)
# convert the data to an object of class "epidata",
# also generating some epidemic covariates
myEpidata <- as.epidata(foodata, id.col = 1, start.col = "start",
stop.col = "stop", atRiskY.col = "atrisk", event.col = "infected",
Revent.col = "removed", coords.cols = c("x","y"),
f = list(B1 = function(u) u<=1,
B2 = function(u) u>1 & is.finite(u))
)
# note the is.finite restriction in B2 to ensure that f[[i]](Inf) = 0, for all i
str(myEpidata)
subset(myEpidata, BLOCK == 1)
summary(myEpidata) # see 'summary.epidata'
plot(myEpidata) # see 'plot.epidata' and also 'animate.epidata'
stateplot(myEpidata, "15") # see 'stateplot'
# works in interactive mode, but not in R CMD check
data("fooepidata")
stopifnot(identical(myEpidata, fooepidata))
Run the code above in your browser using DataLab