-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
5 changed files
with
56 additions
and
10 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
#' Handles Crowding Values to Code | ||
#' | ||
#' This function returns a matching code value for Crowding for the api to use to get data from State Cancer Profiles | ||
#' | ||
#' @param crowding "household with >1 person per room" | ||
#' | ||
#' @importFrom rlang is_na | ||
#' | ||
#' @returns A string for its respective Crowding Value | ||
#' | ||
#' @noRd | ||
#' | ||
#' @examples | ||
#' \dontrun{ | ||
#' handle_crowding("household with >1 person per room") | ||
#' } | ||
handle_crowding <- function(crowding) { | ||
crowding <- tolower(crowding) | ||
|
||
crowding_mapping <- c( | ||
"household with >1 person per room" = "00027" | ||
) | ||
|
||
crowding_code <- crowding_mapping[crowding] | ||
|
||
if (is_na(crowding_code)) { | ||
stop("Invalid crowding input, please check the documentation for valid inputs") | ||
} | ||
|
||
return(as.character(crowding_code)) | ||
} |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters