knitr::opts_chunk$set( collapse = TRUE, comment = "#>" )
refuge
Refuge Restrooms "is a web application that seeks to provide safe restroom access for transgender, intersex, and gender nonconforming individuals." The web application includes a public API, which this package allows access to. The API does not require users to sign up or use a key. For further details on the API or the organisation behind it, see the API docs, or the Refuge Restrooms homepage. refuge
provides access to the Refuge Restrooms API in R.
Refuge Restrooms uses all user supplied data, which can be messy, and result in inconsistent coverage. It is nonetheless still useful. The example below shows how to convert US state names to the full name, including correcting a couple spelling mistakes, lowercased, and create a map showing the number of unisex, Americans with Disability Act (ADA) accessible restrooms in each state.
library(refuge) library(ggplot2) library(dplyr, warn.conflicts = FALSE) library(magrittr) library(viridis) library(stringi) library(usmap) all <- rfg_all_restrooms(accessible = TRUE, unisex = TRUE, verbose = TRUE, tidy = TRUE) all <- all %>% filter(country == "US") all$state <- tolower(trimws(all$state)) all$state <- stri_replace_all_fixed(all$state, c("minnestoa", "californa"), c("minnesota", "california"), vectorize_all = FALSE) all$state <- case_when(all$state %in% tolower(state.name) ~ all$state, all$state %in% c("washington dc", "washington, district of columbia", "columbia", "DC", "washington district of columbia") ~ "District of Columbia", TRUE ~ tolower(state.name)[match(all$state, tolower(state.abb))]) all <- all %>% filter(!is.na(state)) %>% group_by(state) %>% summarise(n_toilets=n()) p_toilets <- plot_usmap(data = all, values = "n_toilets") + scale_fill_viridis(name = "Number of\nRestrooms", label = scales::comma) + scale_x_continuous(breaks = NULL) + scale_y_continuous(breaks = NULL) + labs(x = "", y = "", caption = "Data from refuge API | January 2021 | CC-BY Evan Odell") p_toilets
knitr::include_graphics("us-map.png")
All functions in refuge
include parameters to limit queries to accessible and/or unisex restrooms.
Any scripts or data that you put into this service are public.
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.