Description Usage Arguments Value Examples
function to estimate 2d density, from data frame output by density_data Produce a 2-d estimated intensity function (cases per unit area) from an (x, y, (corrected) counts) data frame.
1 | estimate_density(density_data, show.density = FALSE)
|
density_data |
A data frame with columns x, y and (corrected) number of individuals, as output by the |
show.density |
Set to TRUE to plot the data and calculated density. |
A SpatialGridDataFrame object containing intensity/prevalence estimates (@data$v
), at a grid of points (@grid
).
1 2 3 4 5 6 7 8 9 10 11 12 13 | if(require(sp)){
# simulate a line list of patient locations
my.linelist <- data.frame( longitude = round(runif(100, 0, 10), 0.01),
latitude = round(runif(100, 0, 10), 0.01)
)
# transform patients dataframe into spatialpointsdataframe
pointspatients <- SpatialPointsDataFrame(my.linelist, data=data.frame(id=1:100))
my.density.data <- density_data(pointspatients)
my.density.estimate <- estimate_density(my.density.data, show.density=TRUE)
}
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.