-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
fixed bug in random_hcpcs added several more wrappers
- Loading branch information
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -16,7 +16,9 @@ Imports: | |
rlang, | ||
stringfish, | ||
stringr, | ||
vctrs | ||
vctrs, | ||
purrr, | ||
stats | ||
Suggests: | ||
fs, | ||
pins, | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,17 +1,26 @@ | ||
# Generated by roxygen2: do not edit by hand | ||
|
||
export(chop) | ||
export(contrast) | ||
export(empty) | ||
export(get_pin) | ||
export(gh_raw) | ||
export(letters_to_numbers) | ||
export(list_pins) | ||
export(lump) | ||
export(max_vlength) | ||
export(mount_board) | ||
export(random_hcpcs) | ||
export(remove_redundant) | ||
export(sf_detect) | ||
export(sf_extract) | ||
export(sf_remove) | ||
export(sf_sub) | ||
export(sort_order) | ||
export(split_lengths) | ||
export(take_at) | ||
export(unique_narm) | ||
export(unique_vlength) | ||
importFrom(collapse,"%!in%") | ||
importFrom(collapse,"%=%") | ||
importFrom(collapse,.c) |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,15 @@ | ||
# Generated by roxyglobals: do not edit by hand | ||
|
||
utils::globalVariables(c( | ||
# <sf_extract> | ||
"x", | ||
# <remove_redundant> | ||
"x1", | ||
# <remove_redundant> | ||
"x2", | ||
# <remove_redundant> | ||
"x3", | ||
# <remove_redundant> | ||
"x4", | ||
# <remove_redundant> | ||
"x5", | ||
NULL | ||
)) |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,65 @@ | ||
#' Contrast Redundant Characters | ||
#' | ||
#' @param long <character> vector | ||
#' @param short <character> vector | ||
#' | ||
#' @returns <character> vector | ||
#' | ||
#' @examples | ||
#' contrast( | ||
#' long = c("39550", "92083", "C5274"), | ||
#' short = c("3", "5", "M", "U")) | ||
#' | ||
#' @importFrom collapse %!in% | ||
#' | ||
#' @export | ||
#' | ||
#' @autoglobal | ||
contrast <- rr <- \(long, short) { | ||
|
||
if (empty(long)) return(character(0)) | ||
|
||
if (empty(short)) return(long) | ||
|
||
long[ | ||
sf_sub( | ||
x = long, | ||
i = 1, | ||
z = unique_vlength(short)) %!in% short] | ||
} | ||
|
||
#' Remove Redundant Characters | ||
#' | ||
#' @param x <list> of vectors | ||
#' @param verbose <logical> print output | ||
#' | ||
#' @returns <list> of vectors | ||
#' | ||
#' @examples | ||
#' random_hcpcs(15) |> | ||
#' split_lengths() |> | ||
#' remove_redundant() | ||
#' | ||
#' @importFrom collapse %=% .c | ||
#' | ||
#' @export | ||
#' | ||
#' @autoglobal | ||
remove_redundant <- function(x, verbose = FALSE) { | ||
|
||
.c(x1, x2, x3, x4, x5) %=% x | ||
|
||
out <- list( | ||
x1 = x1, | ||
x2 = rr(x2, x1), | ||
x3 = rr(x3, x1) |> rr(x2), | ||
x4 = rr(x4, x1) |> rr(x2) |> rr(x3), | ||
x5 = rr(x5, x1) |> rr(x2) |> rr(x3) |> rr(x4) | ||
) | ||
|
||
if (verbose) { | ||
return(invisible(out)) | ||
} else { | ||
return(out) | ||
} | ||
} |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.