strr_process_property: Function to process raw property STR tables into UPGo format

View source: R/strr_process_property.R

strr_process_propertyR Documentation

Function to process raw property STR tables into UPGo format

Description

strr_process_property takes raw property tables from AirDNA and cleans them for analysis or for upload in the UPGo database storage format.

Usage

strr_process_property(property, keep_cols = FALSE, quiet = FALSE)

Arguments

property

An unprocessed property data frame in the raw AirDNA format, with either 37 or 56 fields.

keep_cols

A logical scalar. If the 'property' table has 56 fields, should the superfluous 19 fields be kept, or should the table be trimmed to the 37 fields which UPGo uses (default)?

quiet

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

Details

A function for cleaning raw property tables from AirDNA and preparing them for subsequent analysis or upload in the UPGo format. The function also produces error files which identify possible corrupt or missing lines in the input file.

The function expects the input property file to have either 56 fields (the default for a raw table from AirDNA) or 37 fields (the default for UPGo, after the 'Zipcode', 'Average Daily Rate (USD)', 'Average Daily Rate (Native)', 'Annual Revenue LTM (USD)', 'Annual Revenue LTM (Native)', 'Occupancy Rate LTM', 'Number of Bookings LTM', 'Count Reservation Days LTM', 'Count Available Days LTM', 'Count Blocked Days LTM', 'Calendar Last Updated', 'Security Deposit (Native)', 'Cleaning Fee (Native)', 'Extra People Fee (Native)', 'Published Nightly Rate (USD)', 'Published Monthly Rate (USD)', 'Published Weekly Rate (USD)', 'Airbnb Listing URL', and 'HomeAway Listing URL' fields are removed on import). Eventually the function will be updated to support inputs from Inside Airbnb as well.

Because the expectation is that the input files will be very large, the function uses updating by reference on the property input table. This saves a considerable amount of memory by avoiding making an unnecessary copy of the input table, but has the side effect of changing the initial input file even if the output is being assigned to a new object. An 'update_by_reference' argument may be added to the function in the future to override this behaviour.

Value

A list with three elements: 1) the processed 'property' table; 2) an 'error' table identifying corrupt or otherwise invalid row entries; 3) a 'missing_geography' table identifying property_IDs with missing latitude/longitude coordinates.


UPGo-McGill/strr documentation built on Feb. 24, 2024, 6:15 p.m.