R/strr.R

### Imports and global variables ###############################################

#' @importFrom rlang .data

.datatable.aware = TRUE

if (getRversion() >= "2.15.1") {
  utils::globalVariables(c(".", ".I", ".N", ".SD"))
}


### Environment and variables ##################################################

.strr_env <- rlang::env()

housing_types <- c(
  "Apartment", "Building", "Bungalow", "Cabin", "Casa particular",
  "Casa particular (cuba)", "Castle", "Cave", "Chalet",
  "Chateau / Country House", "Condo", "Condominium", "Condominium (condo)",
  "Corporate Apartment", "Cottage", "Cycladic house", "Cycladic house (greece)",
  "Dammuso", "Dammuso (italy)", "Dome house", "Earth house", "Earth House",
  "Entire apartment", "Entire bungalow", "Entire cabin",
  "Entire casa particular", "Entire castle", "Entire cave", "Entire chalet",
  "Entire condominium", "Entire cottage", "Entire earth house", "Entire flat",
  "Entire floor", "Entire Floor", "Entire guest suite", "Entire guesthouse",
  "Entire holiday home", "Entire house", "Entire hut", "Entire in-law",
  "Entire island", "Entire loft", "Entire place", "Entire serviced apartment",
  "Entire tiny house", "Entire townhouse",  "Entire villa", "Estate",
  "Farm stay", "Farmhouse", "Flat", "Floor", "Guest House", "Guest suite",
  "Guesthouse", "Holiday home", "Home/apt", "House", "Hut",  "In-law", "Island",
  "Loft", "Mas", "Mill", "Other", "Place", "Private room",
  "Private room in apartment", "Private room in bungalow",
  "Private room in cabin", "Private room in casa particular",
  "Private room in casa particular (cuba)", "Private room in castle",
  "Private room in cave", "Private room in chalet",
  "Private room in condominium", "Private room in cottage",
  "Private room in dome house",  "Private room in earth house",
  "Private room in farm stay", "Private room in floor",
  "Private room in guest suite", "Private room in guesthouse",
  "Private room in house",  "Private room in hut", "Private room in in-law",
  "Private room in island", "Private room in loft",
  "Private room in serviced apartment", "Private room in tiny house",
  "Private room in townhouse", "Private room in villa", "Rental unit",
  "Residential home", "Riad", "Serviced apartment", "Serviced flat",
  "Shared room", "Shared room in apartment", "Shared room in bungalow",
  "Shared room in cabin", "Shared room in casa particular",
  "Shared room in casa particular (cuba)", "Shared room in castle",
  "Shared room in cave", "Shared room in chalet", "Shared room in condominium",
  "Shared room in cottage", "Shared room in earth house",
  "Shared room in farm stay", "Shared room in floor",
  "Shared room in guest suite", "Shared room in guesthouse",
  "Shared room in house", "Shared room in hut", "Shared room in in-law",
  "Shared room in island", "Shared room in loft",
  "Shared room in serviced apartment", "Shared room in tiny house",
  "Shared room in townhouse", "Shared room in trullo (italy)",
  "Shared room in villa", "Studio", "Tiny house", "Tower", "Townhome",
  "Townhouse", "Trullo", "Trullo (italy)", "Villa", "", NA
)

