strr_raffle | R Documentation |
strr_raffle
takes reported STR listing locations and assigns the
listings to administrative units based on a probability density function and
other information about population or housing distribution.
strr_raffle(
property,
polys,
poly_ID,
units,
distance = 200,
seed = NULL,
pdf = "airbnb",
diagnostic = FALSE,
quiet = FALSE
)
property |
An sf or sp point-geometry object, in a projected coordinate
system. If the data frame does not have spatial attributes, an attempt will
be made to convert it to sf using |
polys |
An sf or sp polygon-geometry object with administrative geographies as polygons. |
poly_ID |
The name of a character or numeric variable in the polys object to be used as an ID to identify the "winning" polygon assigned to each point in the output. |
units |
The name of a numeric variable in the polys object which contains the weighting factor (number of people or housing units). |
distance |
A numeric scalar. The radius (in the units of the CRS) of the buffer which will be drawn around points to determine possible listing locations. |
seed |
An integer scalar. A seed for the random number generation, to allow reproducible results between iterations of strr_raffle. If NULL (default), a new seed will be chosen each time. |
pdf |
A character scalar. The probability density function which should be used for assigning listing locations within the 'distance' radius. The only option currently is "airbnb", which is a radially symmetric normal curve around the point origin, with mean 100 m and standard deviation 50 m. More options may be added in the future. |
diagnostic |
A logical scalar. Should a list of polygon candidates and associated probabilities be appended to the function output? |
quiet |
A logical scalar. Should the function execute quietly, or should it return status updates throughout the function (default)? |
A function for probablistically assigning STR listings to administrative geographies (e.g. census tracts) based on reported latitude/longitude. The function works by combining a known probability density function (e.g. Airbnb's spatial obfuscation of listing locations) with an additional source of information about possible listing locations–either population or housing densities.
The output will be the input property object with a new field appended, which specifies which polygon from the 'polys' object was probabilistically assigned to the listing, and which takes the name of the field identified in the 'poly_ID' argument. (If there was already a field with that name in the 'property' object, the new field will have "_new" appended to its name.) If diagnostic == TRUE, a 'candidates' field will also be appended, which lists the possible polygons for each point, along with their probabilities.
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.