-
Notifications
You must be signed in to change notification settings - Fork 0
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
1 parent
a744fe6
commit 600707d
Showing
8 changed files
with
99 additions
and
7 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
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,9 @@ | ||
#' | ||
#' Check missing information needed by CoDEdit tool | ||
#' | ||
#' | ||
#' | ||
|
||
cod_check_missing <- function() { | ||
|
||
} |
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,38 @@ | ||
#' | ||
#' Recode age type of cause of death data based on CoDEdit rules | ||
#' | ||
#' @param age_type A vector of values for age type based on the CoDEdit rules. | ||
#' This should either be "D" for age in days, "M" for age | ||
#' in months, or "Y" for age in years. If values are different from these, | ||
#' then `age_type_code` should be specified to correspond to the day, month, | ||
#' and year values of `age_type`. | ||
#' @param age_type_code A character or integer vector of 3 values that indicate | ||
#' which values are to be considered pertaining to days (first value in the | ||
#' vector), to months (second value in the vector), or years (third value | ||
#' in the vector). | ||
#' | ||
#' @returns A character value or vector of values containing either "D", "M", | ||
#' or "Y" for *days*, *months*, or *years* respectively. | ||
#' | ||
#' @examples | ||
#' cod_recode_age_type( | ||
#' age_type = c(rep("d", 3), rep("m", 2), rep("y", 3)), | ||
#' age_type_code = c("d", "m", "y") | ||
#' ) | ||
#' | ||
#' @rdname cod_recode_age_type | ||
#' @export | ||
#' | ||
|
||
cod_recode_age_type <- function(age_type, | ||
age_type_code = c("D", "M", "Y")) { | ||
## Recode age_type ---- | ||
age_type[age_type == age_type_code[1]] <- "D" | ||
age_type[age_type == age_type_code[2]] <- "M" | ||
age_type[age_type == age_type_code[3]] <- "Y" | ||
age_type[!age_type %in% c("D", "M", "Y")] <- NA_character_ | ||
|
||
## Return age_type ---- | ||
age_type | ||
} | ||
|
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
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.