strr_FREH: Identify frequently rented entire-home (FREH) listings

View source: R/strr_FREH.R

strr_FREHR Documentation

Identify frequently rented entire-home (FREH) listings

Description

strr_FREH takes a table of daily STR activity and identifies listings which met a given standard of availability and activity over a specified time period.

Usage

strr_FREH(
  daily,
  start_date = NULL,
  end_date = NULL,
  property_ID = property_ID,
  date = date,
  status = status,
  status_types = c("R", "A"),
  listing_type = listing_type,
  entire_home = "Entire home/apt",
  n_days = 365,
  r_cut = 90,
  ar_cut = 183,
  quiet = FALSE
)

Arguments

daily

A data frame of daily STR activity in standard UPGo format.

start_date

A character string of format YYYY-MM-DD indicating the first date for which to return output. If NULL (default), the earliest date present in 'daily' will be used.

end_date

A character string of format YYYY-MM-DD indicating the last date for which to run the analysis. If NULL (default), the latest date present in 'daily' will be used.

property_ID

The name of a character or numeric variable in the 'daily' table which uniquely identifies STR listings.

date

The name of a date variable in the 'daily' table.

status

The name of a character variable in the 'daily' table which identifies the activity status of a listing on a give date.

status_types

A two-length character vector which identifies the values in the 'status' variable indicating "reserved" and "available" status respectively. The default value is c("R", "A").

listing_type

The name of a character variable in the 'daily' table which identifies entire-home listings. Set this argument to FALSE to use all listings in the 'daily' table.

entire_home

A character string which identifies the value of the 'listing_type' variable to be used to find entire-home listings. This field is ignored if 'listing_type' is FALSE.

n_days

An integer scalar which determines how many days should be used to evaluate each listing's activity status. The default is 365 days (one year).

r_cut

An integer scalar. The threshold for number of reserved days in the last 'n_days' which qualifies for "frequently rented".

ar_cut

An integer scalar. The threshold for number of available or reserved days in the last 'n_days' which qualifies for "frequently rented".

quiet

A logical vector. Should the function execute quietly, or should it return status updates throughout the function (default)?

Details

strr_FREH is named after "frequently rented entire-home" (FREH) listings, which it identifies by examining rolling windows of activity to find listings with more than a specified number of reserved or available nights in a specified time period. By default, the function identifies entire-home listings which are available a majority of the year and reserved at least 90 nights a year, and reports for each date within the requested time range #' whether each entire-home listing satisfies or fails to satisfy these criteria.

While the inspiration for the function is identifying FREH listings, all the function's parameters can be modified; so, for example, it can instead identify all listing types reserved at least once in a month.

Value

The output will be a tidy data frame of identified FREH listings, organized with the following fields: 'property_ID' (or whatever name was passed to the property_ID argument): A character vector with the ID code of the listings. 'date': The date for which the FREH status is being reported. 'FREH': A logical scalar indicating whether, on a given date, the given listing exceeded the 'r_cut' and 'ar_cut' thresholds over the number of days specified by 'n_days'.


UPGo-McGill/strr documentation built on June 11, 2024, 1:56 a.m.