not_housing_types <- c(
  "Aparthotel", "Barn", "Bed & breakfast", "Bed & Breakfast",
  "Bed &amp; Breakfast", "Bed and breakfast", "Bed And Breakfast", "Boat",
  "Boutique hotel", "Bus", "Camper/rv", "Camper/RV", "Campground", "Campsite",
  "Car", "Caravan", "Condohotel", "Dorm", "Entire aparthotel",
  "Entire barn", "Entire bed & breakfast", "Entire bed and breakfast",
  "Entire boat", "Entire boutique hotel", "Entire camper/RV", "Entire campsite",
  "Entire car", "Entire dorm", "Entire heritage hotel", "Entire hostel",
  "Entire hotel", "Entire houseboat", "Entire igloo",  "Entire lighthouse",
  "Entire minsu", "Entire nature lodge", "Entire pension", "Entire plane",
  "Entire pousada", "Entire ryokan", "Entire tent", "Entire timeshare",
  "Entire tipi", "Entire train", "Entire treehouse", "Entire vacation home",
  "Entire yurt", "Heritage hotel", "Heritage hotel (india)",
  "Heritage hotel (India)", "Hostel", "Hotel", "Hotel Suites", "House Boat",
  "Houseboat", "Igloo", "Lighthouse", "Lodge", "Minsu", "Minsu (taiwan)",
  "Minsu (Taiwan)", "Mobile Home", "Nature lodge", "Parking space",
  "Parking Space", "Pension", "Pension (Korea)", "Pension (south korea)",
  "Pension (South Korea)", "Plane", "Pousada", "Private room in aparthotel",
  "Private room in bed & breakfast", "Private room in bed and breakfast",
  "Private room in boat", "Private room in boutique hotel",
  "Private room in camper/rv", "Private room in car",
  "Private room in condohotel", "Private room in dorm",
  "Private room in heritage hotel (india)", "Private room in hostel",
  "Private room in hotel", "Private room in houseboat", "Private room in igloo",
  "Private room in lighthouse", "Private room in minsu",
  "Private room in minsu (taiwan)", "Private room in nature lodge",
  "Private room in parking space", "Private room in pension",
  "Private room in pension (korea)", "Private room in pension (south korea)",
  "Private room in plane", "Private room in pousada", "Private room in resort",
  "Private room in ryokan (japan)", "Private room in tent",
  "Private room in timeshare", "Private room in tipi", "Private room in train",
  "Private room in treehouse", "Private room in vacation home",
  "Private room in yurt", "Recreational Vehicle", "Resort",
  "Room in aparthotel", "Room in boutique hotel", "Room in heritage hotel",
  "Room in heritage hotel (india)", "Room in hotel", "Ryokan", "Ryokan (japan)",
  "Ryokan (Japan)", "Shared room in aparthotel",
  "Shared room in bed & breakfast", "Shared room in bed and breakfast",
  "Shared room in boat", "Shared room in boutique hotel",
  "Shared room in camper/rv", "Shared room in dorm", "Shared room in hostel",
  "Shared room in hotel", "Shared room in igloo", "Shared room in lighthouse",
  "Shared room in minsu (taiwan)", "Shared room in nature lodge",
  "Shared room in parking space", "Shared room in pension (korea)",
  "Shared room in pension (south korea)", "Shared room in plane",
  "Shared room in pousada", "Shared room in resort",
  "Shared room in ryokan (japan)", "Shared room in tent",
  "Shared room in timeshare", "Shared room in tipi", "Shared room in train",
  "Shared room in treehouse", "Shared room in vacation home",
  "Shared room in yurt", "Shepherd&#39;s hut",
  "Shepherd&#39;s hut (u.k., france)", "Shepherd&#39;s hut (U.K., France)",
  "Tent", "Timeshare", "Tipi", "Train", "Treehouse", "Vacation home", "Van",
  "Windmill", "Yacht", "Yurt"
)

country_list <-
  c("Afghanistan", "\u00c5land Islands", "Albania", "Algeria",
    "American Samoa", "Andorra", "Angola", "Anguilla", "Antigua and Barbuda",
    "Argentina", "Armenia", "Aruba", "Australia", "Austria", "Azerbaijan",
    "Bahamas", "Bahrain", "Bangladesh", "Barbados", "Belarus", "Belgium",
    "Belize", "Benin", "Bermuda", "Bhutan", "Bolivia",
    "Bonaire, Sint Eustatius and Saba", "Bosnia and Herzegovina", "Botswana",
    "Brazil", "British Virgin Islands", "Brunei", "Bulgaria", "Burkina Faso",
    "Burundi", "Cambodia", "Cameroon", "Canada", "Cape Verde",
    "Cayman Islands", "Central African Republic", "Chad", "Chile", "China",
    "Christmas Island", "Cocos (Keeling) Islands", "Colombia", "Comoros",
    "Congo", "Cook Islands", "Costa Rica", "Croatia", "Cuba", "Cura\u00e7ao",
    "Cyprus", "Czech Republic", "Democratic Republic of the Congo", "Denmark",
    "Djibouti", "Dominica", "Dominican Republic", "East Timor", "Ecuador",
    "Egypt", "El Salvador", "Equatorial Guinea", "Eritrea", "Estonia",
    "Ethiopia", "Falkland Islands (Malvinas)", "Faroe Islands", "Fiji",
    "Finland", "France", "French Guiana", "French Polynesia", "Gabon",
    "Gambia", "Georgia", "Germany", "Ghana", "Gibraltar", "Greece",
    "Greenland", "Grenada", "Guadeloupe", "Guam", "Guatemala", "Guernsey",
    "Guinea", "Guinea-Bissau", "Guyana", "Haiti", "Honduras", "Hong Kong",
    "Hungary", "Iceland", "India", "Indonesia", "Iraq", "Ireland",
    "Isle of Man", "Israel", "Italy", "Ivory Coast", "Jamaica", "Japan",
    "Jersey", "Jordan", "Kazakhstan", "Kenya", "Kiribati", "Kosovo", "Kuwait",
    "Kyrgyzstan", "Laos", "Latvia", "Lebanon", "Lesotho", "Liberia", "Libya",
    "Liechtenstein", "Lithuania", "Luxembourg", "Macau", "Macedonia",
    "Madagascar", "Malawi", "Malaysia", "Maldives", "Mali", "Malta",
    "Marshall Islands", "Martinique", "Mauritania", "Mauritius", "Mayotte",
    "Mexico", "Micronesia", "Moldova", "Monaco", "Mongolia", "Montenegro",
    "Montserrat", "Morocco", "Mozambique", "Myanmar", "Namibia", "Nauru",
    "Nepal", "Netherlands", "New Caledonia", "New Zealand", "Nicaragua",
    "Niger", "Nigeria", "Niue", "Norfolk Island", "Northern Mariana Islands",
    "Norway", "Oman", "Pakistan", "Palau", "Palestinian Territories",
    "Panama", "Papua New Guinea", "Paraguay", "Peru", "Philippines",
    "Pitcairn Islands", "Poland", "Portugal", "Puerto Rico", "Qatar",
    "R\u00e9union", "Romania", "Russia", "Rwanda", "Saint Barth\u00e9lemy",
    "Saint Helena", "Saint Kitts and Nevis", "Saint Lucia", "Saint Martin",
    "Saint Pierre and Miquelon", "Saint Vincent and the Grenadines", "Samoa",
    "San Marino", "S\u00e3o Tom\u00e9 and Pr\u00edncipe", "Saudi Arabia",
    "Senegal", "Serbia", "Seychelles", "Sierra Leone", "Singapore",
    "Sint Maarten", "Slovakia", "Slovenia", "Solomon Islands", "Somalia",
    "South Africa", "South Korea", "South Sudan", "Spain", "Sri Lanka",
    "Sudan", "Suriname", "Svalbard and Jan Mayen", "Swaziland", "Sweden",
    "Switzerland", "Taiwan", "Tajikistan", "Tanzania", "Thailand", "Togo",
    "Tonga", "Trinidad and Tobago", "Tunisia", "Turkey", "Turkmenistan",
    "Turks and Caicos Islands", "Tuvalu", "U.S. Virgin Islands", "Uganda",
    "Ukraine", "United Arab Emirates", "United Kingdom", "United States",
    "Uruguay", "Uzbekistan", "Vanuatu", "Venezuela", "Vietnam",
    "Wallis and Futuna", "Yemen", "Zambia", "Zimbabwe"
  )

