Skip to content

Commit

Permalink
Merge pull request #12 from getwilds/bugsquash
Browse files Browse the repository at this point in the history
resolved errors in incident
  • Loading branch information
realbp authored Feb 6, 2024
2 parents ba5e33b + df10311 commit 73b62e2
Show file tree
Hide file tree
Showing 5 changed files with 14 additions and 36 deletions.
1 change: 0 additions & 1 deletion NAMESPACE
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,5 @@ importFrom(rlang,":=")
importFrom(rlang,sym)
importFrom(stats,setNames)
importFrom(stringr,str_pad)
importFrom(tibble,rownames_to_column)
importFrom(utils,data)
importFrom(utils,read.csv)
12 changes: 0 additions & 12 deletions R/incidence-cancer.R
Original file line number Diff line number Diff line change
Expand Up @@ -36,18 +36,6 @@
#' incidence_cancer("ca", "hsa", "childhood (ages <20, all sites)", "all races (includes hispanic)",
#' "males", "ages <20", "all stages")
#' }


# incidence_cancer("wa", "county", "all cancer sites", "black (non-hispanic)", "both sexes", "ages 65+", "all stages")
#
# area = "wa"
# areatype = "county"
# cancer = "all cancer sites"
# race = "black (non-hispanic)"
# sex = "both sexes"
# age = "ages 65+"
# stage = "all stages"

incidence_cancer <- function(area, areatype, cancer, race, sex=NULL, age, stage, year="latest 5 year average") {

allstage_cancer <- c("all cancer sites", "breast (female in situ)", "childhood (ages <15, all sites)",
Expand Down
30 changes: 7 additions & 23 deletions R/process-incidence.R
Original file line number Diff line number Diff line change
Expand Up @@ -8,17 +8,13 @@
#' @importFrom dplyr mutate_all na_if filter mutate rename
#' @importFrom rlang sym :=
#' @importFrom utils read.csv data
#' @importFrom tibble rownames_to_column
#'
#' @returns A processed response data frame
#'
#' @examples
#' \dontrun{
#' process_incidence(resp)
#' }


#Health.Service.Area.HSA_Code State.FIPS
process_incidence <- function(resp) {

nenv <- new.env()
Expand All @@ -37,27 +33,15 @@ process_incidence <- function(resp) {
(\(x) read.csv(textConnection(x), header=TRUE, colClasses = "character"))()


column <- c("Health.Service.Area", "County", "State")[c("Health.Service.Area.HSA_Code", "County.FIPS", "State.FIPS") %in% colnames(resp)]

old_column2 <- c("Health.Service.Area.HSA_Code", "County.FIPS", "State.FIPS")[c("Health.Service.Area.HSA_Code", "County.FIPS", "State.FIPS") %in% colnames(resp)]

column2 <- c("HSA Code", "FIPS", "FIPS")[c("Health.Service.Area.HSA_Code", "County.FIPS", "State.FIPS") %in% colnames(resp)]

# column <- c("Health.Service.Area.HSA_Code", "County.FIPS", "State.FIPS")[c("Health.Service.Area.HSA_Code", "County.FIPS", "State.FIPS") %in% colnames(resp)]

column <- c("County", "Health.Service.Area", "State")[c("County", "Health.Service.Area", "State") %in% colnames(resp)]

resp <- resp %>%
rownames_to_column(column) %>%
rename(!!column2 := !!sym(old_column2)) %>%
filter(!!sym(column) != "US (SEER+NPCR)(1)") %>%
mutate_all(\(x) na_if(x, "N/A")) %>%
mutate_all(\(x) na_if(x, "data not available")) %>%
mutate_all(\(x) na_if(x, "*")) %>%
mutate(!!column := sub("\\(\\d+\\)", "", !!sym(column)))
filter(!!sym(column) != "US (SEER+NPCR)(1)") %>%
mutate(!!sym(column) := str_replace_all(!!sym(column), "\\(\\d+\\)", ""))


if(column %in% c("Health.Service.Area", "County")) {
resp <- resp %>%
filter(!(!!sym(column) %in% state.name))
}
resp
resp <- resp %>%
filter(!(!!sym(column) %in% state.name))
}
}
4 changes: 4 additions & 0 deletions R/risk-colorectal-screening.R
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,11 @@
#' \dontrun{
#' risk_colorectal_screening("ever had colorectal endoscopy (sigmoidoscopy or colonoscopy), ages 50+",
#' "all races (includes hispanic)","both sexes")
#' risk_colorectal_screening("ever had fobt, ages 50-75", area="usa")
#' risk_colorectal_screening("ever had fobt, ages 50-75", area="wa")
#' risk_colorectal_screening("fobt (1yr) / flex sig (5yr) / fobt (3yr) / colonoscopy (10yr), ages 50-75",
#' "all races (includes hispanic)", "males" )

#' }
risk_colorectal_screening <- function(screening, race=NULL, sex=NULL, area=NULL) {

Expand Down
3 changes: 3 additions & 0 deletions man/risk_colorectal_screening.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit 73b62e2

Please sign in to comment.