Description Usage Arguments Details Value Examples
Function description process a SpatialPointsDataFrame to give numbers of cases at each unique (x,y) location. Weighting by 1/(local population density) gives corrected numbers which can be used to calculate estimated prevalence.
1 |
points |
SpatialPointsDataFrame containing the line list of patients. Should include: 1) a slot |
weights |
If required, the local population density at each (x, y) coordinate. |
Process a SpatialPointsDataFrame to give numbers of cases at each unique (x,y) location. Weighting by 1/(local population density) gives corrected numbers which can be used to calculate estimated prevalence.
A data frame containing x and y co-ordinates, and (weighted) counts. For use by other functions including estimate_density
.
1 2 3 4 5 6 7 8 9 10 11 | 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)
print(head( my.density.data ))
}
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.