country_match <-
  dplyr::tibble(
    country = country_list,
    code =
      c("AF", "AX", "AL", "DZ", "AS", "AD", "AN", "AI", "AG", "AR", "AM", "AW",
        "AU", "AT", "AZ", "BS", "BH", "BD", "BB", "BY", "BE", "BZ", "BJ", "BM",
        "BT", "BO", "BQ", "BA", "BW", "BR", "VG", "BN", "BG", "BF", "BI", "KH",
        "CM", "CA", "CV", "KY", "CF", "TD", "CL", "CN", "CX", "CC", "CO", "KM",
        "CG", "CK", "CR", "HR", "CU", "CW", "CY", "CZ", "CD", "DK", "DJ", "DM",
        "DO", "TL", "EC", "EG", "SV", "GQ", "ER", "EE", "ET", "FK", "FO", "FJ",
        "FI", "FR", "GF", "PF", "GA", "GM", "GE", "DE", "GH", "GI", "GR", "GL",
        "GD", "GP", "GU", "GT", "GG", "GN", "GW", "GY", "HT", "HN", "HK", "HU",
        "IS", "IN", "ID", "IR", "IE", "IM", "IL", "IT", "CI", "JM", "JP", "JE",
        "JO", "KZ", "KE", "KI", "XK", "KW", "KG", "LA", "LV", "LB", "LS", "LR",
        "LY", "LI", "LT", "LU", "MO", "MK", "MG", "MW", "MY", "MV", "ML", "MT",
        "MH", "MQ", "MR", "MU", "YT", "MX", "FM", "MD", "MC", "MN", "ME", "MS",
        "MA", "MZ", "MM", "NA", "NR", "NP", "NL", "NC", "NZ", "NI", "NE", "NG",
        "NU", "NF", "MP", "NO", "OM", "PK", "PW", "PS", "PA", "PG", "PY", "PE",
        "PH", "PN", "PL", "PT", "PR", "QA", "RE", "RO", "RU", "RW", "BL", "SH",
        "KN", "LC", "MF", "PM", "VC", "WS", "SM", "ST", "SA", "SN", "RS", "SC",
        "SL", "SG", "SX", "SK", "SI", "SB", "SO", "ZA", "KR", "SS", "ES", "LK",
        "SD", "SR", "SJ", "SZ", "SE", "CH", "TW", "TJ", "TZ", "TH", "TG", "TO",
        "TT", "TN", "TR", "TM", "TC", "TV", "VI", "UG", "UA", "AE", "GB", "US",
        "UY", "UZ", "VU", "VE", "VN", "WF", "YE", "ZM", "ZW")
  )
UPGo-McGill/strr documentation built on Feb. 24, 2024, 6:15 p.m.