Description Usage Arguments Details Value See Also
Allocates the number of cases/events from irregular spatial units onto to regular set of spatial units. The regular spatial units are assumed to have POLYGON geometry, while the irregular spatial units are assumed to have POINT geometry.
Note that this function is largely a wrapper for using sf::st_contains
with basic
aggregation before and after. It is provided primarily for (relative) consistency with gail.
1 2 |
sp_units |
Dataset of regular spatial units, see details. |
cases |
Dataset containing the the cases, see details. |
suid |
Column name in both |
num_cases |
Column name from |
group |
Optional name of variable in |
label |
Optional value of |
convert |
Logical, convert returned object to |
... |
Space for additional arguments. |
sp_units
should be an object of class sf
(from the sf package). The
argument convert
can be used to convert the results into a Spatial*
object (from
the sp package).
cases
contains the units (and associated number of cases) to be allocated.
This should be an object of class sf
. If not, it must have coordinates latitude
and longitude
and will be converted to an sf
object.
The dataset of cases should be aggregated and have a column for the number
of cases. If the column given by num_cases
does not exist in cases
,
then cases
will be aggregated by suid
to create the column.
group
and label
: If provided, these arguments are used to filter cases
to rows where group == label
.
Returns a copy of sp_units
after having added a column named num_cases
, which contains
the number of cases which fall within the boundry of each spatial unit.
gail
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.