From cf51a80cf39da477d114dc02e8c6cb8e283f1f10 Mon Sep 17 00:00:00 2001 From: Patrick Date: Sun, 1 Mar 2020 02:50:01 -0500 Subject: [PATCH 01/51] Updated location of LIBCIM10MULTI.TXT issue #189 --- R/cim-10-fr.R | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/R/cim-10-fr.R b/R/cim-10-fr.R index ec8419ae..5cf4eefa 100644 --- a/R/cim-10-fr.R +++ b/R/cim-10-fr.R @@ -8,7 +8,7 @@ "https://www.atih.sante.fr", "plateformes-de-transmission-et-logiciels", "logiciels-espace-de-telechargement", - "telecharger/gratuit/11616/456" + "telecharger/gratuit/12713/456" ), file_name = "LIBCIM10MULTI.TXT", dl_msg = "Working on ICD-10-FR (CIM-10-FR)", From f7a19058be6a110872dcc958a9ccdd76677c9b5b Mon Sep 17 00:00:00 2001 From: Patrick Date: Sun, 1 Mar 2020 03:16:17 -0500 Subject: [PATCH 02/51] Fix error on memoising JsonGetRootConcepts On Windows, the following errors are reported due to trying to save the file "WHO.2016.en.JsonGetRootConcepts?useHtml=false.json". The ? is not a valid character on Windows. ```` Getting WHO data with JSON: https://icd.who.int/browse10/2016/en/JsonGetRootConcepts?useHtml=false Saving memoised data for 2016 en JsonGetRootConcepts?useHtml=false in C:\Users\user\AppData\Local\icd\icd/memoise/WHO.2016.en.JsonGetRootConcepts?useHtml=false.json Error in gzfile(file, mode) : cannot open the connection In addition: Warning message: In gzfile(file, mode) : cannot open compressed file 'C:\Users\user\AppData\Local\icd\icd/memoise/WHO.2016.en.JsonGetRootConcepts?useHtml=false.json', probable reason 'Invalid argument' ```` --- R/who.R | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/R/who.R b/R/who.R index b1c8cdfd..34117cb9 100644 --- a/R/who.R +++ b/R/who.R @@ -19,7 +19,7 @@ # memoise package has given me problems and crashes. DIY mem_file_name <- paste( "WHO", year, lang, - gsub("JsonGetChildrenConcepts\\?ConceptId=|&useHtml=false", "", resource), + gsub("JsonGetChildrenConcepts\\?ConceptId=|(&|\\?)useHtml=false", "", resource), "json", sep = "." ) From 8cd9fe50a8cd97c4c3f09273381a7309af42bf53 Mon Sep 17 00:00:00 2001 From: Patrick Date: Sun, 1 Mar 2020 03:59:40 -0500 Subject: [PATCH 03/51] change system.file to fail fast if directory cannot be located On Windows at least (and maybe other OSes) the `data-raw` directory is not included in the package unless it is moved into the `inst` directory. --- R/util.R | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/R/util.R b/R/util.R index b6f6ddde..12b1e359 100644 --- a/R/util.R +++ b/R/util.R @@ -398,7 +398,8 @@ capitalize_first <- function(x) { #' @noRd #' @keywords internal get_raw_data_dir <- function() { - system.file("data-raw", package = "icd") + # use mustWork = TRUE to throw an error if the directory is not found + system.file("data-raw", package = "icd", mustWork = TRUE) } .stopifnot_year <- function(year) { From 39d9ccad15a17db9405af807939bb64ccb125484 Mon Sep 17 00:00:00 2001 From: Patrick Date: Sun, 1 Mar 2020 04:00:24 -0500 Subject: [PATCH 04/51] change raw to cache for icd10be icd10be files are not included in data-raw so they should be pulled from the cache directory --- R/icd10be.R | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/R/icd10be.R b/R/icd10be.R index f2972741..30006c42 100644 --- a/R/icd10be.R +++ b/R/icd10be.R @@ -6,7 +6,7 @@ ...) { site_file_2017 <- "fy2017_reflist_icd-10-be.xlsx_last_updatet_28-07-2017_1.xlsx" - fnp <- .download_to_data_raw( + fnp <- .download_to_data_cache( paste(.icd10be_site, .icd10be_url_path, site_file_2017, @@ -28,7 +28,7 @@ } site_file <- "fy2014_reflist_icd-10-be.xlsx" .msg("Downloading or getting cached icd10be2014 data") - .download_to_data_raw( + .download_to_data_cache( paste(.icd10be_site, .icd10be_url_path, site_file, @@ -58,7 +58,7 @@ #' \url{https://www.health.belgium.be/sites/default/files/uploads/fields/fpshealth_theme_file/fy2017_reflist_icd-10-be.xlsx_last_updatet_28-07-2017_1.xlsx} # nolint end #' \url{https://www.health.belgium.be/fr/fy2014reflisticd-10-bexlsx} -#' @param ... passed to \code{.download_to_data_raw}, e.g., \code{offline = +#' @param ... passed to \code{.download_to_data_cache}, e.g., \code{offline = #' FALSE}. #' @seealso \code{link{parse_icd10be2014_be}} #' @keywords internal @@ -133,7 +133,7 @@ #' \url{https://www.health.belgium.be/fr/sante/organisation-des-soins-de-sante/hopitaux/systemes-denregistrement/icd-10-be} # nolint end #' \url{https://www.health.belgium.be/fr/fy2014reflisticd-10-bexlsx} -#' @param ... passed to \code{.download_to_data_raw}, e.g., \code{offline = +#' @param ... passed to \code{.download_to_data_cache}, e.g., \code{offline = #' FALSE}. #' @seealso \code{link{parse_icd10be2014_be}} #' @keywords internal From a8b4a737c99313c380356c09181b96912882dc3c Mon Sep 17 00:00:00 2001 From: Patrick Date: Sun, 1 Mar 2020 15:44:33 -0500 Subject: [PATCH 05/51] use httr::content to properly handle UTF-8 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The call `.dl_icd10who_json(2008, "fr", "JsonGetRootConcepts?useHtml=false")` was returning malformed text that had not been reencoded properly. For example "Autres infections intestinales bactériennes". --- R/who.R | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/R/who.R b/R/who.R index 34117cb9..68d39476 100644 --- a/R/who.R +++ b/R/who.R @@ -70,8 +70,7 @@ ) } } # end 400+ - json_data <- rawToChar(http_response$content) - jsonlite::fromJSON(json_data) + httr::content(http_response, simplifyDataFrame=TRUE) } #' Use WHO API to discover chapters @@ -91,7 +90,7 @@ } #' Get the children of a concept (ICD-10 chapter, code or range) -#' @param concept_id NULl for root, concept string for any leaf or intermediate. +#' @param concept_id NULL for root, concept string for any leaf or intermediate. #' @examples #' .dl_icd10who_children("XXII") #' .dl_icd10who_children("U84") From 3a3347bdbed76bf0940ccba719ad3d6b63eaeed1 Mon Sep 17 00:00:00 2001 From: Patrick Date: Sun, 1 Mar 2020 15:47:12 -0500 Subject: [PATCH 06/51] remove stringsAsFactors argument stringsAsFactors is being deprecated generally. The code here is causing test-score.R#333 to fail on R-devel because the id column is not a factor. See https://developer.r-project.org/Blog/public/2020/02/16/stringsasfactors/ --- R/score.R | 22 ++--------- tests/testthat/test-score.R | 77 +------------------------------------ 2 files changed, 6 insertions(+), 93 deletions(-) diff --git a/R/score.R b/R/score.R index a4c1cc7e..9fbf2ab1 100644 --- a/R/score.R +++ b/R/score.R @@ -24,11 +24,6 @@ #' frame will be returned, with the first column named as in input data frame #' (i.e., \code{visit_name}), containing all the visits, and the second column #' containing the Charlson Comorbidity Index. -#' @param stringsAsFactors single logical, passed on when constructing -#' data.frame if \code{return_df} is \code{TRUE}. If the input data frame -#' \code{x} has a factor for the \code{visit_name}, this is not changed, but a -#' non-factor \code{visit_name} may be converted or not converted according to -#' your system default or this setting. #' @param ... further arguments to pass on to \code{icd9_comorbid_quan_deyo}, #' e.g. \code{name} #' @examples @@ -46,7 +41,6 @@ charlson <- function(x, visit_name = NULL, scoring_system = c("original", "charlson", "quan"), return_df = FALSE, - stringsAsFactors = getOption("stringsAsFactors"), # nolint ...) { UseMethod("charlson") } @@ -60,7 +54,6 @@ charlson.data.frame <- function(x, visit_name = NULL, scoring_system = c("original", "charlson", "quan"), return_df = FALSE, - stringsAsFactors = getOption("stringsAsFactors"), # nolint ...) { stopifnot(is.data.frame(x), ncol(x) >= 2, !is.null(colnames(x))) stopifnot(is.null(visit_name) || @@ -68,7 +61,6 @@ charlson.data.frame <- function(x, stopifnot(is.null(visit_name) || (is.character(visit_name) && length(visit_name) == 1L)) assert_flag(return_df) - assert_flag(stringsAsFactors) # nolint visit_name <- get_visit_name(x, visit_name) res <- charlson_from_comorbid( comorbid_quan_deyo(x, @@ -84,9 +76,8 @@ charlson.data.frame <- function(x, return(res) } out <- cbind(names(res), - data.frame("Charlson" = unname(res)), - stringsAsFactors = stringsAsFactors - ) # nolint + data.frame("Charlson" = unname(res)) + ) names(out)[1] <- visit_name out } @@ -301,7 +292,6 @@ count_codes_wide <- function(x, #' frame will be returned, with the first column named as in input data frame #' (i.e., \code{visit_name}), containing all the visits, and the second column #' containing the Charlson Comorbidity Index. -#' @template stringsAsFactors #' @template dotdotdot #' @examples #' mydf <- data.frame( @@ -325,7 +315,6 @@ count_codes_wide <- function(x, van_walraven <- function(x, visit_name = NULL, return_df = FALSE, - stringsAsFactors = getOption("stringsAsFactors"), # nolint ...) { UseMethod("van_walraven") } @@ -336,13 +325,11 @@ van_walraven <- function(x, van_walraven.data.frame <- function(x, visit_name = NULL, return_df = FALSE, - stringsAsFactors = getOption("stringsAsFactors"), # nolint ...) { stopifnot(is.data.frame(x), ncol(x) >= 2, !is.null(colnames(x))) stopifnot(is.null(visit_name) || (is.character(visit_name) && length(visit_name) == 1L)) assert_flag(return_df) - assert_flag(stringsAsFactors) # nolint visit_name <- get_visit_name(x, visit_name) tmp <- icd9_comorbid_quan_elix(x, visit_name, @@ -357,9 +344,8 @@ van_walraven.data.frame <- function(x, return(res) } out <- cbind(names(res), - data.frame("vanWalraven" = unname(res)), - stringsAsFactors = stringsAsFactors - ) # nolint + data.frame("vanWalraven" = unname(res)) + ) names(out)[1] <- visit_name out } diff --git a/tests/testthat/test-score.R b/tests/testthat/test-score.R index 2c30c69b..731b145c 100644 --- a/tests/testthat/test-score.R +++ b/tests/testthat/test-score.R @@ -48,8 +48,7 @@ test_that("only matrix or data.frame accepted", { test_that("Charlson score", { mydf <- data.frame( visit_id = c("a", "b", "c"), - icd9 = c("441", "412.93", "042"), - stringsAsFactors = TRUE + icd9 = c("441", "412.93", "042") ) expect_equal( charlson_from_comorbid( @@ -64,7 +63,6 @@ test_that("Charlson score", { expect_equivalent( charlson(mydf, return_df = TRUE, - stringsAsFactors = TRUE, short_code = FALSE ), structure(list( @@ -79,77 +77,6 @@ test_that("Charlson score", { class = "data.frame" ) ) - mydff <- data.frame( - visit_id = c("a", "b", "c"), - icd9 = c("441", "412.93", "042"), - stringsAsFactors = FALSE - ) - expect_identical( - charlson(mydff, - return_df = TRUE, - stringsAsFactors = FALSE, - short_code = FALSE - ), - structure(list( - visit_id = c("a", "b", "c"), - Charlson = c(1, 1, 6) - ), - .Names = c("visit_id", "Charlson"), - row.names = c(NA, -3L), - class = "data.frame" - ) - ) - expect_identical( - charlson(mydff, - return_df = TRUE, - stringsAsFactors = TRUE, - short_code = FALSE - ), - structure(list( - visit_id = factor(c("a", "b", "c")), - Charlson = c(1, 1, 6) - ), - .Names = c("visit_id", "Charlson"), - row.names = c(NA, -3L), - class = "data.frame" - ) - ) - mydfff <- mydff - names(mydfff)[1] <- "v" - expect_equivalent( - charlson(mydfff, - return_df = TRUE, - stringsAsFactors = FALSE, - short_code = FALSE - ), - structure(list( - v = c("a", "b", "c"), - Charlson = c(1, 1, 6) - ), - .Names = c("v", "Charlson"), - row.names = c(NA, -3L), - class = "data.frame" - ) - ) - mydffff <- cbind(mydfff, data.frame(v2 = mydfff$v, stringsAsFactors = FALSE)) - mydffff$v <- NULL - expect_identical(get_icd_name(mydffff, NULL), "icd9") - expect_equivalent( - charlson(mydffff, - visit_name = "v2", - return_df = TRUE, - stringsAsFactors = FALSE, - short_code = FALSE - ), - structure(list( - v2 = c("a", "b", "c"), - Charlson = c(1, 1, 6) - ), - .Names = c("v2", "Charlson"), - row.names = c(NA, -3L), - class = "data.frame" - ) - ) }) test_that("Charlson - errors?", { @@ -308,7 +235,7 @@ test_that("van_walraven_from_comorbid score calculation", { ) }) -test_that("van_walraven comodbidity index and score", { +test_that("van_walraven comorbidity index and score", { mydf <- data.frame( id = factor(c(rep(1, 20), rep(2, 20), rep(3, 18))), value = From 5badf21e25c0bd6d1c63ae1178b6dd34ad0b5537 Mon Sep 17 00:00:00 2001 From: Patrick Date: Sun, 1 Mar 2020 15:47:44 -0500 Subject: [PATCH 07/51] export categorize_simple On r-devel the check for this example is failing with "could not find function "categorize_simple"" --- R/categorize.R | 1 + 1 file changed, 1 insertion(+) diff --git a/R/categorize.R b/R/categorize.R index 08f4d76e..1ea0c0a6 100644 --- a/R/categorize.R +++ b/R/categorize.R @@ -31,6 +31,7 @@ #' u$icd10 <- decimal_to_short(u$icd10) #' j <- categorize_simple(u, m, id_name = "case", code_name = "icd10") #' @keywords internal +#' @export categorize_simple <- function(x, map, id_name, From ddd1fac0584e76a3002179b6c75a60e9d4d18e36 Mon Sep 17 00:00:00 2001 From: Patrick Date: Sun, 1 Mar 2020 15:47:51 -0500 Subject: [PATCH 08/51] Update NAMESPACE --- NAMESPACE | 1 + 1 file changed, 1 insertion(+) diff --git a/NAMESPACE b/NAMESPACE index f8062774..9db92ca6 100644 --- a/NAMESPACE +++ b/NAMESPACE @@ -161,6 +161,7 @@ export(as.icd_long_data) export(as.icd_short_diag) export(as.icd_wide_data) export(as.short_diag) +export(categorize_simple) export(chapters_to_map) export(charlson) export(charlson_from_comorbid) From 6bf2f840091fba3205021fa028a51710a3104611 Mon Sep 17 00:00:00 2001 From: Patrick Date: Sun, 1 Mar 2020 22:17:30 -0500 Subject: [PATCH 09/51] add R_REMOTES_STANDALONE=true to fix appveyor curl error See https://github.com/r-lib/remotes#standalone-mode and https://github.com/krlmlr/r-appveyor/issues/135 --- appveyor.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/appveyor.yml b/appveyor.yml index 1349c12e..d9e2e1e2 100644 --- a/appveyor.yml +++ b/appveyor.yml @@ -36,6 +36,7 @@ build_script: environment: # APPVEYOR_CACHE_SKIP_RESTORE: true + R_REMOTES_STANDALONE: true WARNINGS_ARE_ERRORS: 1 _R_CHECK_EXIT_ON_FIRST_ERROR_: true USE_RTOOLS: true From aefd69687e16c5d2b298e3abd9ed0679697b7316 Mon Sep 17 00:00:00 2001 From: Patrick Date: Sun, 1 Mar 2020 22:44:15 -0500 Subject: [PATCH 10/51] revert stringsToFactor change --- R/score.R | 22 +++++++++-- tests/testthat/test-score.R | 77 ++++++++++++++++++++++++++++++++++++- 2 files changed, 93 insertions(+), 6 deletions(-) diff --git a/R/score.R b/R/score.R index 9fbf2ab1..a4c1cc7e 100644 --- a/R/score.R +++ b/R/score.R @@ -24,6 +24,11 @@ #' frame will be returned, with the first column named as in input data frame #' (i.e., \code{visit_name}), containing all the visits, and the second column #' containing the Charlson Comorbidity Index. +#' @param stringsAsFactors single logical, passed on when constructing +#' data.frame if \code{return_df} is \code{TRUE}. If the input data frame +#' \code{x} has a factor for the \code{visit_name}, this is not changed, but a +#' non-factor \code{visit_name} may be converted or not converted according to +#' your system default or this setting. #' @param ... further arguments to pass on to \code{icd9_comorbid_quan_deyo}, #' e.g. \code{name} #' @examples @@ -41,6 +46,7 @@ charlson <- function(x, visit_name = NULL, scoring_system = c("original", "charlson", "quan"), return_df = FALSE, + stringsAsFactors = getOption("stringsAsFactors"), # nolint ...) { UseMethod("charlson") } @@ -54,6 +60,7 @@ charlson.data.frame <- function(x, visit_name = NULL, scoring_system = c("original", "charlson", "quan"), return_df = FALSE, + stringsAsFactors = getOption("stringsAsFactors"), # nolint ...) { stopifnot(is.data.frame(x), ncol(x) >= 2, !is.null(colnames(x))) stopifnot(is.null(visit_name) || @@ -61,6 +68,7 @@ charlson.data.frame <- function(x, stopifnot(is.null(visit_name) || (is.character(visit_name) && length(visit_name) == 1L)) assert_flag(return_df) + assert_flag(stringsAsFactors) # nolint visit_name <- get_visit_name(x, visit_name) res <- charlson_from_comorbid( comorbid_quan_deyo(x, @@ -76,8 +84,9 @@ charlson.data.frame <- function(x, return(res) } out <- cbind(names(res), - data.frame("Charlson" = unname(res)) - ) + data.frame("Charlson" = unname(res)), + stringsAsFactors = stringsAsFactors + ) # nolint names(out)[1] <- visit_name out } @@ -292,6 +301,7 @@ count_codes_wide <- function(x, #' frame will be returned, with the first column named as in input data frame #' (i.e., \code{visit_name}), containing all the visits, and the second column #' containing the Charlson Comorbidity Index. +#' @template stringsAsFactors #' @template dotdotdot #' @examples #' mydf <- data.frame( @@ -315,6 +325,7 @@ count_codes_wide <- function(x, van_walraven <- function(x, visit_name = NULL, return_df = FALSE, + stringsAsFactors = getOption("stringsAsFactors"), # nolint ...) { UseMethod("van_walraven") } @@ -325,11 +336,13 @@ van_walraven <- function(x, van_walraven.data.frame <- function(x, visit_name = NULL, return_df = FALSE, + stringsAsFactors = getOption("stringsAsFactors"), # nolint ...) { stopifnot(is.data.frame(x), ncol(x) >= 2, !is.null(colnames(x))) stopifnot(is.null(visit_name) || (is.character(visit_name) && length(visit_name) == 1L)) assert_flag(return_df) + assert_flag(stringsAsFactors) # nolint visit_name <- get_visit_name(x, visit_name) tmp <- icd9_comorbid_quan_elix(x, visit_name, @@ -344,8 +357,9 @@ van_walraven.data.frame <- function(x, return(res) } out <- cbind(names(res), - data.frame("vanWalraven" = unname(res)) - ) + data.frame("vanWalraven" = unname(res)), + stringsAsFactors = stringsAsFactors + ) # nolint names(out)[1] <- visit_name out } diff --git a/tests/testthat/test-score.R b/tests/testthat/test-score.R index 731b145c..2c30c69b 100644 --- a/tests/testthat/test-score.R +++ b/tests/testthat/test-score.R @@ -48,7 +48,8 @@ test_that("only matrix or data.frame accepted", { test_that("Charlson score", { mydf <- data.frame( visit_id = c("a", "b", "c"), - icd9 = c("441", "412.93", "042") + icd9 = c("441", "412.93", "042"), + stringsAsFactors = TRUE ) expect_equal( charlson_from_comorbid( @@ -63,6 +64,7 @@ test_that("Charlson score", { expect_equivalent( charlson(mydf, return_df = TRUE, + stringsAsFactors = TRUE, short_code = FALSE ), structure(list( @@ -77,6 +79,77 @@ test_that("Charlson score", { class = "data.frame" ) ) + mydff <- data.frame( + visit_id = c("a", "b", "c"), + icd9 = c("441", "412.93", "042"), + stringsAsFactors = FALSE + ) + expect_identical( + charlson(mydff, + return_df = TRUE, + stringsAsFactors = FALSE, + short_code = FALSE + ), + structure(list( + visit_id = c("a", "b", "c"), + Charlson = c(1, 1, 6) + ), + .Names = c("visit_id", "Charlson"), + row.names = c(NA, -3L), + class = "data.frame" + ) + ) + expect_identical( + charlson(mydff, + return_df = TRUE, + stringsAsFactors = TRUE, + short_code = FALSE + ), + structure(list( + visit_id = factor(c("a", "b", "c")), + Charlson = c(1, 1, 6) + ), + .Names = c("visit_id", "Charlson"), + row.names = c(NA, -3L), + class = "data.frame" + ) + ) + mydfff <- mydff + names(mydfff)[1] <- "v" + expect_equivalent( + charlson(mydfff, + return_df = TRUE, + stringsAsFactors = FALSE, + short_code = FALSE + ), + structure(list( + v = c("a", "b", "c"), + Charlson = c(1, 1, 6) + ), + .Names = c("v", "Charlson"), + row.names = c(NA, -3L), + class = "data.frame" + ) + ) + mydffff <- cbind(mydfff, data.frame(v2 = mydfff$v, stringsAsFactors = FALSE)) + mydffff$v <- NULL + expect_identical(get_icd_name(mydffff, NULL), "icd9") + expect_equivalent( + charlson(mydffff, + visit_name = "v2", + return_df = TRUE, + stringsAsFactors = FALSE, + short_code = FALSE + ), + structure(list( + v2 = c("a", "b", "c"), + Charlson = c(1, 1, 6) + ), + .Names = c("v2", "Charlson"), + row.names = c(NA, -3L), + class = "data.frame" + ) + ) }) test_that("Charlson - errors?", { @@ -235,7 +308,7 @@ test_that("van_walraven_from_comorbid score calculation", { ) }) -test_that("van_walraven comorbidity index and score", { +test_that("van_walraven comodbidity index and score", { mydf <- data.frame( id = factor(c(rep(1, 20), rep(2, 20), rep(3, 18))), value = From 7eab1a52f59b2918f352286cd5570f27912e2efa Mon Sep 17 00:00:00 2001 From: Patrick Date: Sun, 1 Mar 2020 22:45:21 -0500 Subject: [PATCH 11/51] update test to succeed in a stringsAsFactors=FALSE environment --- tests/testthat/test-score.R | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-) diff --git a/tests/testthat/test-score.R b/tests/testthat/test-score.R index 2c30c69b..6899308f 100644 --- a/tests/testthat/test-score.R +++ b/tests/testthat/test-score.R @@ -332,10 +332,17 @@ test_that("van_walraven comodbidity index and score", { ) expect_equivalent( van_walraven(mydf, visit_name = "id", icd_name = "value", return_df = TRUE), - data.frame( - id = factor(c(1, 2, 3)), - vanWalraven = c(10, 12, -2) - ) + if(getOption("stringsAsFactors")) { + data.frame( + id = factor(c("1", "2", "3")), + vanWalraven = c(10, 12, -2) + ) + } else { + data.frame( + id = c("1", "2", "3"), + vanWalraven = c(10, 12, -2) + ) + } ) expect_equal( van_walraven(mydf, icd_name = "value"), From 37f7e4688d1e9972cef9ffb6d22ded34d088f67d Mon Sep 17 00:00:00 2001 From: Patrick Date: Sun, 1 Mar 2020 23:13:51 -0500 Subject: [PATCH 12/51] fix typos --- tests/testthat/test-score.R | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/tests/testthat/test-score.R b/tests/testthat/test-score.R index 6899308f..b1cbd0df 100644 --- a/tests/testthat/test-score.R +++ b/tests/testthat/test-score.R @@ -308,7 +308,7 @@ test_that("van_walraven_from_comorbid score calculation", { ) }) -test_that("van_walraven comodbidity index and score", { +test_that("van_walraven comorbidity index and score", { mydf <- data.frame( id = factor(c(rep(1, 20), rep(2, 20), rep(3, 18))), value = @@ -350,7 +350,7 @@ test_that("van_walraven comodbidity index and score", { ) }) -test_that("github issue #64 - quan revised charleson scores", { +test_that("github issue #64 - quan revised charlson scores", { mydf <- data.frame(visit_id = "a", icd9 = "250.0") comorbids <- comorbid_quan_deyo(mydf, short_code = FALSE, return_df = TRUE) From 6b8c7a5ff5cd23e4e27a43d9268de4efcb275f21 Mon Sep 17 00:00:00 2001 From: Patrick Date: Sun, 1 Mar 2020 23:15:41 -0500 Subject: [PATCH 13/51] move data-raw to inst directory --- {data-raw => inst/data-raw}/.gitignore | 0 {data-raw => inst/data-raw}/ICD10_Charlson.sas | 0 {data-raw => inst/data-raw}/ICD10_Elixhauser.sas | 0 {data-raw => inst/data-raw}/ICD9_E_Charlson.sas | 0 {data-raw => inst/data-raw}/ICD9_E_Elixhauser.sas | 0 {data-raw => inst/data-raw}/X.dxref.2015.csv | 0 {data-raw => inst/data-raw}/ccs_multi_dx_tool_2013.csv | 0 {data-raw => inst/data-raw}/ccs_multi_dx_tool_2015.csv | 0 {data-raw => inst/data-raw}/ccs_multi_pr_tool_2014.csv | 0 {data-raw => inst/data-raw}/comformat2012-2013.txt | 0 {data-raw => inst/data-raw}/comoanaly2012-2013.txt | 0 .../data-raw}/icd_hcc_rawdata/hierarchy/2007_hierarchy.txt | 0 .../data-raw}/icd_hcc_rawdata/hierarchy/2008_hierarchy.txt | 0 .../data-raw}/icd_hcc_rawdata/hierarchy/2009_hierarchy.txt | 0 .../data-raw}/icd_hcc_rawdata/hierarchy/2010_hierarchy.txt | 0 .../data-raw}/icd_hcc_rawdata/hierarchy/2011_hierarchy.txt | 0 .../data-raw}/icd_hcc_rawdata/hierarchy/2012_hierarchy.txt | 0 .../data-raw}/icd_hcc_rawdata/hierarchy/2013_hierarchy.txt | 0 .../data-raw}/icd_hcc_rawdata/hierarchy/2014_hierarchy.txt | 0 .../data-raw}/icd_hcc_rawdata/hierarchy/2015_hierarchy.txt | 0 .../data-raw}/icd_hcc_rawdata/hierarchy/2016_hierarchy.txt | 0 .../data-raw}/icd_hcc_rawdata/hierarchy/2017_hierarchy.txt | 0 .../data-raw}/icd_hcc_rawdata/hierarchy/2018_hierarchy.txt | 0 .../data-raw}/icd_hcc_rawdata/icd10/2016_icd10hcc.txt | 0 .../data-raw}/icd_hcc_rawdata/icd10/2017_icd10hcc.txt | 0 .../data-raw}/icd_hcc_rawdata/icd10/2018_icd10hcc.txt | 0 .../data-raw}/icd_hcc_rawdata/icd10/2019_icd10hcc.txt | 0 {data-raw => inst/data-raw}/icd_hcc_rawdata/icd9/2007_icd9hcc.txt | 0 {data-raw => inst/data-raw}/icd_hcc_rawdata/icd9/2008_icd9hcc.txt | 0 {data-raw => inst/data-raw}/icd_hcc_rawdata/icd9/2009_icd9hcc.txt | 0 {data-raw => inst/data-raw}/icd_hcc_rawdata/icd9/2010_icd9hcc.txt | 0 {data-raw => inst/data-raw}/icd_hcc_rawdata/icd9/2011_icd9hcc.txt | 0 {data-raw => inst/data-raw}/icd_hcc_rawdata/icd9/2012_icd9hcc.txt | 0 {data-raw => inst/data-raw}/icd_hcc_rawdata/icd9/2013_icd9hcc.txt | 0 {data-raw => inst/data-raw}/icd_hcc_rawdata/icd9/2014_icd9hcc.txt | 0 {data-raw => inst/data-raw}/icd_hcc_rawdata/icd9/2015_icd9hcc.txt | 0 {data-raw => inst/data-raw}/icd_hcc_rawdata/icd9/2016_icd9hcc.txt | 0 .../data-raw}/icd_hcc_rawdata/labels/2007_labels.txt | 0 .../data-raw}/icd_hcc_rawdata/labels/2008_labels.txt | 0 .../data-raw}/icd_hcc_rawdata/labels/2009_labels.txt | 0 .../data-raw}/icd_hcc_rawdata/labels/2010_labels.txt | 0 .../data-raw}/icd_hcc_rawdata/labels/2011_labels.txt | 0 .../data-raw}/icd_hcc_rawdata/labels/2012_labels.txt | 0 .../data-raw}/icd_hcc_rawdata/labels/2013_labels.txt | 0 .../data-raw}/icd_hcc_rawdata/labels/2014_labels.txt | 0 .../data-raw}/icd_hcc_rawdata/labels/2015_labels.txt | 0 .../data-raw}/icd_hcc_rawdata/labels/2016_labels.txt | 0 .../data-raw}/icd_hcc_rawdata/labels/2017_labels.txt | 0 .../data-raw}/icd_hcc_rawdata/labels/2018_labels.txt | 0 .../data-raw}/icd_hcc_rawdata/labels/2019_labels.txt | 0 .../data-raw}/ver2016_ahrq-comformat_icd10cm_2016.txt | 0 51 files changed, 0 insertions(+), 0 deletions(-) rename {data-raw => inst/data-raw}/.gitignore (100%) rename {data-raw => inst/data-raw}/ICD10_Charlson.sas (100%) rename {data-raw => inst/data-raw}/ICD10_Elixhauser.sas (100%) rename {data-raw => inst/data-raw}/ICD9_E_Charlson.sas (100%) rename {data-raw => inst/data-raw}/ICD9_E_Elixhauser.sas (100%) rename {data-raw => inst/data-raw}/X.dxref.2015.csv (100%) rename {data-raw => inst/data-raw}/ccs_multi_dx_tool_2013.csv (100%) rename {data-raw => inst/data-raw}/ccs_multi_dx_tool_2015.csv (100%) rename {data-raw => inst/data-raw}/ccs_multi_pr_tool_2014.csv (100%) rename {data-raw => inst/data-raw}/comformat2012-2013.txt (100%) rename {data-raw => inst/data-raw}/comoanaly2012-2013.txt (100%) rename {data-raw => inst/data-raw}/icd_hcc_rawdata/hierarchy/2007_hierarchy.txt (100%) rename {data-raw => inst/data-raw}/icd_hcc_rawdata/hierarchy/2008_hierarchy.txt (100%) mode change 100755 => 100644 rename {data-raw => inst/data-raw}/icd_hcc_rawdata/hierarchy/2009_hierarchy.txt (100%) mode change 100755 => 100644 rename {data-raw => inst/data-raw}/icd_hcc_rawdata/hierarchy/2010_hierarchy.txt (100%) mode change 100755 => 100644 rename {data-raw => inst/data-raw}/icd_hcc_rawdata/hierarchy/2011_hierarchy.txt (100%) mode change 100755 => 100644 rename {data-raw => inst/data-raw}/icd_hcc_rawdata/hierarchy/2012_hierarchy.txt (100%) mode change 100755 => 100644 rename {data-raw => inst/data-raw}/icd_hcc_rawdata/hierarchy/2013_hierarchy.txt (100%) mode change 100755 => 100644 rename {data-raw => inst/data-raw}/icd_hcc_rawdata/hierarchy/2014_hierarchy.txt (100%) mode change 100755 => 100644 rename {data-raw => inst/data-raw}/icd_hcc_rawdata/hierarchy/2015_hierarchy.txt (100%) mode change 100755 => 100644 rename {data-raw => inst/data-raw}/icd_hcc_rawdata/hierarchy/2016_hierarchy.txt (100%) mode change 100755 => 100644 rename {data-raw => inst/data-raw}/icd_hcc_rawdata/hierarchy/2017_hierarchy.txt (100%) mode change 100755 => 100644 rename {data-raw => inst/data-raw}/icd_hcc_rawdata/hierarchy/2018_hierarchy.txt (100%) mode change 100755 => 100644 rename {data-raw => inst/data-raw}/icd_hcc_rawdata/icd10/2016_icd10hcc.txt (100%) rename {data-raw => inst/data-raw}/icd_hcc_rawdata/icd10/2017_icd10hcc.txt (100%) rename {data-raw => inst/data-raw}/icd_hcc_rawdata/icd10/2018_icd10hcc.txt (100%) rename {data-raw => inst/data-raw}/icd_hcc_rawdata/icd10/2019_icd10hcc.txt (100%) rename {data-raw => inst/data-raw}/icd_hcc_rawdata/icd9/2007_icd9hcc.txt (100%) mode change 100755 => 100644 rename {data-raw => inst/data-raw}/icd_hcc_rawdata/icd9/2008_icd9hcc.txt (100%) mode change 100755 => 100644 rename {data-raw => inst/data-raw}/icd_hcc_rawdata/icd9/2009_icd9hcc.txt (100%) mode change 100755 => 100644 rename {data-raw => inst/data-raw}/icd_hcc_rawdata/icd9/2010_icd9hcc.txt (100%) mode change 100755 => 100644 rename {data-raw => inst/data-raw}/icd_hcc_rawdata/icd9/2011_icd9hcc.txt (100%) mode change 100755 => 100644 rename {data-raw => inst/data-raw}/icd_hcc_rawdata/icd9/2012_icd9hcc.txt (100%) mode change 100755 => 100644 rename {data-raw => inst/data-raw}/icd_hcc_rawdata/icd9/2013_icd9hcc.txt (100%) mode change 100755 => 100644 rename {data-raw => inst/data-raw}/icd_hcc_rawdata/icd9/2014_icd9hcc.txt (100%) mode change 100755 => 100644 rename {data-raw => inst/data-raw}/icd_hcc_rawdata/icd9/2015_icd9hcc.txt (100%) mode change 100755 => 100644 rename {data-raw => inst/data-raw}/icd_hcc_rawdata/icd9/2016_icd9hcc.txt (100%) mode change 100755 => 100644 rename {data-raw => inst/data-raw}/icd_hcc_rawdata/labels/2007_labels.txt (100%) mode change 100755 => 100644 rename {data-raw => inst/data-raw}/icd_hcc_rawdata/labels/2008_labels.txt (100%) mode change 100755 => 100644 rename {data-raw => inst/data-raw}/icd_hcc_rawdata/labels/2009_labels.txt (100%) mode change 100755 => 100644 rename {data-raw => inst/data-raw}/icd_hcc_rawdata/labels/2010_labels.txt (100%) mode change 100755 => 100644 rename {data-raw => inst/data-raw}/icd_hcc_rawdata/labels/2011_labels.txt (100%) mode change 100755 => 100644 rename {data-raw => inst/data-raw}/icd_hcc_rawdata/labels/2012_labels.txt (100%) mode change 100755 => 100644 rename {data-raw => inst/data-raw}/icd_hcc_rawdata/labels/2013_labels.txt (100%) mode change 100755 => 100644 rename {data-raw => inst/data-raw}/icd_hcc_rawdata/labels/2014_labels.txt (100%) mode change 100755 => 100644 rename {data-raw => inst/data-raw}/icd_hcc_rawdata/labels/2015_labels.txt (100%) mode change 100755 => 100644 rename {data-raw => inst/data-raw}/icd_hcc_rawdata/labels/2016_labels.txt (100%) mode change 100755 => 100644 rename {data-raw => inst/data-raw}/icd_hcc_rawdata/labels/2017_labels.txt (100%) mode change 100755 => 100644 rename {data-raw => inst/data-raw}/icd_hcc_rawdata/labels/2018_labels.txt (100%) mode change 100755 => 100644 rename {data-raw => inst/data-raw}/icd_hcc_rawdata/labels/2019_labels.txt (100%) mode change 100755 => 100644 rename {data-raw => inst/data-raw}/ver2016_ahrq-comformat_icd10cm_2016.txt (100%) diff --git a/data-raw/.gitignore b/inst/data-raw/.gitignore similarity index 100% rename from data-raw/.gitignore rename to inst/data-raw/.gitignore diff --git a/data-raw/ICD10_Charlson.sas b/inst/data-raw/ICD10_Charlson.sas similarity index 100% rename from data-raw/ICD10_Charlson.sas rename to inst/data-raw/ICD10_Charlson.sas diff --git a/data-raw/ICD10_Elixhauser.sas b/inst/data-raw/ICD10_Elixhauser.sas similarity index 100% rename from data-raw/ICD10_Elixhauser.sas rename to inst/data-raw/ICD10_Elixhauser.sas diff --git a/data-raw/ICD9_E_Charlson.sas b/inst/data-raw/ICD9_E_Charlson.sas similarity index 100% rename from data-raw/ICD9_E_Charlson.sas rename to inst/data-raw/ICD9_E_Charlson.sas diff --git a/data-raw/ICD9_E_Elixhauser.sas b/inst/data-raw/ICD9_E_Elixhauser.sas similarity index 100% rename from data-raw/ICD9_E_Elixhauser.sas rename to inst/data-raw/ICD9_E_Elixhauser.sas diff --git a/data-raw/X.dxref.2015.csv b/inst/data-raw/X.dxref.2015.csv similarity index 100% rename from data-raw/X.dxref.2015.csv rename to inst/data-raw/X.dxref.2015.csv diff --git a/data-raw/ccs_multi_dx_tool_2013.csv b/inst/data-raw/ccs_multi_dx_tool_2013.csv similarity index 100% rename from data-raw/ccs_multi_dx_tool_2013.csv rename to inst/data-raw/ccs_multi_dx_tool_2013.csv diff --git a/data-raw/ccs_multi_dx_tool_2015.csv b/inst/data-raw/ccs_multi_dx_tool_2015.csv similarity index 100% rename from data-raw/ccs_multi_dx_tool_2015.csv rename to inst/data-raw/ccs_multi_dx_tool_2015.csv diff --git a/data-raw/ccs_multi_pr_tool_2014.csv b/inst/data-raw/ccs_multi_pr_tool_2014.csv similarity index 100% rename from data-raw/ccs_multi_pr_tool_2014.csv rename to inst/data-raw/ccs_multi_pr_tool_2014.csv diff --git a/data-raw/comformat2012-2013.txt b/inst/data-raw/comformat2012-2013.txt similarity index 100% rename from data-raw/comformat2012-2013.txt rename to inst/data-raw/comformat2012-2013.txt diff --git a/data-raw/comoanaly2012-2013.txt b/inst/data-raw/comoanaly2012-2013.txt similarity index 100% rename from data-raw/comoanaly2012-2013.txt rename to inst/data-raw/comoanaly2012-2013.txt diff --git a/data-raw/icd_hcc_rawdata/hierarchy/2007_hierarchy.txt b/inst/data-raw/icd_hcc_rawdata/hierarchy/2007_hierarchy.txt similarity index 100% rename from data-raw/icd_hcc_rawdata/hierarchy/2007_hierarchy.txt rename to inst/data-raw/icd_hcc_rawdata/hierarchy/2007_hierarchy.txt diff --git a/data-raw/icd_hcc_rawdata/hierarchy/2008_hierarchy.txt b/inst/data-raw/icd_hcc_rawdata/hierarchy/2008_hierarchy.txt old mode 100755 new mode 100644 similarity index 100% rename from data-raw/icd_hcc_rawdata/hierarchy/2008_hierarchy.txt rename to inst/data-raw/icd_hcc_rawdata/hierarchy/2008_hierarchy.txt diff --git a/data-raw/icd_hcc_rawdata/hierarchy/2009_hierarchy.txt b/inst/data-raw/icd_hcc_rawdata/hierarchy/2009_hierarchy.txt old mode 100755 new mode 100644 similarity index 100% rename from data-raw/icd_hcc_rawdata/hierarchy/2009_hierarchy.txt rename to inst/data-raw/icd_hcc_rawdata/hierarchy/2009_hierarchy.txt diff --git a/data-raw/icd_hcc_rawdata/hierarchy/2010_hierarchy.txt b/inst/data-raw/icd_hcc_rawdata/hierarchy/2010_hierarchy.txt old mode 100755 new mode 100644 similarity index 100% rename from data-raw/icd_hcc_rawdata/hierarchy/2010_hierarchy.txt rename to inst/data-raw/icd_hcc_rawdata/hierarchy/2010_hierarchy.txt diff --git a/data-raw/icd_hcc_rawdata/hierarchy/2011_hierarchy.txt b/inst/data-raw/icd_hcc_rawdata/hierarchy/2011_hierarchy.txt old mode 100755 new mode 100644 similarity index 100% rename from data-raw/icd_hcc_rawdata/hierarchy/2011_hierarchy.txt rename to inst/data-raw/icd_hcc_rawdata/hierarchy/2011_hierarchy.txt diff --git a/data-raw/icd_hcc_rawdata/hierarchy/2012_hierarchy.txt b/inst/data-raw/icd_hcc_rawdata/hierarchy/2012_hierarchy.txt old mode 100755 new mode 100644 similarity index 100% rename from data-raw/icd_hcc_rawdata/hierarchy/2012_hierarchy.txt rename to inst/data-raw/icd_hcc_rawdata/hierarchy/2012_hierarchy.txt diff --git a/data-raw/icd_hcc_rawdata/hierarchy/2013_hierarchy.txt b/inst/data-raw/icd_hcc_rawdata/hierarchy/2013_hierarchy.txt old mode 100755 new mode 100644 similarity index 100% rename from data-raw/icd_hcc_rawdata/hierarchy/2013_hierarchy.txt rename to inst/data-raw/icd_hcc_rawdata/hierarchy/2013_hierarchy.txt diff --git a/data-raw/icd_hcc_rawdata/hierarchy/2014_hierarchy.txt b/inst/data-raw/icd_hcc_rawdata/hierarchy/2014_hierarchy.txt old mode 100755 new mode 100644 similarity index 100% rename from data-raw/icd_hcc_rawdata/hierarchy/2014_hierarchy.txt rename to inst/data-raw/icd_hcc_rawdata/hierarchy/2014_hierarchy.txt diff --git a/data-raw/icd_hcc_rawdata/hierarchy/2015_hierarchy.txt b/inst/data-raw/icd_hcc_rawdata/hierarchy/2015_hierarchy.txt old mode 100755 new mode 100644 similarity index 100% rename from data-raw/icd_hcc_rawdata/hierarchy/2015_hierarchy.txt rename to inst/data-raw/icd_hcc_rawdata/hierarchy/2015_hierarchy.txt diff --git a/data-raw/icd_hcc_rawdata/hierarchy/2016_hierarchy.txt b/inst/data-raw/icd_hcc_rawdata/hierarchy/2016_hierarchy.txt old mode 100755 new mode 100644 similarity index 100% rename from data-raw/icd_hcc_rawdata/hierarchy/2016_hierarchy.txt rename to inst/data-raw/icd_hcc_rawdata/hierarchy/2016_hierarchy.txt diff --git a/data-raw/icd_hcc_rawdata/hierarchy/2017_hierarchy.txt b/inst/data-raw/icd_hcc_rawdata/hierarchy/2017_hierarchy.txt old mode 100755 new mode 100644 similarity index 100% rename from data-raw/icd_hcc_rawdata/hierarchy/2017_hierarchy.txt rename to inst/data-raw/icd_hcc_rawdata/hierarchy/2017_hierarchy.txt diff --git a/data-raw/icd_hcc_rawdata/hierarchy/2018_hierarchy.txt b/inst/data-raw/icd_hcc_rawdata/hierarchy/2018_hierarchy.txt old mode 100755 new mode 100644 similarity index 100% rename from data-raw/icd_hcc_rawdata/hierarchy/2018_hierarchy.txt rename to inst/data-raw/icd_hcc_rawdata/hierarchy/2018_hierarchy.txt diff --git a/data-raw/icd_hcc_rawdata/icd10/2016_icd10hcc.txt b/inst/data-raw/icd_hcc_rawdata/icd10/2016_icd10hcc.txt similarity index 100% rename from data-raw/icd_hcc_rawdata/icd10/2016_icd10hcc.txt rename to inst/data-raw/icd_hcc_rawdata/icd10/2016_icd10hcc.txt diff --git a/data-raw/icd_hcc_rawdata/icd10/2017_icd10hcc.txt b/inst/data-raw/icd_hcc_rawdata/icd10/2017_icd10hcc.txt similarity index 100% rename from data-raw/icd_hcc_rawdata/icd10/2017_icd10hcc.txt rename to inst/data-raw/icd_hcc_rawdata/icd10/2017_icd10hcc.txt diff --git a/data-raw/icd_hcc_rawdata/icd10/2018_icd10hcc.txt b/inst/data-raw/icd_hcc_rawdata/icd10/2018_icd10hcc.txt similarity index 100% rename from data-raw/icd_hcc_rawdata/icd10/2018_icd10hcc.txt rename to inst/data-raw/icd_hcc_rawdata/icd10/2018_icd10hcc.txt diff --git a/data-raw/icd_hcc_rawdata/icd10/2019_icd10hcc.txt b/inst/data-raw/icd_hcc_rawdata/icd10/2019_icd10hcc.txt similarity index 100% rename from data-raw/icd_hcc_rawdata/icd10/2019_icd10hcc.txt rename to inst/data-raw/icd_hcc_rawdata/icd10/2019_icd10hcc.txt diff --git a/data-raw/icd_hcc_rawdata/icd9/2007_icd9hcc.txt b/inst/data-raw/icd_hcc_rawdata/icd9/2007_icd9hcc.txt old mode 100755 new mode 100644 similarity index 100% rename from data-raw/icd_hcc_rawdata/icd9/2007_icd9hcc.txt rename to inst/data-raw/icd_hcc_rawdata/icd9/2007_icd9hcc.txt diff --git a/data-raw/icd_hcc_rawdata/icd9/2008_icd9hcc.txt b/inst/data-raw/icd_hcc_rawdata/icd9/2008_icd9hcc.txt old mode 100755 new mode 100644 similarity index 100% rename from data-raw/icd_hcc_rawdata/icd9/2008_icd9hcc.txt rename to inst/data-raw/icd_hcc_rawdata/icd9/2008_icd9hcc.txt diff --git a/data-raw/icd_hcc_rawdata/icd9/2009_icd9hcc.txt b/inst/data-raw/icd_hcc_rawdata/icd9/2009_icd9hcc.txt old mode 100755 new mode 100644 similarity index 100% rename from data-raw/icd_hcc_rawdata/icd9/2009_icd9hcc.txt rename to inst/data-raw/icd_hcc_rawdata/icd9/2009_icd9hcc.txt diff --git a/data-raw/icd_hcc_rawdata/icd9/2010_icd9hcc.txt b/inst/data-raw/icd_hcc_rawdata/icd9/2010_icd9hcc.txt old mode 100755 new mode 100644 similarity index 100% rename from data-raw/icd_hcc_rawdata/icd9/2010_icd9hcc.txt rename to inst/data-raw/icd_hcc_rawdata/icd9/2010_icd9hcc.txt diff --git a/data-raw/icd_hcc_rawdata/icd9/2011_icd9hcc.txt b/inst/data-raw/icd_hcc_rawdata/icd9/2011_icd9hcc.txt old mode 100755 new mode 100644 similarity index 100% rename from data-raw/icd_hcc_rawdata/icd9/2011_icd9hcc.txt rename to inst/data-raw/icd_hcc_rawdata/icd9/2011_icd9hcc.txt diff --git a/data-raw/icd_hcc_rawdata/icd9/2012_icd9hcc.txt b/inst/data-raw/icd_hcc_rawdata/icd9/2012_icd9hcc.txt old mode 100755 new mode 100644 similarity index 100% rename from data-raw/icd_hcc_rawdata/icd9/2012_icd9hcc.txt rename to inst/data-raw/icd_hcc_rawdata/icd9/2012_icd9hcc.txt diff --git a/data-raw/icd_hcc_rawdata/icd9/2013_icd9hcc.txt b/inst/data-raw/icd_hcc_rawdata/icd9/2013_icd9hcc.txt old mode 100755 new mode 100644 similarity index 100% rename from data-raw/icd_hcc_rawdata/icd9/2013_icd9hcc.txt rename to inst/data-raw/icd_hcc_rawdata/icd9/2013_icd9hcc.txt diff --git a/data-raw/icd_hcc_rawdata/icd9/2014_icd9hcc.txt b/inst/data-raw/icd_hcc_rawdata/icd9/2014_icd9hcc.txt old mode 100755 new mode 100644 similarity index 100% rename from data-raw/icd_hcc_rawdata/icd9/2014_icd9hcc.txt rename to inst/data-raw/icd_hcc_rawdata/icd9/2014_icd9hcc.txt diff --git a/data-raw/icd_hcc_rawdata/icd9/2015_icd9hcc.txt b/inst/data-raw/icd_hcc_rawdata/icd9/2015_icd9hcc.txt old mode 100755 new mode 100644 similarity index 100% rename from data-raw/icd_hcc_rawdata/icd9/2015_icd9hcc.txt rename to inst/data-raw/icd_hcc_rawdata/icd9/2015_icd9hcc.txt diff --git a/data-raw/icd_hcc_rawdata/icd9/2016_icd9hcc.txt b/inst/data-raw/icd_hcc_rawdata/icd9/2016_icd9hcc.txt old mode 100755 new mode 100644 similarity index 100% rename from data-raw/icd_hcc_rawdata/icd9/2016_icd9hcc.txt rename to inst/data-raw/icd_hcc_rawdata/icd9/2016_icd9hcc.txt diff --git a/data-raw/icd_hcc_rawdata/labels/2007_labels.txt b/inst/data-raw/icd_hcc_rawdata/labels/2007_labels.txt old mode 100755 new mode 100644 similarity index 100% rename from data-raw/icd_hcc_rawdata/labels/2007_labels.txt rename to inst/data-raw/icd_hcc_rawdata/labels/2007_labels.txt diff --git a/data-raw/icd_hcc_rawdata/labels/2008_labels.txt b/inst/data-raw/icd_hcc_rawdata/labels/2008_labels.txt old mode 100755 new mode 100644 similarity index 100% rename from data-raw/icd_hcc_rawdata/labels/2008_labels.txt rename to inst/data-raw/icd_hcc_rawdata/labels/2008_labels.txt diff --git a/data-raw/icd_hcc_rawdata/labels/2009_labels.txt b/inst/data-raw/icd_hcc_rawdata/labels/2009_labels.txt old mode 100755 new mode 100644 similarity index 100% rename from data-raw/icd_hcc_rawdata/labels/2009_labels.txt rename to inst/data-raw/icd_hcc_rawdata/labels/2009_labels.txt diff --git a/data-raw/icd_hcc_rawdata/labels/2010_labels.txt b/inst/data-raw/icd_hcc_rawdata/labels/2010_labels.txt old mode 100755 new mode 100644 similarity index 100% rename from data-raw/icd_hcc_rawdata/labels/2010_labels.txt rename to inst/data-raw/icd_hcc_rawdata/labels/2010_labels.txt diff --git a/data-raw/icd_hcc_rawdata/labels/2011_labels.txt b/inst/data-raw/icd_hcc_rawdata/labels/2011_labels.txt old mode 100755 new mode 100644 similarity index 100% rename from data-raw/icd_hcc_rawdata/labels/2011_labels.txt rename to inst/data-raw/icd_hcc_rawdata/labels/2011_labels.txt diff --git a/data-raw/icd_hcc_rawdata/labels/2012_labels.txt b/inst/data-raw/icd_hcc_rawdata/labels/2012_labels.txt old mode 100755 new mode 100644 similarity index 100% rename from data-raw/icd_hcc_rawdata/labels/2012_labels.txt rename to inst/data-raw/icd_hcc_rawdata/labels/2012_labels.txt diff --git a/data-raw/icd_hcc_rawdata/labels/2013_labels.txt b/inst/data-raw/icd_hcc_rawdata/labels/2013_labels.txt old mode 100755 new mode 100644 similarity index 100% rename from data-raw/icd_hcc_rawdata/labels/2013_labels.txt rename to inst/data-raw/icd_hcc_rawdata/labels/2013_labels.txt diff --git a/data-raw/icd_hcc_rawdata/labels/2014_labels.txt b/inst/data-raw/icd_hcc_rawdata/labels/2014_labels.txt old mode 100755 new mode 100644 similarity index 100% rename from data-raw/icd_hcc_rawdata/labels/2014_labels.txt rename to inst/data-raw/icd_hcc_rawdata/labels/2014_labels.txt diff --git a/data-raw/icd_hcc_rawdata/labels/2015_labels.txt b/inst/data-raw/icd_hcc_rawdata/labels/2015_labels.txt old mode 100755 new mode 100644 similarity index 100% rename from data-raw/icd_hcc_rawdata/labels/2015_labels.txt rename to inst/data-raw/icd_hcc_rawdata/labels/2015_labels.txt diff --git a/data-raw/icd_hcc_rawdata/labels/2016_labels.txt b/inst/data-raw/icd_hcc_rawdata/labels/2016_labels.txt old mode 100755 new mode 100644 similarity index 100% rename from data-raw/icd_hcc_rawdata/labels/2016_labels.txt rename to inst/data-raw/icd_hcc_rawdata/labels/2016_labels.txt diff --git a/data-raw/icd_hcc_rawdata/labels/2017_labels.txt b/inst/data-raw/icd_hcc_rawdata/labels/2017_labels.txt old mode 100755 new mode 100644 similarity index 100% rename from data-raw/icd_hcc_rawdata/labels/2017_labels.txt rename to inst/data-raw/icd_hcc_rawdata/labels/2017_labels.txt diff --git a/data-raw/icd_hcc_rawdata/labels/2018_labels.txt b/inst/data-raw/icd_hcc_rawdata/labels/2018_labels.txt old mode 100755 new mode 100644 similarity index 100% rename from data-raw/icd_hcc_rawdata/labels/2018_labels.txt rename to inst/data-raw/icd_hcc_rawdata/labels/2018_labels.txt diff --git a/data-raw/icd_hcc_rawdata/labels/2019_labels.txt b/inst/data-raw/icd_hcc_rawdata/labels/2019_labels.txt old mode 100755 new mode 100644 similarity index 100% rename from data-raw/icd_hcc_rawdata/labels/2019_labels.txt rename to inst/data-raw/icd_hcc_rawdata/labels/2019_labels.txt diff --git a/data-raw/ver2016_ahrq-comformat_icd10cm_2016.txt b/inst/data-raw/ver2016_ahrq-comformat_icd10cm_2016.txt similarity index 100% rename from data-raw/ver2016_ahrq-comformat_icd10cm_2016.txt rename to inst/data-raw/ver2016_ahrq-comformat_icd10cm_2016.txt From 192a0e5a77b964dc902b923219a5a155f569d955 Mon Sep 17 00:00:00 2001 From: Patrick Date: Sun, 1 Mar 2020 23:48:14 -0500 Subject: [PATCH 14/51] attempt to fix "non-portable flag(s)" error on 3.6.2 travis build --- .travis.yml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/.travis.yml b/.travis.yml index 81cbabd5..f4a4253b 100644 --- a/.travis.yml +++ b/.travis.yml @@ -85,7 +85,8 @@ env: - _R_CHECK_LENGTH_1_LOGIC2_="verbose,abort" - _R_CHECK_NO_STOP_ON_TEST_ERROR_=FALSE # some of the following are ignored if --as-cran is set - - _R_CHECK_COMPILATION_FLAGS_=FALSE + - _R_CHECK_COMPILATION_FLAGS_=TRUE + - _R_CHECK_COMPILATION_FLAGS_KNOWN_="-Wno-unused-parameter -Wno-unused-variable -Wno-ignored-attributes -Wno-cast-function-type -Wno-unknown-warning-option" # the following are to simulate cran, and # help debugging if we didn't use --as-cran - _R_CHECK_ALL_NON_ISO_C_=TRUE From df80a4011571b015d5b45704b1355deff74f1a0e Mon Sep 17 00:00:00 2001 From: Patrick Date: Fri, 13 Mar 2020 01:49:17 -0400 Subject: [PATCH 15/51] updated URL MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit CIM-10-FR adds U071: Maladie à coronavirus 2019 [COVID-19] --- R/cim-10-fr.R | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/R/cim-10-fr.R b/R/cim-10-fr.R index 5cf4eefa..559ee340 100644 --- a/R/cim-10-fr.R +++ b/R/cim-10-fr.R @@ -8,7 +8,7 @@ "https://www.atih.sante.fr", "plateformes-de-transmission-et-logiciels", "logiciels-espace-de-telechargement", - "telecharger/gratuit/12713/456" + "telecharger/gratuit/13332/456" ), file_name = "LIBCIM10MULTI.TXT", dl_msg = "Working on ICD-10-FR (CIM-10-FR)", From 4b420cf2c4594bba82f89879f349ea5cb9683bc3 Mon Sep 17 00:00:00 2001 From: Patrick Date: Sun, 1 Mar 2020 15:44:33 -0500 Subject: [PATCH 16/51] use httr::content to properly handle UTF-8 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The call `.dl_icd10who_json(2008, "fr", "JsonGetRootConcepts?useHtml=false")` was returning malformed text that had not been reencoded properly. For example "Autres infections intestinales bactériennes". --- R/who.R | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/R/who.R b/R/who.R index 34117cb9..68d39476 100644 --- a/R/who.R +++ b/R/who.R @@ -70,8 +70,7 @@ ) } } # end 400+ - json_data <- rawToChar(http_response$content) - jsonlite::fromJSON(json_data) + httr::content(http_response, simplifyDataFrame=TRUE) } #' Use WHO API to discover chapters @@ -91,7 +90,7 @@ } #' Get the children of a concept (ICD-10 chapter, code or range) -#' @param concept_id NULl for root, concept string for any leaf or intermediate. +#' @param concept_id NULL for root, concept string for any leaf or intermediate. #' @examples #' .dl_icd10who_children("XXII") #' .dl_icd10who_children("U84") From 214c62576ddae14422017d28506d701b82b9f11d Mon Sep 17 00:00:00 2001 From: Patrick Date: Sun, 1 Mar 2020 15:47:12 -0500 Subject: [PATCH 17/51] remove stringsAsFactors argument stringsAsFactors is being deprecated generally. The code here is causing test-score.R#333 to fail on R-devel because the id column is not a factor. See https://developer.r-project.org/Blog/public/2020/02/16/stringsasfactors/ --- R/score.R | 22 ++--------- tests/testthat/test-score.R | 77 +------------------------------------ 2 files changed, 6 insertions(+), 93 deletions(-) diff --git a/R/score.R b/R/score.R index a4c1cc7e..9fbf2ab1 100644 --- a/R/score.R +++ b/R/score.R @@ -24,11 +24,6 @@ #' frame will be returned, with the first column named as in input data frame #' (i.e., \code{visit_name}), containing all the visits, and the second column #' containing the Charlson Comorbidity Index. -#' @param stringsAsFactors single logical, passed on when constructing -#' data.frame if \code{return_df} is \code{TRUE}. If the input data frame -#' \code{x} has a factor for the \code{visit_name}, this is not changed, but a -#' non-factor \code{visit_name} may be converted or not converted according to -#' your system default or this setting. #' @param ... further arguments to pass on to \code{icd9_comorbid_quan_deyo}, #' e.g. \code{name} #' @examples @@ -46,7 +41,6 @@ charlson <- function(x, visit_name = NULL, scoring_system = c("original", "charlson", "quan"), return_df = FALSE, - stringsAsFactors = getOption("stringsAsFactors"), # nolint ...) { UseMethod("charlson") } @@ -60,7 +54,6 @@ charlson.data.frame <- function(x, visit_name = NULL, scoring_system = c("original", "charlson", "quan"), return_df = FALSE, - stringsAsFactors = getOption("stringsAsFactors"), # nolint ...) { stopifnot(is.data.frame(x), ncol(x) >= 2, !is.null(colnames(x))) stopifnot(is.null(visit_name) || @@ -68,7 +61,6 @@ charlson.data.frame <- function(x, stopifnot(is.null(visit_name) || (is.character(visit_name) && length(visit_name) == 1L)) assert_flag(return_df) - assert_flag(stringsAsFactors) # nolint visit_name <- get_visit_name(x, visit_name) res <- charlson_from_comorbid( comorbid_quan_deyo(x, @@ -84,9 +76,8 @@ charlson.data.frame <- function(x, return(res) } out <- cbind(names(res), - data.frame("Charlson" = unname(res)), - stringsAsFactors = stringsAsFactors - ) # nolint + data.frame("Charlson" = unname(res)) + ) names(out)[1] <- visit_name out } @@ -301,7 +292,6 @@ count_codes_wide <- function(x, #' frame will be returned, with the first column named as in input data frame #' (i.e., \code{visit_name}), containing all the visits, and the second column #' containing the Charlson Comorbidity Index. -#' @template stringsAsFactors #' @template dotdotdot #' @examples #' mydf <- data.frame( @@ -325,7 +315,6 @@ count_codes_wide <- function(x, van_walraven <- function(x, visit_name = NULL, return_df = FALSE, - stringsAsFactors = getOption("stringsAsFactors"), # nolint ...) { UseMethod("van_walraven") } @@ -336,13 +325,11 @@ van_walraven <- function(x, van_walraven.data.frame <- function(x, visit_name = NULL, return_df = FALSE, - stringsAsFactors = getOption("stringsAsFactors"), # nolint ...) { stopifnot(is.data.frame(x), ncol(x) >= 2, !is.null(colnames(x))) stopifnot(is.null(visit_name) || (is.character(visit_name) && length(visit_name) == 1L)) assert_flag(return_df) - assert_flag(stringsAsFactors) # nolint visit_name <- get_visit_name(x, visit_name) tmp <- icd9_comorbid_quan_elix(x, visit_name, @@ -357,9 +344,8 @@ van_walraven.data.frame <- function(x, return(res) } out <- cbind(names(res), - data.frame("vanWalraven" = unname(res)), - stringsAsFactors = stringsAsFactors - ) # nolint + data.frame("vanWalraven" = unname(res)) + ) names(out)[1] <- visit_name out } diff --git a/tests/testthat/test-score.R b/tests/testthat/test-score.R index c00e093a..645c8113 100644 --- a/tests/testthat/test-score.R +++ b/tests/testthat/test-score.R @@ -48,8 +48,7 @@ test_that("only matrix or data.frame accepted", { test_that("Charlson score", { mydf <- data.frame( visit_id = c("a", "b", "c"), - icd9 = c("441", "412.93", "042"), - stringsAsFactors = TRUE + icd9 = c("441", "412.93", "042") ) expect_equal( charlson_from_comorbid( @@ -64,7 +63,6 @@ test_that("Charlson score", { expect_equivalent( charlson(mydf, return_df = TRUE, - stringsAsFactors = TRUE, short_code = FALSE ), structure(list( @@ -79,77 +77,6 @@ test_that("Charlson score", { class = "data.frame" ) ) - mydff <- data.frame( - visit_id = c("a", "b", "c"), - icd9 = c("441", "412.93", "042"), - stringsAsFactors = FALSE - ) - expect_identical( - charlson(mydff, - return_df = TRUE, - stringsAsFactors = FALSE, - short_code = FALSE - ), - structure(list( - visit_id = c("a", "b", "c"), - Charlson = c(1, 1, 6) - ), - .Names = c("visit_id", "Charlson"), - row.names = c(NA, -3L), - class = "data.frame" - ) - ) - expect_identical( - charlson(mydff, - return_df = TRUE, - stringsAsFactors = TRUE, - short_code = FALSE - ), - structure(list( - visit_id = factor(c("a", "b", "c")), - Charlson = c(1, 1, 6) - ), - .Names = c("visit_id", "Charlson"), - row.names = c(NA, -3L), - class = "data.frame" - ) - ) - mydfff <- mydff - names(mydfff)[1] <- "v" - expect_equivalent( - charlson(mydfff, - return_df = TRUE, - stringsAsFactors = FALSE, - short_code = FALSE - ), - structure(list( - v = c("a", "b", "c"), - Charlson = c(1, 1, 6) - ), - .Names = c("v", "Charlson"), - row.names = c(NA, -3L), - class = "data.frame" - ) - ) - mydffff <- cbind(mydfff, data.frame(v2 = mydfff$v, stringsAsFactors = FALSE)) - mydffff$v <- NULL - expect_identical(get_icd_name(mydffff, NULL), "icd9") - expect_equivalent( - charlson(mydffff, - visit_name = "v2", - return_df = TRUE, - stringsAsFactors = FALSE, - short_code = FALSE - ), - structure(list( - v2 = c("a", "b", "c"), - Charlson = c(1, 1, 6) - ), - .Names = c("v2", "Charlson"), - row.names = c(NA, -3L), - class = "data.frame" - ) - ) }) test_that("Charlson - errors?", { @@ -308,7 +235,7 @@ test_that("van_walraven_from_comorbid score calculation", { ) }) -test_that("van_walraven comodbidity index and score", { +test_that("van_walraven comorbidity index and score", { mydf <- data.frame( id = factor(c(rep(1, 20), rep(2, 20), rep(3, 18))), value = From 18c601760a404a69085a9e31bae25b998e0d67fc Mon Sep 17 00:00:00 2001 From: Patrick Date: Sun, 1 Mar 2020 15:47:44 -0500 Subject: [PATCH 18/51] export categorize_simple On r-devel the check for this example is failing with "could not find function "categorize_simple"" --- R/categorize.R | 1 + 1 file changed, 1 insertion(+) diff --git a/R/categorize.R b/R/categorize.R index 4df9f6da..08f4eb59 100644 --- a/R/categorize.R +++ b/R/categorize.R @@ -35,6 +35,7 @@ #' u$icd10 <- decimal_to_short(u$icd10) #' j <- icd:::categorize_simple(u, m, id_name = "case", code_name = "icd10") #' @keywords internal +#' @export categorize_simple <- function(x, map, id_name, From 3465a2a8b054160fb77112428cfc6652d2d367e7 Mon Sep 17 00:00:00 2001 From: Patrick Date: Sun, 1 Mar 2020 15:47:51 -0500 Subject: [PATCH 19/51] Update NAMESPACE --- NAMESPACE | 1 + 1 file changed, 1 insertion(+) diff --git a/NAMESPACE b/NAMESPACE index f8062774..9db92ca6 100644 --- a/NAMESPACE +++ b/NAMESPACE @@ -161,6 +161,7 @@ export(as.icd_long_data) export(as.icd_short_diag) export(as.icd_wide_data) export(as.short_diag) +export(categorize_simple) export(chapters_to_map) export(charlson) export(charlson_from_comorbid) From 28b155559628220d8bd43311330f439fc7863358 Mon Sep 17 00:00:00 2001 From: Patrick Date: Sun, 1 Mar 2020 22:17:30 -0500 Subject: [PATCH 20/51] add R_REMOTES_STANDALONE=true to fix appveyor curl error See https://github.com/r-lib/remotes#standalone-mode and https://github.com/krlmlr/r-appveyor/issues/135 --- appveyor.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/appveyor.yml b/appveyor.yml index 1349c12e..d9e2e1e2 100644 --- a/appveyor.yml +++ b/appveyor.yml @@ -36,6 +36,7 @@ build_script: environment: # APPVEYOR_CACHE_SKIP_RESTORE: true + R_REMOTES_STANDALONE: true WARNINGS_ARE_ERRORS: 1 _R_CHECK_EXIT_ON_FIRST_ERROR_: true USE_RTOOLS: true From 5d0a4b09998673f280c7b1144af9a3dbbe88c51c Mon Sep 17 00:00:00 2001 From: Patrick Date: Sun, 1 Mar 2020 22:44:15 -0500 Subject: [PATCH 21/51] revert stringsToFactor change --- R/score.R | 22 +++++++++-- tests/testthat/test-score.R | 77 ++++++++++++++++++++++++++++++++++++- 2 files changed, 93 insertions(+), 6 deletions(-) diff --git a/R/score.R b/R/score.R index 9fbf2ab1..a4c1cc7e 100644 --- a/R/score.R +++ b/R/score.R @@ -24,6 +24,11 @@ #' frame will be returned, with the first column named as in input data frame #' (i.e., \code{visit_name}), containing all the visits, and the second column #' containing the Charlson Comorbidity Index. +#' @param stringsAsFactors single logical, passed on when constructing +#' data.frame if \code{return_df} is \code{TRUE}. If the input data frame +#' \code{x} has a factor for the \code{visit_name}, this is not changed, but a +#' non-factor \code{visit_name} may be converted or not converted according to +#' your system default or this setting. #' @param ... further arguments to pass on to \code{icd9_comorbid_quan_deyo}, #' e.g. \code{name} #' @examples @@ -41,6 +46,7 @@ charlson <- function(x, visit_name = NULL, scoring_system = c("original", "charlson", "quan"), return_df = FALSE, + stringsAsFactors = getOption("stringsAsFactors"), # nolint ...) { UseMethod("charlson") } @@ -54,6 +60,7 @@ charlson.data.frame <- function(x, visit_name = NULL, scoring_system = c("original", "charlson", "quan"), return_df = FALSE, + stringsAsFactors = getOption("stringsAsFactors"), # nolint ...) { stopifnot(is.data.frame(x), ncol(x) >= 2, !is.null(colnames(x))) stopifnot(is.null(visit_name) || @@ -61,6 +68,7 @@ charlson.data.frame <- function(x, stopifnot(is.null(visit_name) || (is.character(visit_name) && length(visit_name) == 1L)) assert_flag(return_df) + assert_flag(stringsAsFactors) # nolint visit_name <- get_visit_name(x, visit_name) res <- charlson_from_comorbid( comorbid_quan_deyo(x, @@ -76,8 +84,9 @@ charlson.data.frame <- function(x, return(res) } out <- cbind(names(res), - data.frame("Charlson" = unname(res)) - ) + data.frame("Charlson" = unname(res)), + stringsAsFactors = stringsAsFactors + ) # nolint names(out)[1] <- visit_name out } @@ -292,6 +301,7 @@ count_codes_wide <- function(x, #' frame will be returned, with the first column named as in input data frame #' (i.e., \code{visit_name}), containing all the visits, and the second column #' containing the Charlson Comorbidity Index. +#' @template stringsAsFactors #' @template dotdotdot #' @examples #' mydf <- data.frame( @@ -315,6 +325,7 @@ count_codes_wide <- function(x, van_walraven <- function(x, visit_name = NULL, return_df = FALSE, + stringsAsFactors = getOption("stringsAsFactors"), # nolint ...) { UseMethod("van_walraven") } @@ -325,11 +336,13 @@ van_walraven <- function(x, van_walraven.data.frame <- function(x, visit_name = NULL, return_df = FALSE, + stringsAsFactors = getOption("stringsAsFactors"), # nolint ...) { stopifnot(is.data.frame(x), ncol(x) >= 2, !is.null(colnames(x))) stopifnot(is.null(visit_name) || (is.character(visit_name) && length(visit_name) == 1L)) assert_flag(return_df) + assert_flag(stringsAsFactors) # nolint visit_name <- get_visit_name(x, visit_name) tmp <- icd9_comorbid_quan_elix(x, visit_name, @@ -344,8 +357,9 @@ van_walraven.data.frame <- function(x, return(res) } out <- cbind(names(res), - data.frame("vanWalraven" = unname(res)) - ) + data.frame("vanWalraven" = unname(res)), + stringsAsFactors = stringsAsFactors + ) # nolint names(out)[1] <- visit_name out } diff --git a/tests/testthat/test-score.R b/tests/testthat/test-score.R index 645c8113..c00e093a 100644 --- a/tests/testthat/test-score.R +++ b/tests/testthat/test-score.R @@ -48,7 +48,8 @@ test_that("only matrix or data.frame accepted", { test_that("Charlson score", { mydf <- data.frame( visit_id = c("a", "b", "c"), - icd9 = c("441", "412.93", "042") + icd9 = c("441", "412.93", "042"), + stringsAsFactors = TRUE ) expect_equal( charlson_from_comorbid( @@ -63,6 +64,7 @@ test_that("Charlson score", { expect_equivalent( charlson(mydf, return_df = TRUE, + stringsAsFactors = TRUE, short_code = FALSE ), structure(list( @@ -77,6 +79,77 @@ test_that("Charlson score", { class = "data.frame" ) ) + mydff <- data.frame( + visit_id = c("a", "b", "c"), + icd9 = c("441", "412.93", "042"), + stringsAsFactors = FALSE + ) + expect_identical( + charlson(mydff, + return_df = TRUE, + stringsAsFactors = FALSE, + short_code = FALSE + ), + structure(list( + visit_id = c("a", "b", "c"), + Charlson = c(1, 1, 6) + ), + .Names = c("visit_id", "Charlson"), + row.names = c(NA, -3L), + class = "data.frame" + ) + ) + expect_identical( + charlson(mydff, + return_df = TRUE, + stringsAsFactors = TRUE, + short_code = FALSE + ), + structure(list( + visit_id = factor(c("a", "b", "c")), + Charlson = c(1, 1, 6) + ), + .Names = c("visit_id", "Charlson"), + row.names = c(NA, -3L), + class = "data.frame" + ) + ) + mydfff <- mydff + names(mydfff)[1] <- "v" + expect_equivalent( + charlson(mydfff, + return_df = TRUE, + stringsAsFactors = FALSE, + short_code = FALSE + ), + structure(list( + v = c("a", "b", "c"), + Charlson = c(1, 1, 6) + ), + .Names = c("v", "Charlson"), + row.names = c(NA, -3L), + class = "data.frame" + ) + ) + mydffff <- cbind(mydfff, data.frame(v2 = mydfff$v, stringsAsFactors = FALSE)) + mydffff$v <- NULL + expect_identical(get_icd_name(mydffff, NULL), "icd9") + expect_equivalent( + charlson(mydffff, + visit_name = "v2", + return_df = TRUE, + stringsAsFactors = FALSE, + short_code = FALSE + ), + structure(list( + v2 = c("a", "b", "c"), + Charlson = c(1, 1, 6) + ), + .Names = c("v2", "Charlson"), + row.names = c(NA, -3L), + class = "data.frame" + ) + ) }) test_that("Charlson - errors?", { @@ -235,7 +308,7 @@ test_that("van_walraven_from_comorbid score calculation", { ) }) -test_that("van_walraven comorbidity index and score", { +test_that("van_walraven comodbidity index and score", { mydf <- data.frame( id = factor(c(rep(1, 20), rep(2, 20), rep(3, 18))), value = From fc6c099ee2a41b4c9dd4c2c194316e72c40f6b41 Mon Sep 17 00:00:00 2001 From: Patrick Date: Sun, 1 Mar 2020 23:13:51 -0500 Subject: [PATCH 22/51] fix typos --- tests/testthat/test-score.R | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/tests/testthat/test-score.R b/tests/testthat/test-score.R index c00e093a..cd9d32a7 100644 --- a/tests/testthat/test-score.R +++ b/tests/testthat/test-score.R @@ -308,7 +308,7 @@ test_that("van_walraven_from_comorbid score calculation", { ) }) -test_that("van_walraven comodbidity index and score", { +test_that("van_walraven comorbidity index and score", { mydf <- data.frame( id = factor(c(rep(1, 20), rep(2, 20), rep(3, 18))), value = @@ -350,7 +350,7 @@ test_that("van_walraven comodbidity index and score", { ) }) -test_that("github issue #64 - quan revised charleson scores", { +test_that("github issue #64 - quan revised charlson scores", { mydf <- data.frame(visit_id = "a", icd9 = "250.0") comorbids <- comorbid_quan_deyo(mydf, short_code = FALSE, return_df = TRUE) From 1d533d2e2a096bc5d5e2cdace7066b824956c959 Mon Sep 17 00:00:00 2001 From: Patrick Date: Sun, 1 Mar 2020 23:15:41 -0500 Subject: [PATCH 23/51] move data-raw to inst directory --- {data-raw => inst/data-raw}/.gitignore | 0 {data-raw => inst/data-raw}/ICD10_Charlson.sas | 0 {data-raw => inst/data-raw}/ICD10_Elixhauser.sas | 0 {data-raw => inst/data-raw}/ICD9_E_Charlson.sas | 0 {data-raw => inst/data-raw}/ICD9_E_Elixhauser.sas | 0 {data-raw => inst/data-raw}/X.dxref.2015.csv | 0 {data-raw => inst/data-raw}/ccs_multi_dx_tool_2013.csv | 0 {data-raw => inst/data-raw}/ccs_multi_dx_tool_2015.csv | 0 {data-raw => inst/data-raw}/ccs_multi_pr_tool_2014.csv | 0 {data-raw => inst/data-raw}/comformat2012-2013.txt | 0 {data-raw => inst/data-raw}/comoanaly2012-2013.txt | 0 .../data-raw}/icd_hcc_rawdata/hierarchy/2007_hierarchy.txt | 0 .../data-raw}/icd_hcc_rawdata/hierarchy/2008_hierarchy.txt | 0 .../data-raw}/icd_hcc_rawdata/hierarchy/2009_hierarchy.txt | 0 .../data-raw}/icd_hcc_rawdata/hierarchy/2010_hierarchy.txt | 0 .../data-raw}/icd_hcc_rawdata/hierarchy/2011_hierarchy.txt | 0 .../data-raw}/icd_hcc_rawdata/hierarchy/2012_hierarchy.txt | 0 .../data-raw}/icd_hcc_rawdata/hierarchy/2013_hierarchy.txt | 0 .../data-raw}/icd_hcc_rawdata/hierarchy/2014_hierarchy.txt | 0 .../data-raw}/icd_hcc_rawdata/hierarchy/2015_hierarchy.txt | 0 .../data-raw}/icd_hcc_rawdata/hierarchy/2016_hierarchy.txt | 0 .../data-raw}/icd_hcc_rawdata/hierarchy/2017_hierarchy.txt | 0 .../data-raw}/icd_hcc_rawdata/hierarchy/2018_hierarchy.txt | 0 .../data-raw}/icd_hcc_rawdata/icd10/2016_icd10hcc.txt | 0 .../data-raw}/icd_hcc_rawdata/icd10/2017_icd10hcc.txt | 0 .../data-raw}/icd_hcc_rawdata/icd10/2018_icd10hcc.txt | 0 .../data-raw}/icd_hcc_rawdata/icd10/2019_icd10hcc.txt | 0 {data-raw => inst/data-raw}/icd_hcc_rawdata/icd9/2007_icd9hcc.txt | 0 {data-raw => inst/data-raw}/icd_hcc_rawdata/icd9/2008_icd9hcc.txt | 0 {data-raw => inst/data-raw}/icd_hcc_rawdata/icd9/2009_icd9hcc.txt | 0 {data-raw => inst/data-raw}/icd_hcc_rawdata/icd9/2010_icd9hcc.txt | 0 {data-raw => inst/data-raw}/icd_hcc_rawdata/icd9/2011_icd9hcc.txt | 0 {data-raw => inst/data-raw}/icd_hcc_rawdata/icd9/2012_icd9hcc.txt | 0 {data-raw => inst/data-raw}/icd_hcc_rawdata/icd9/2013_icd9hcc.txt | 0 {data-raw => inst/data-raw}/icd_hcc_rawdata/icd9/2014_icd9hcc.txt | 0 {data-raw => inst/data-raw}/icd_hcc_rawdata/icd9/2015_icd9hcc.txt | 0 {data-raw => inst/data-raw}/icd_hcc_rawdata/icd9/2016_icd9hcc.txt | 0 .../data-raw}/icd_hcc_rawdata/labels/2007_labels.txt | 0 .../data-raw}/icd_hcc_rawdata/labels/2008_labels.txt | 0 .../data-raw}/icd_hcc_rawdata/labels/2009_labels.txt | 0 .../data-raw}/icd_hcc_rawdata/labels/2010_labels.txt | 0 .../data-raw}/icd_hcc_rawdata/labels/2011_labels.txt | 0 .../data-raw}/icd_hcc_rawdata/labels/2012_labels.txt | 0 .../data-raw}/icd_hcc_rawdata/labels/2013_labels.txt | 0 .../data-raw}/icd_hcc_rawdata/labels/2014_labels.txt | 0 .../data-raw}/icd_hcc_rawdata/labels/2015_labels.txt | 0 .../data-raw}/icd_hcc_rawdata/labels/2016_labels.txt | 0 .../data-raw}/icd_hcc_rawdata/labels/2017_labels.txt | 0 .../data-raw}/icd_hcc_rawdata/labels/2018_labels.txt | 0 .../data-raw}/icd_hcc_rawdata/labels/2019_labels.txt | 0 .../data-raw}/ver2016_ahrq-comformat_icd10cm_2016.txt | 0 51 files changed, 0 insertions(+), 0 deletions(-) rename {data-raw => inst/data-raw}/.gitignore (100%) rename {data-raw => inst/data-raw}/ICD10_Charlson.sas (100%) rename {data-raw => inst/data-raw}/ICD10_Elixhauser.sas (100%) rename {data-raw => inst/data-raw}/ICD9_E_Charlson.sas (100%) rename {data-raw => inst/data-raw}/ICD9_E_Elixhauser.sas (100%) rename {data-raw => inst/data-raw}/X.dxref.2015.csv (100%) rename {data-raw => inst/data-raw}/ccs_multi_dx_tool_2013.csv (100%) rename {data-raw => inst/data-raw}/ccs_multi_dx_tool_2015.csv (100%) rename {data-raw => inst/data-raw}/ccs_multi_pr_tool_2014.csv (100%) rename {data-raw => inst/data-raw}/comformat2012-2013.txt (100%) rename {data-raw => inst/data-raw}/comoanaly2012-2013.txt (100%) rename {data-raw => inst/data-raw}/icd_hcc_rawdata/hierarchy/2007_hierarchy.txt (100%) rename {data-raw => inst/data-raw}/icd_hcc_rawdata/hierarchy/2008_hierarchy.txt (100%) mode change 100755 => 100644 rename {data-raw => inst/data-raw}/icd_hcc_rawdata/hierarchy/2009_hierarchy.txt (100%) mode change 100755 => 100644 rename {data-raw => inst/data-raw}/icd_hcc_rawdata/hierarchy/2010_hierarchy.txt (100%) mode change 100755 => 100644 rename {data-raw => inst/data-raw}/icd_hcc_rawdata/hierarchy/2011_hierarchy.txt (100%) mode change 100755 => 100644 rename {data-raw => inst/data-raw}/icd_hcc_rawdata/hierarchy/2012_hierarchy.txt (100%) mode change 100755 => 100644 rename {data-raw => inst/data-raw}/icd_hcc_rawdata/hierarchy/2013_hierarchy.txt (100%) mode change 100755 => 100644 rename {data-raw => inst/data-raw}/icd_hcc_rawdata/hierarchy/2014_hierarchy.txt (100%) mode change 100755 => 100644 rename {data-raw => inst/data-raw}/icd_hcc_rawdata/hierarchy/2015_hierarchy.txt (100%) mode change 100755 => 100644 rename {data-raw => inst/data-raw}/icd_hcc_rawdata/hierarchy/2016_hierarchy.txt (100%) mode change 100755 => 100644 rename {data-raw => inst/data-raw}/icd_hcc_rawdata/hierarchy/2017_hierarchy.txt (100%) mode change 100755 => 100644 rename {data-raw => inst/data-raw}/icd_hcc_rawdata/hierarchy/2018_hierarchy.txt (100%) mode change 100755 => 100644 rename {data-raw => inst/data-raw}/icd_hcc_rawdata/icd10/2016_icd10hcc.txt (100%) rename {data-raw => inst/data-raw}/icd_hcc_rawdata/icd10/2017_icd10hcc.txt (100%) rename {data-raw => inst/data-raw}/icd_hcc_rawdata/icd10/2018_icd10hcc.txt (100%) rename {data-raw => inst/data-raw}/icd_hcc_rawdata/icd10/2019_icd10hcc.txt (100%) rename {data-raw => inst/data-raw}/icd_hcc_rawdata/icd9/2007_icd9hcc.txt (100%) mode change 100755 => 100644 rename {data-raw => inst/data-raw}/icd_hcc_rawdata/icd9/2008_icd9hcc.txt (100%) mode change 100755 => 100644 rename {data-raw => inst/data-raw}/icd_hcc_rawdata/icd9/2009_icd9hcc.txt (100%) mode change 100755 => 100644 rename {data-raw => inst/data-raw}/icd_hcc_rawdata/icd9/2010_icd9hcc.txt (100%) mode change 100755 => 100644 rename {data-raw => inst/data-raw}/icd_hcc_rawdata/icd9/2011_icd9hcc.txt (100%) mode change 100755 => 100644 rename {data-raw => inst/data-raw}/icd_hcc_rawdata/icd9/2012_icd9hcc.txt (100%) mode change 100755 => 100644 rename {data-raw => inst/data-raw}/icd_hcc_rawdata/icd9/2013_icd9hcc.txt (100%) mode change 100755 => 100644 rename {data-raw => inst/data-raw}/icd_hcc_rawdata/icd9/2014_icd9hcc.txt (100%) mode change 100755 => 100644 rename {data-raw => inst/data-raw}/icd_hcc_rawdata/icd9/2015_icd9hcc.txt (100%) mode change 100755 => 100644 rename {data-raw => inst/data-raw}/icd_hcc_rawdata/icd9/2016_icd9hcc.txt (100%) mode change 100755 => 100644 rename {data-raw => inst/data-raw}/icd_hcc_rawdata/labels/2007_labels.txt (100%) mode change 100755 => 100644 rename {data-raw => inst/data-raw}/icd_hcc_rawdata/labels/2008_labels.txt (100%) mode change 100755 => 100644 rename {data-raw => inst/data-raw}/icd_hcc_rawdata/labels/2009_labels.txt (100%) mode change 100755 => 100644 rename {data-raw => inst/data-raw}/icd_hcc_rawdata/labels/2010_labels.txt (100%) mode change 100755 => 100644 rename {data-raw => inst/data-raw}/icd_hcc_rawdata/labels/2011_labels.txt (100%) mode change 100755 => 100644 rename {data-raw => inst/data-raw}/icd_hcc_rawdata/labels/2012_labels.txt (100%) mode change 100755 => 100644 rename {data-raw => inst/data-raw}/icd_hcc_rawdata/labels/2013_labels.txt (100%) mode change 100755 => 100644 rename {data-raw => inst/data-raw}/icd_hcc_rawdata/labels/2014_labels.txt (100%) mode change 100755 => 100644 rename {data-raw => inst/data-raw}/icd_hcc_rawdata/labels/2015_labels.txt (100%) mode change 100755 => 100644 rename {data-raw => inst/data-raw}/icd_hcc_rawdata/labels/2016_labels.txt (100%) mode change 100755 => 100644 rename {data-raw => inst/data-raw}/icd_hcc_rawdata/labels/2017_labels.txt (100%) mode change 100755 => 100644 rename {data-raw => inst/data-raw}/icd_hcc_rawdata/labels/2018_labels.txt (100%) mode change 100755 => 100644 rename {data-raw => inst/data-raw}/icd_hcc_rawdata/labels/2019_labels.txt (100%) mode change 100755 => 100644 rename {data-raw => inst/data-raw}/ver2016_ahrq-comformat_icd10cm_2016.txt (100%) diff --git a/data-raw/.gitignore b/inst/data-raw/.gitignore similarity index 100% rename from data-raw/.gitignore rename to inst/data-raw/.gitignore diff --git a/data-raw/ICD10_Charlson.sas b/inst/data-raw/ICD10_Charlson.sas similarity index 100% rename from data-raw/ICD10_Charlson.sas rename to inst/data-raw/ICD10_Charlson.sas diff --git a/data-raw/ICD10_Elixhauser.sas b/inst/data-raw/ICD10_Elixhauser.sas similarity index 100% rename from data-raw/ICD10_Elixhauser.sas rename to inst/data-raw/ICD10_Elixhauser.sas diff --git a/data-raw/ICD9_E_Charlson.sas b/inst/data-raw/ICD9_E_Charlson.sas similarity index 100% rename from data-raw/ICD9_E_Charlson.sas rename to inst/data-raw/ICD9_E_Charlson.sas diff --git a/data-raw/ICD9_E_Elixhauser.sas b/inst/data-raw/ICD9_E_Elixhauser.sas similarity index 100% rename from data-raw/ICD9_E_Elixhauser.sas rename to inst/data-raw/ICD9_E_Elixhauser.sas diff --git a/data-raw/X.dxref.2015.csv b/inst/data-raw/X.dxref.2015.csv similarity index 100% rename from data-raw/X.dxref.2015.csv rename to inst/data-raw/X.dxref.2015.csv diff --git a/data-raw/ccs_multi_dx_tool_2013.csv b/inst/data-raw/ccs_multi_dx_tool_2013.csv similarity index 100% rename from data-raw/ccs_multi_dx_tool_2013.csv rename to inst/data-raw/ccs_multi_dx_tool_2013.csv diff --git a/data-raw/ccs_multi_dx_tool_2015.csv b/inst/data-raw/ccs_multi_dx_tool_2015.csv similarity index 100% rename from data-raw/ccs_multi_dx_tool_2015.csv rename to inst/data-raw/ccs_multi_dx_tool_2015.csv diff --git a/data-raw/ccs_multi_pr_tool_2014.csv b/inst/data-raw/ccs_multi_pr_tool_2014.csv similarity index 100% rename from data-raw/ccs_multi_pr_tool_2014.csv rename to inst/data-raw/ccs_multi_pr_tool_2014.csv diff --git a/data-raw/comformat2012-2013.txt b/inst/data-raw/comformat2012-2013.txt similarity index 100% rename from data-raw/comformat2012-2013.txt rename to inst/data-raw/comformat2012-2013.txt diff --git a/data-raw/comoanaly2012-2013.txt b/inst/data-raw/comoanaly2012-2013.txt similarity index 100% rename from data-raw/comoanaly2012-2013.txt rename to inst/data-raw/comoanaly2012-2013.txt diff --git a/data-raw/icd_hcc_rawdata/hierarchy/2007_hierarchy.txt b/inst/data-raw/icd_hcc_rawdata/hierarchy/2007_hierarchy.txt similarity index 100% rename from data-raw/icd_hcc_rawdata/hierarchy/2007_hierarchy.txt rename to inst/data-raw/icd_hcc_rawdata/hierarchy/2007_hierarchy.txt diff --git a/data-raw/icd_hcc_rawdata/hierarchy/2008_hierarchy.txt b/inst/data-raw/icd_hcc_rawdata/hierarchy/2008_hierarchy.txt old mode 100755 new mode 100644 similarity index 100% rename from data-raw/icd_hcc_rawdata/hierarchy/2008_hierarchy.txt rename to inst/data-raw/icd_hcc_rawdata/hierarchy/2008_hierarchy.txt diff --git a/data-raw/icd_hcc_rawdata/hierarchy/2009_hierarchy.txt b/inst/data-raw/icd_hcc_rawdata/hierarchy/2009_hierarchy.txt old mode 100755 new mode 100644 similarity index 100% rename from data-raw/icd_hcc_rawdata/hierarchy/2009_hierarchy.txt rename to inst/data-raw/icd_hcc_rawdata/hierarchy/2009_hierarchy.txt diff --git a/data-raw/icd_hcc_rawdata/hierarchy/2010_hierarchy.txt b/inst/data-raw/icd_hcc_rawdata/hierarchy/2010_hierarchy.txt old mode 100755 new mode 100644 similarity index 100% rename from data-raw/icd_hcc_rawdata/hierarchy/2010_hierarchy.txt rename to inst/data-raw/icd_hcc_rawdata/hierarchy/2010_hierarchy.txt diff --git a/data-raw/icd_hcc_rawdata/hierarchy/2011_hierarchy.txt b/inst/data-raw/icd_hcc_rawdata/hierarchy/2011_hierarchy.txt old mode 100755 new mode 100644 similarity index 100% rename from data-raw/icd_hcc_rawdata/hierarchy/2011_hierarchy.txt rename to inst/data-raw/icd_hcc_rawdata/hierarchy/2011_hierarchy.txt diff --git a/data-raw/icd_hcc_rawdata/hierarchy/2012_hierarchy.txt b/inst/data-raw/icd_hcc_rawdata/hierarchy/2012_hierarchy.txt old mode 100755 new mode 100644 similarity index 100% rename from data-raw/icd_hcc_rawdata/hierarchy/2012_hierarchy.txt rename to inst/data-raw/icd_hcc_rawdata/hierarchy/2012_hierarchy.txt diff --git a/data-raw/icd_hcc_rawdata/hierarchy/2013_hierarchy.txt b/inst/data-raw/icd_hcc_rawdata/hierarchy/2013_hierarchy.txt old mode 100755 new mode 100644 similarity index 100% rename from data-raw/icd_hcc_rawdata/hierarchy/2013_hierarchy.txt rename to inst/data-raw/icd_hcc_rawdata/hierarchy/2013_hierarchy.txt diff --git a/data-raw/icd_hcc_rawdata/hierarchy/2014_hierarchy.txt b/inst/data-raw/icd_hcc_rawdata/hierarchy/2014_hierarchy.txt old mode 100755 new mode 100644 similarity index 100% rename from data-raw/icd_hcc_rawdata/hierarchy/2014_hierarchy.txt rename to inst/data-raw/icd_hcc_rawdata/hierarchy/2014_hierarchy.txt diff --git a/data-raw/icd_hcc_rawdata/hierarchy/2015_hierarchy.txt b/inst/data-raw/icd_hcc_rawdata/hierarchy/2015_hierarchy.txt old mode 100755 new mode 100644 similarity index 100% rename from data-raw/icd_hcc_rawdata/hierarchy/2015_hierarchy.txt rename to inst/data-raw/icd_hcc_rawdata/hierarchy/2015_hierarchy.txt diff --git a/data-raw/icd_hcc_rawdata/hierarchy/2016_hierarchy.txt b/inst/data-raw/icd_hcc_rawdata/hierarchy/2016_hierarchy.txt old mode 100755 new mode 100644 similarity index 100% rename from data-raw/icd_hcc_rawdata/hierarchy/2016_hierarchy.txt rename to inst/data-raw/icd_hcc_rawdata/hierarchy/2016_hierarchy.txt diff --git a/data-raw/icd_hcc_rawdata/hierarchy/2017_hierarchy.txt b/inst/data-raw/icd_hcc_rawdata/hierarchy/2017_hierarchy.txt old mode 100755 new mode 100644 similarity index 100% rename from data-raw/icd_hcc_rawdata/hierarchy/2017_hierarchy.txt rename to inst/data-raw/icd_hcc_rawdata/hierarchy/2017_hierarchy.txt diff --git a/data-raw/icd_hcc_rawdata/hierarchy/2018_hierarchy.txt b/inst/data-raw/icd_hcc_rawdata/hierarchy/2018_hierarchy.txt old mode 100755 new mode 100644 similarity index 100% rename from data-raw/icd_hcc_rawdata/hierarchy/2018_hierarchy.txt rename to inst/data-raw/icd_hcc_rawdata/hierarchy/2018_hierarchy.txt diff --git a/data-raw/icd_hcc_rawdata/icd10/2016_icd10hcc.txt b/inst/data-raw/icd_hcc_rawdata/icd10/2016_icd10hcc.txt similarity index 100% rename from data-raw/icd_hcc_rawdata/icd10/2016_icd10hcc.txt rename to inst/data-raw/icd_hcc_rawdata/icd10/2016_icd10hcc.txt diff --git a/data-raw/icd_hcc_rawdata/icd10/2017_icd10hcc.txt b/inst/data-raw/icd_hcc_rawdata/icd10/2017_icd10hcc.txt similarity index 100% rename from data-raw/icd_hcc_rawdata/icd10/2017_icd10hcc.txt rename to inst/data-raw/icd_hcc_rawdata/icd10/2017_icd10hcc.txt diff --git a/data-raw/icd_hcc_rawdata/icd10/2018_icd10hcc.txt b/inst/data-raw/icd_hcc_rawdata/icd10/2018_icd10hcc.txt similarity index 100% rename from data-raw/icd_hcc_rawdata/icd10/2018_icd10hcc.txt rename to inst/data-raw/icd_hcc_rawdata/icd10/2018_icd10hcc.txt diff --git a/data-raw/icd_hcc_rawdata/icd10/2019_icd10hcc.txt b/inst/data-raw/icd_hcc_rawdata/icd10/2019_icd10hcc.txt similarity index 100% rename from data-raw/icd_hcc_rawdata/icd10/2019_icd10hcc.txt rename to inst/data-raw/icd_hcc_rawdata/icd10/2019_icd10hcc.txt diff --git a/data-raw/icd_hcc_rawdata/icd9/2007_icd9hcc.txt b/inst/data-raw/icd_hcc_rawdata/icd9/2007_icd9hcc.txt old mode 100755 new mode 100644 similarity index 100% rename from data-raw/icd_hcc_rawdata/icd9/2007_icd9hcc.txt rename to inst/data-raw/icd_hcc_rawdata/icd9/2007_icd9hcc.txt diff --git a/data-raw/icd_hcc_rawdata/icd9/2008_icd9hcc.txt b/inst/data-raw/icd_hcc_rawdata/icd9/2008_icd9hcc.txt old mode 100755 new mode 100644 similarity index 100% rename from data-raw/icd_hcc_rawdata/icd9/2008_icd9hcc.txt rename to inst/data-raw/icd_hcc_rawdata/icd9/2008_icd9hcc.txt diff --git a/data-raw/icd_hcc_rawdata/icd9/2009_icd9hcc.txt b/inst/data-raw/icd_hcc_rawdata/icd9/2009_icd9hcc.txt old mode 100755 new mode 100644 similarity index 100% rename from data-raw/icd_hcc_rawdata/icd9/2009_icd9hcc.txt rename to inst/data-raw/icd_hcc_rawdata/icd9/2009_icd9hcc.txt diff --git a/data-raw/icd_hcc_rawdata/icd9/2010_icd9hcc.txt b/inst/data-raw/icd_hcc_rawdata/icd9/2010_icd9hcc.txt old mode 100755 new mode 100644 similarity index 100% rename from data-raw/icd_hcc_rawdata/icd9/2010_icd9hcc.txt rename to inst/data-raw/icd_hcc_rawdata/icd9/2010_icd9hcc.txt diff --git a/data-raw/icd_hcc_rawdata/icd9/2011_icd9hcc.txt b/inst/data-raw/icd_hcc_rawdata/icd9/2011_icd9hcc.txt old mode 100755 new mode 100644 similarity index 100% rename from data-raw/icd_hcc_rawdata/icd9/2011_icd9hcc.txt rename to inst/data-raw/icd_hcc_rawdata/icd9/2011_icd9hcc.txt diff --git a/data-raw/icd_hcc_rawdata/icd9/2012_icd9hcc.txt b/inst/data-raw/icd_hcc_rawdata/icd9/2012_icd9hcc.txt old mode 100755 new mode 100644 similarity index 100% rename from data-raw/icd_hcc_rawdata/icd9/2012_icd9hcc.txt rename to inst/data-raw/icd_hcc_rawdata/icd9/2012_icd9hcc.txt diff --git a/data-raw/icd_hcc_rawdata/icd9/2013_icd9hcc.txt b/inst/data-raw/icd_hcc_rawdata/icd9/2013_icd9hcc.txt old mode 100755 new mode 100644 similarity index 100% rename from data-raw/icd_hcc_rawdata/icd9/2013_icd9hcc.txt rename to inst/data-raw/icd_hcc_rawdata/icd9/2013_icd9hcc.txt diff --git a/data-raw/icd_hcc_rawdata/icd9/2014_icd9hcc.txt b/inst/data-raw/icd_hcc_rawdata/icd9/2014_icd9hcc.txt old mode 100755 new mode 100644 similarity index 100% rename from data-raw/icd_hcc_rawdata/icd9/2014_icd9hcc.txt rename to inst/data-raw/icd_hcc_rawdata/icd9/2014_icd9hcc.txt diff --git a/data-raw/icd_hcc_rawdata/icd9/2015_icd9hcc.txt b/inst/data-raw/icd_hcc_rawdata/icd9/2015_icd9hcc.txt old mode 100755 new mode 100644 similarity index 100% rename from data-raw/icd_hcc_rawdata/icd9/2015_icd9hcc.txt rename to inst/data-raw/icd_hcc_rawdata/icd9/2015_icd9hcc.txt diff --git a/data-raw/icd_hcc_rawdata/icd9/2016_icd9hcc.txt b/inst/data-raw/icd_hcc_rawdata/icd9/2016_icd9hcc.txt old mode 100755 new mode 100644 similarity index 100% rename from data-raw/icd_hcc_rawdata/icd9/2016_icd9hcc.txt rename to inst/data-raw/icd_hcc_rawdata/icd9/2016_icd9hcc.txt diff --git a/data-raw/icd_hcc_rawdata/labels/2007_labels.txt b/inst/data-raw/icd_hcc_rawdata/labels/2007_labels.txt old mode 100755 new mode 100644 similarity index 100% rename from data-raw/icd_hcc_rawdata/labels/2007_labels.txt rename to inst/data-raw/icd_hcc_rawdata/labels/2007_labels.txt diff --git a/data-raw/icd_hcc_rawdata/labels/2008_labels.txt b/inst/data-raw/icd_hcc_rawdata/labels/2008_labels.txt old mode 100755 new mode 100644 similarity index 100% rename from data-raw/icd_hcc_rawdata/labels/2008_labels.txt rename to inst/data-raw/icd_hcc_rawdata/labels/2008_labels.txt diff --git a/data-raw/icd_hcc_rawdata/labels/2009_labels.txt b/inst/data-raw/icd_hcc_rawdata/labels/2009_labels.txt old mode 100755 new mode 100644 similarity index 100% rename from data-raw/icd_hcc_rawdata/labels/2009_labels.txt rename to inst/data-raw/icd_hcc_rawdata/labels/2009_labels.txt diff --git a/data-raw/icd_hcc_rawdata/labels/2010_labels.txt b/inst/data-raw/icd_hcc_rawdata/labels/2010_labels.txt old mode 100755 new mode 100644 similarity index 100% rename from data-raw/icd_hcc_rawdata/labels/2010_labels.txt rename to inst/data-raw/icd_hcc_rawdata/labels/2010_labels.txt diff --git a/data-raw/icd_hcc_rawdata/labels/2011_labels.txt b/inst/data-raw/icd_hcc_rawdata/labels/2011_labels.txt old mode 100755 new mode 100644 similarity index 100% rename from data-raw/icd_hcc_rawdata/labels/2011_labels.txt rename to inst/data-raw/icd_hcc_rawdata/labels/2011_labels.txt diff --git a/data-raw/icd_hcc_rawdata/labels/2012_labels.txt b/inst/data-raw/icd_hcc_rawdata/labels/2012_labels.txt old mode 100755 new mode 100644 similarity index 100% rename from data-raw/icd_hcc_rawdata/labels/2012_labels.txt rename to inst/data-raw/icd_hcc_rawdata/labels/2012_labels.txt diff --git a/data-raw/icd_hcc_rawdata/labels/2013_labels.txt b/inst/data-raw/icd_hcc_rawdata/labels/2013_labels.txt old mode 100755 new mode 100644 similarity index 100% rename from data-raw/icd_hcc_rawdata/labels/2013_labels.txt rename to inst/data-raw/icd_hcc_rawdata/labels/2013_labels.txt diff --git a/data-raw/icd_hcc_rawdata/labels/2014_labels.txt b/inst/data-raw/icd_hcc_rawdata/labels/2014_labels.txt old mode 100755 new mode 100644 similarity index 100% rename from data-raw/icd_hcc_rawdata/labels/2014_labels.txt rename to inst/data-raw/icd_hcc_rawdata/labels/2014_labels.txt diff --git a/data-raw/icd_hcc_rawdata/labels/2015_labels.txt b/inst/data-raw/icd_hcc_rawdata/labels/2015_labels.txt old mode 100755 new mode 100644 similarity index 100% rename from data-raw/icd_hcc_rawdata/labels/2015_labels.txt rename to inst/data-raw/icd_hcc_rawdata/labels/2015_labels.txt diff --git a/data-raw/icd_hcc_rawdata/labels/2016_labels.txt b/inst/data-raw/icd_hcc_rawdata/labels/2016_labels.txt old mode 100755 new mode 100644 similarity index 100% rename from data-raw/icd_hcc_rawdata/labels/2016_labels.txt rename to inst/data-raw/icd_hcc_rawdata/labels/2016_labels.txt diff --git a/data-raw/icd_hcc_rawdata/labels/2017_labels.txt b/inst/data-raw/icd_hcc_rawdata/labels/2017_labels.txt old mode 100755 new mode 100644 similarity index 100% rename from data-raw/icd_hcc_rawdata/labels/2017_labels.txt rename to inst/data-raw/icd_hcc_rawdata/labels/2017_labels.txt diff --git a/data-raw/icd_hcc_rawdata/labels/2018_labels.txt b/inst/data-raw/icd_hcc_rawdata/labels/2018_labels.txt old mode 100755 new mode 100644 similarity index 100% rename from data-raw/icd_hcc_rawdata/labels/2018_labels.txt rename to inst/data-raw/icd_hcc_rawdata/labels/2018_labels.txt diff --git a/data-raw/icd_hcc_rawdata/labels/2019_labels.txt b/inst/data-raw/icd_hcc_rawdata/labels/2019_labels.txt old mode 100755 new mode 100644 similarity index 100% rename from data-raw/icd_hcc_rawdata/labels/2019_labels.txt rename to inst/data-raw/icd_hcc_rawdata/labels/2019_labels.txt diff --git a/data-raw/ver2016_ahrq-comformat_icd10cm_2016.txt b/inst/data-raw/ver2016_ahrq-comformat_icd10cm_2016.txt similarity index 100% rename from data-raw/ver2016_ahrq-comformat_icd10cm_2016.txt rename to inst/data-raw/ver2016_ahrq-comformat_icd10cm_2016.txt From bc6fdcd8c842cf309cf33bfa5eae7796e70b29bc Mon Sep 17 00:00:00 2001 From: Patrick Date: Sun, 1 Mar 2020 23:48:14 -0500 Subject: [PATCH 24/51] attempt to fix "non-portable flag(s)" error on 3.6.2 travis build --- .travis.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.travis.yml b/.travis.yml index 87e34ffb..4ffd72a4 100644 --- a/.travis.yml +++ b/.travis.yml @@ -85,7 +85,7 @@ env: - _R_CHECK_LENGTH_1_LOGIC2_="verbose,abort" - _R_CHECK_NO_STOP_ON_TEST_ERROR_=FALSE # some of the following are ignored if --as-cran is set - - _R_CHECK_COMPILATION_FLAGS_=FALSE + - _R_CHECK_COMPILATION_FLAGS_=TRUE - _R_CHECK_COMPILATION_FLAGS_KNOWN_="-Wno-unused-parameter -Wno-unused-variable -Wno-ignored-attributes -Wno-cast-function-type -Wno-unknown-warning-option" # the following are to simulate cran, and # help debugging if we didn't use --as-cran From 6a243e85f5387da831fc83799754180c466ba540 Mon Sep 17 00:00:00 2001 From: Patrick Date: Fri, 13 Mar 2020 01:49:17 -0400 Subject: [PATCH 25/51] updated URL MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit CIM-10-FR adds U071: Maladie à coronavirus 2019 [COVID-19] --- R/cim-10-fr.R | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/R/cim-10-fr.R b/R/cim-10-fr.R index 5cf4eefa..559ee340 100644 --- a/R/cim-10-fr.R +++ b/R/cim-10-fr.R @@ -8,7 +8,7 @@ "https://www.atih.sante.fr", "plateformes-de-transmission-et-logiciels", "logiciels-espace-de-telechargement", - "telecharger/gratuit/12713/456" + "telecharger/gratuit/13332/456" ), file_name = "LIBCIM10MULTI.TXT", dl_msg = "Working on ICD-10-FR (CIM-10-FR)", From ccd8d055b5702841fa0c8eedb40f5d11162243d6 Mon Sep 17 00:00:00 2001 From: Patrick Date: Fri, 13 Mar 2020 02:36:45 -0400 Subject: [PATCH 26/51] fix typo --- R/util-file.R | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/R/util-file.R b/R/util-file.R index 8d327e8c..979513ed 100644 --- a/R/util-file.R +++ b/R/util-file.R @@ -121,7 +121,7 @@ #' @param url URL of a zip file #' @param file_name file name of the resource within the zip file #' @param save_path file path to save the first file from the zip -#' @param insecure Logical value, wil disable certificate check which fails on +#' @param insecure Logical value, will disable certificate check which fails on #' some platforms for some ICD data from CDC and CMS, probably because of TLS #' version or certificate key length issues. Default is \code{TRUE}. #' @param ... additional arguments passed to \code{utils::download.file} From b77f5a32e4f6dcf8bc342ca7ddef719183ad8e23 Mon Sep 17 00:00:00 2001 From: Patrick Date: Fri, 13 Mar 2020 02:41:23 -0400 Subject: [PATCH 27/51] revert _R_CHECK_COMPILATION_FLAGS_=TRUE change --- .travis.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.travis.yml b/.travis.yml index 4ffd72a4..87e34ffb 100644 --- a/.travis.yml +++ b/.travis.yml @@ -85,7 +85,7 @@ env: - _R_CHECK_LENGTH_1_LOGIC2_="verbose,abort" - _R_CHECK_NO_STOP_ON_TEST_ERROR_=FALSE # some of the following are ignored if --as-cran is set - - _R_CHECK_COMPILATION_FLAGS_=TRUE + - _R_CHECK_COMPILATION_FLAGS_=FALSE - _R_CHECK_COMPILATION_FLAGS_KNOWN_="-Wno-unused-parameter -Wno-unused-variable -Wno-ignored-attributes -Wno-cast-function-type -Wno-unknown-warning-option" # the following are to simulate cran, and # help debugging if we didn't use --as-cran From 5be56320deb6fae83341b59f96e5885ca95fedd8 Mon Sep 17 00:00:00 2001 From: Patrick Date: Sun, 1 Mar 2020 15:44:33 -0500 Subject: [PATCH 28/51] use httr::content to properly handle UTF-8 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The call `.dl_icd10who_json(2008, "fr", "JsonGetRootConcepts?useHtml=false")` was returning malformed text that had not been reencoded properly. For example "Autres infections intestinales bactériennes". --- R/who.R | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/R/who.R b/R/who.R index 34117cb9..68d39476 100644 --- a/R/who.R +++ b/R/who.R @@ -70,8 +70,7 @@ ) } } # end 400+ - json_data <- rawToChar(http_response$content) - jsonlite::fromJSON(json_data) + httr::content(http_response, simplifyDataFrame=TRUE) } #' Use WHO API to discover chapters @@ -91,7 +90,7 @@ } #' Get the children of a concept (ICD-10 chapter, code or range) -#' @param concept_id NULl for root, concept string for any leaf or intermediate. +#' @param concept_id NULL for root, concept string for any leaf or intermediate. #' @examples #' .dl_icd10who_children("XXII") #' .dl_icd10who_children("U84") From eadddc2403653d9fd5e02608755c399f8a4ab2e6 Mon Sep 17 00:00:00 2001 From: Patrick Date: Sun, 1 Mar 2020 15:47:12 -0500 Subject: [PATCH 29/51] remove stringsAsFactors argument stringsAsFactors is being deprecated generally. The code here is causing test-score.R#333 to fail on R-devel because the id column is not a factor. See https://developer.r-project.org/Blog/public/2020/02/16/stringsasfactors/ --- R/score.R | 22 ++--------- tests/testthat/test-score.R | 77 +------------------------------------ 2 files changed, 6 insertions(+), 93 deletions(-) diff --git a/R/score.R b/R/score.R index a4c1cc7e..9fbf2ab1 100644 --- a/R/score.R +++ b/R/score.R @@ -24,11 +24,6 @@ #' frame will be returned, with the first column named as in input data frame #' (i.e., \code{visit_name}), containing all the visits, and the second column #' containing the Charlson Comorbidity Index. -#' @param stringsAsFactors single logical, passed on when constructing -#' data.frame if \code{return_df} is \code{TRUE}. If the input data frame -#' \code{x} has a factor for the \code{visit_name}, this is not changed, but a -#' non-factor \code{visit_name} may be converted or not converted according to -#' your system default or this setting. #' @param ... further arguments to pass on to \code{icd9_comorbid_quan_deyo}, #' e.g. \code{name} #' @examples @@ -46,7 +41,6 @@ charlson <- function(x, visit_name = NULL, scoring_system = c("original", "charlson", "quan"), return_df = FALSE, - stringsAsFactors = getOption("stringsAsFactors"), # nolint ...) { UseMethod("charlson") } @@ -60,7 +54,6 @@ charlson.data.frame <- function(x, visit_name = NULL, scoring_system = c("original", "charlson", "quan"), return_df = FALSE, - stringsAsFactors = getOption("stringsAsFactors"), # nolint ...) { stopifnot(is.data.frame(x), ncol(x) >= 2, !is.null(colnames(x))) stopifnot(is.null(visit_name) || @@ -68,7 +61,6 @@ charlson.data.frame <- function(x, stopifnot(is.null(visit_name) || (is.character(visit_name) && length(visit_name) == 1L)) assert_flag(return_df) - assert_flag(stringsAsFactors) # nolint visit_name <- get_visit_name(x, visit_name) res <- charlson_from_comorbid( comorbid_quan_deyo(x, @@ -84,9 +76,8 @@ charlson.data.frame <- function(x, return(res) } out <- cbind(names(res), - data.frame("Charlson" = unname(res)), - stringsAsFactors = stringsAsFactors - ) # nolint + data.frame("Charlson" = unname(res)) + ) names(out)[1] <- visit_name out } @@ -301,7 +292,6 @@ count_codes_wide <- function(x, #' frame will be returned, with the first column named as in input data frame #' (i.e., \code{visit_name}), containing all the visits, and the second column #' containing the Charlson Comorbidity Index. -#' @template stringsAsFactors #' @template dotdotdot #' @examples #' mydf <- data.frame( @@ -325,7 +315,6 @@ count_codes_wide <- function(x, van_walraven <- function(x, visit_name = NULL, return_df = FALSE, - stringsAsFactors = getOption("stringsAsFactors"), # nolint ...) { UseMethod("van_walraven") } @@ -336,13 +325,11 @@ van_walraven <- function(x, van_walraven.data.frame <- function(x, visit_name = NULL, return_df = FALSE, - stringsAsFactors = getOption("stringsAsFactors"), # nolint ...) { stopifnot(is.data.frame(x), ncol(x) >= 2, !is.null(colnames(x))) stopifnot(is.null(visit_name) || (is.character(visit_name) && length(visit_name) == 1L)) assert_flag(return_df) - assert_flag(stringsAsFactors) # nolint visit_name <- get_visit_name(x, visit_name) tmp <- icd9_comorbid_quan_elix(x, visit_name, @@ -357,9 +344,8 @@ van_walraven.data.frame <- function(x, return(res) } out <- cbind(names(res), - data.frame("vanWalraven" = unname(res)), - stringsAsFactors = stringsAsFactors - ) # nolint + data.frame("vanWalraven" = unname(res)) + ) names(out)[1] <- visit_name out } diff --git a/tests/testthat/test-score.R b/tests/testthat/test-score.R index c00e093a..645c8113 100644 --- a/tests/testthat/test-score.R +++ b/tests/testthat/test-score.R @@ -48,8 +48,7 @@ test_that("only matrix or data.frame accepted", { test_that("Charlson score", { mydf <- data.frame( visit_id = c("a", "b", "c"), - icd9 = c("441", "412.93", "042"), - stringsAsFactors = TRUE + icd9 = c("441", "412.93", "042") ) expect_equal( charlson_from_comorbid( @@ -64,7 +63,6 @@ test_that("Charlson score", { expect_equivalent( charlson(mydf, return_df = TRUE, - stringsAsFactors = TRUE, short_code = FALSE ), structure(list( @@ -79,77 +77,6 @@ test_that("Charlson score", { class = "data.frame" ) ) - mydff <- data.frame( - visit_id = c("a", "b", "c"), - icd9 = c("441", "412.93", "042"), - stringsAsFactors = FALSE - ) - expect_identical( - charlson(mydff, - return_df = TRUE, - stringsAsFactors = FALSE, - short_code = FALSE - ), - structure(list( - visit_id = c("a", "b", "c"), - Charlson = c(1, 1, 6) - ), - .Names = c("visit_id", "Charlson"), - row.names = c(NA, -3L), - class = "data.frame" - ) - ) - expect_identical( - charlson(mydff, - return_df = TRUE, - stringsAsFactors = TRUE, - short_code = FALSE - ), - structure(list( - visit_id = factor(c("a", "b", "c")), - Charlson = c(1, 1, 6) - ), - .Names = c("visit_id", "Charlson"), - row.names = c(NA, -3L), - class = "data.frame" - ) - ) - mydfff <- mydff - names(mydfff)[1] <- "v" - expect_equivalent( - charlson(mydfff, - return_df = TRUE, - stringsAsFactors = FALSE, - short_code = FALSE - ), - structure(list( - v = c("a", "b", "c"), - Charlson = c(1, 1, 6) - ), - .Names = c("v", "Charlson"), - row.names = c(NA, -3L), - class = "data.frame" - ) - ) - mydffff <- cbind(mydfff, data.frame(v2 = mydfff$v, stringsAsFactors = FALSE)) - mydffff$v <- NULL - expect_identical(get_icd_name(mydffff, NULL), "icd9") - expect_equivalent( - charlson(mydffff, - visit_name = "v2", - return_df = TRUE, - stringsAsFactors = FALSE, - short_code = FALSE - ), - structure(list( - v2 = c("a", "b", "c"), - Charlson = c(1, 1, 6) - ), - .Names = c("v2", "Charlson"), - row.names = c(NA, -3L), - class = "data.frame" - ) - ) }) test_that("Charlson - errors?", { @@ -308,7 +235,7 @@ test_that("van_walraven_from_comorbid score calculation", { ) }) -test_that("van_walraven comodbidity index and score", { +test_that("van_walraven comorbidity index and score", { mydf <- data.frame( id = factor(c(rep(1, 20), rep(2, 20), rep(3, 18))), value = From 03dbbf415bfd9410a69b2bfdd0632136d0d3d84b Mon Sep 17 00:00:00 2001 From: Patrick Date: Sun, 1 Mar 2020 15:47:44 -0500 Subject: [PATCH 30/51] export categorize_simple On r-devel the check for this example is failing with "could not find function "categorize_simple"" --- R/categorize.R | 1 + 1 file changed, 1 insertion(+) diff --git a/R/categorize.R b/R/categorize.R index 4df9f6da..08f4eb59 100644 --- a/R/categorize.R +++ b/R/categorize.R @@ -35,6 +35,7 @@ #' u$icd10 <- decimal_to_short(u$icd10) #' j <- icd:::categorize_simple(u, m, id_name = "case", code_name = "icd10") #' @keywords internal +#' @export categorize_simple <- function(x, map, id_name, From a11f8cd67bea32da450e67129aa87f7c6210f8bf Mon Sep 17 00:00:00 2001 From: Patrick Date: Sun, 1 Mar 2020 15:47:51 -0500 Subject: [PATCH 31/51] Update NAMESPACE --- NAMESPACE | 1 + 1 file changed, 1 insertion(+) diff --git a/NAMESPACE b/NAMESPACE index f8062774..9db92ca6 100644 --- a/NAMESPACE +++ b/NAMESPACE @@ -161,6 +161,7 @@ export(as.icd_long_data) export(as.icd_short_diag) export(as.icd_wide_data) export(as.short_diag) +export(categorize_simple) export(chapters_to_map) export(charlson) export(charlson_from_comorbid) From 7ac94512fbc176ad1971d2b1158713e6929f6edd Mon Sep 17 00:00:00 2001 From: Patrick Date: Sun, 1 Mar 2020 22:17:30 -0500 Subject: [PATCH 32/51] add R_REMOTES_STANDALONE=true to fix appveyor curl error See https://github.com/r-lib/remotes#standalone-mode and https://github.com/krlmlr/r-appveyor/issues/135 --- appveyor.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/appveyor.yml b/appveyor.yml index 1349c12e..d9e2e1e2 100644 --- a/appveyor.yml +++ b/appveyor.yml @@ -36,6 +36,7 @@ build_script: environment: # APPVEYOR_CACHE_SKIP_RESTORE: true + R_REMOTES_STANDALONE: true WARNINGS_ARE_ERRORS: 1 _R_CHECK_EXIT_ON_FIRST_ERROR_: true USE_RTOOLS: true From 2bbdf54c48ba11440c524b79561bed156b7299f5 Mon Sep 17 00:00:00 2001 From: Patrick Date: Sun, 1 Mar 2020 22:44:15 -0500 Subject: [PATCH 33/51] revert stringsToFactor change --- R/score.R | 22 +++++++++-- tests/testthat/test-score.R | 77 ++++++++++++++++++++++++++++++++++++- 2 files changed, 93 insertions(+), 6 deletions(-) diff --git a/R/score.R b/R/score.R index 9fbf2ab1..a4c1cc7e 100644 --- a/R/score.R +++ b/R/score.R @@ -24,6 +24,11 @@ #' frame will be returned, with the first column named as in input data frame #' (i.e., \code{visit_name}), containing all the visits, and the second column #' containing the Charlson Comorbidity Index. +#' @param stringsAsFactors single logical, passed on when constructing +#' data.frame if \code{return_df} is \code{TRUE}. If the input data frame +#' \code{x} has a factor for the \code{visit_name}, this is not changed, but a +#' non-factor \code{visit_name} may be converted or not converted according to +#' your system default or this setting. #' @param ... further arguments to pass on to \code{icd9_comorbid_quan_deyo}, #' e.g. \code{name} #' @examples @@ -41,6 +46,7 @@ charlson <- function(x, visit_name = NULL, scoring_system = c("original", "charlson", "quan"), return_df = FALSE, + stringsAsFactors = getOption("stringsAsFactors"), # nolint ...) { UseMethod("charlson") } @@ -54,6 +60,7 @@ charlson.data.frame <- function(x, visit_name = NULL, scoring_system = c("original", "charlson", "quan"), return_df = FALSE, + stringsAsFactors = getOption("stringsAsFactors"), # nolint ...) { stopifnot(is.data.frame(x), ncol(x) >= 2, !is.null(colnames(x))) stopifnot(is.null(visit_name) || @@ -61,6 +68,7 @@ charlson.data.frame <- function(x, stopifnot(is.null(visit_name) || (is.character(visit_name) && length(visit_name) == 1L)) assert_flag(return_df) + assert_flag(stringsAsFactors) # nolint visit_name <- get_visit_name(x, visit_name) res <- charlson_from_comorbid( comorbid_quan_deyo(x, @@ -76,8 +84,9 @@ charlson.data.frame <- function(x, return(res) } out <- cbind(names(res), - data.frame("Charlson" = unname(res)) - ) + data.frame("Charlson" = unname(res)), + stringsAsFactors = stringsAsFactors + ) # nolint names(out)[1] <- visit_name out } @@ -292,6 +301,7 @@ count_codes_wide <- function(x, #' frame will be returned, with the first column named as in input data frame #' (i.e., \code{visit_name}), containing all the visits, and the second column #' containing the Charlson Comorbidity Index. +#' @template stringsAsFactors #' @template dotdotdot #' @examples #' mydf <- data.frame( @@ -315,6 +325,7 @@ count_codes_wide <- function(x, van_walraven <- function(x, visit_name = NULL, return_df = FALSE, + stringsAsFactors = getOption("stringsAsFactors"), # nolint ...) { UseMethod("van_walraven") } @@ -325,11 +336,13 @@ van_walraven <- function(x, van_walraven.data.frame <- function(x, visit_name = NULL, return_df = FALSE, + stringsAsFactors = getOption("stringsAsFactors"), # nolint ...) { stopifnot(is.data.frame(x), ncol(x) >= 2, !is.null(colnames(x))) stopifnot(is.null(visit_name) || (is.character(visit_name) && length(visit_name) == 1L)) assert_flag(return_df) + assert_flag(stringsAsFactors) # nolint visit_name <- get_visit_name(x, visit_name) tmp <- icd9_comorbid_quan_elix(x, visit_name, @@ -344,8 +357,9 @@ van_walraven.data.frame <- function(x, return(res) } out <- cbind(names(res), - data.frame("vanWalraven" = unname(res)) - ) + data.frame("vanWalraven" = unname(res)), + stringsAsFactors = stringsAsFactors + ) # nolint names(out)[1] <- visit_name out } diff --git a/tests/testthat/test-score.R b/tests/testthat/test-score.R index 645c8113..c00e093a 100644 --- a/tests/testthat/test-score.R +++ b/tests/testthat/test-score.R @@ -48,7 +48,8 @@ test_that("only matrix or data.frame accepted", { test_that("Charlson score", { mydf <- data.frame( visit_id = c("a", "b", "c"), - icd9 = c("441", "412.93", "042") + icd9 = c("441", "412.93", "042"), + stringsAsFactors = TRUE ) expect_equal( charlson_from_comorbid( @@ -63,6 +64,7 @@ test_that("Charlson score", { expect_equivalent( charlson(mydf, return_df = TRUE, + stringsAsFactors = TRUE, short_code = FALSE ), structure(list( @@ -77,6 +79,77 @@ test_that("Charlson score", { class = "data.frame" ) ) + mydff <- data.frame( + visit_id = c("a", "b", "c"), + icd9 = c("441", "412.93", "042"), + stringsAsFactors = FALSE + ) + expect_identical( + charlson(mydff, + return_df = TRUE, + stringsAsFactors = FALSE, + short_code = FALSE + ), + structure(list( + visit_id = c("a", "b", "c"), + Charlson = c(1, 1, 6) + ), + .Names = c("visit_id", "Charlson"), + row.names = c(NA, -3L), + class = "data.frame" + ) + ) + expect_identical( + charlson(mydff, + return_df = TRUE, + stringsAsFactors = TRUE, + short_code = FALSE + ), + structure(list( + visit_id = factor(c("a", "b", "c")), + Charlson = c(1, 1, 6) + ), + .Names = c("visit_id", "Charlson"), + row.names = c(NA, -3L), + class = "data.frame" + ) + ) + mydfff <- mydff + names(mydfff)[1] <- "v" + expect_equivalent( + charlson(mydfff, + return_df = TRUE, + stringsAsFactors = FALSE, + short_code = FALSE + ), + structure(list( + v = c("a", "b", "c"), + Charlson = c(1, 1, 6) + ), + .Names = c("v", "Charlson"), + row.names = c(NA, -3L), + class = "data.frame" + ) + ) + mydffff <- cbind(mydfff, data.frame(v2 = mydfff$v, stringsAsFactors = FALSE)) + mydffff$v <- NULL + expect_identical(get_icd_name(mydffff, NULL), "icd9") + expect_equivalent( + charlson(mydffff, + visit_name = "v2", + return_df = TRUE, + stringsAsFactors = FALSE, + short_code = FALSE + ), + structure(list( + v2 = c("a", "b", "c"), + Charlson = c(1, 1, 6) + ), + .Names = c("v2", "Charlson"), + row.names = c(NA, -3L), + class = "data.frame" + ) + ) }) test_that("Charlson - errors?", { @@ -235,7 +308,7 @@ test_that("van_walraven_from_comorbid score calculation", { ) }) -test_that("van_walraven comorbidity index and score", { +test_that("van_walraven comodbidity index and score", { mydf <- data.frame( id = factor(c(rep(1, 20), rep(2, 20), rep(3, 18))), value = From cb3b34854e1799e133e4b452bbf179895ec9f8e2 Mon Sep 17 00:00:00 2001 From: Patrick Date: Sun, 1 Mar 2020 23:13:51 -0500 Subject: [PATCH 34/51] fix typos --- tests/testthat/test-score.R | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/tests/testthat/test-score.R b/tests/testthat/test-score.R index c00e093a..cd9d32a7 100644 --- a/tests/testthat/test-score.R +++ b/tests/testthat/test-score.R @@ -308,7 +308,7 @@ test_that("van_walraven_from_comorbid score calculation", { ) }) -test_that("van_walraven comodbidity index and score", { +test_that("van_walraven comorbidity index and score", { mydf <- data.frame( id = factor(c(rep(1, 20), rep(2, 20), rep(3, 18))), value = @@ -350,7 +350,7 @@ test_that("van_walraven comodbidity index and score", { ) }) -test_that("github issue #64 - quan revised charleson scores", { +test_that("github issue #64 - quan revised charlson scores", { mydf <- data.frame(visit_id = "a", icd9 = "250.0") comorbids <- comorbid_quan_deyo(mydf, short_code = FALSE, return_df = TRUE) From 24afec4317a2530263f7c9ab8dbf3c5cd65ca285 Mon Sep 17 00:00:00 2001 From: Patrick Date: Sun, 1 Mar 2020 23:15:41 -0500 Subject: [PATCH 35/51] move data-raw to inst directory --- {data-raw => inst/data-raw}/.gitignore | 0 {data-raw => inst/data-raw}/ICD10_Charlson.sas | 0 {data-raw => inst/data-raw}/ICD10_Elixhauser.sas | 0 {data-raw => inst/data-raw}/ICD9_E_Charlson.sas | 0 {data-raw => inst/data-raw}/ICD9_E_Elixhauser.sas | 0 {data-raw => inst/data-raw}/X.dxref.2015.csv | 0 {data-raw => inst/data-raw}/ccs_multi_dx_tool_2013.csv | 0 {data-raw => inst/data-raw}/ccs_multi_dx_tool_2015.csv | 0 {data-raw => inst/data-raw}/ccs_multi_pr_tool_2014.csv | 0 {data-raw => inst/data-raw}/comformat2012-2013.txt | 0 {data-raw => inst/data-raw}/comoanaly2012-2013.txt | 0 .../data-raw}/icd_hcc_rawdata/hierarchy/2007_hierarchy.txt | 0 .../data-raw}/icd_hcc_rawdata/hierarchy/2008_hierarchy.txt | 0 .../data-raw}/icd_hcc_rawdata/hierarchy/2009_hierarchy.txt | 0 .../data-raw}/icd_hcc_rawdata/hierarchy/2010_hierarchy.txt | 0 .../data-raw}/icd_hcc_rawdata/hierarchy/2011_hierarchy.txt | 0 .../data-raw}/icd_hcc_rawdata/hierarchy/2012_hierarchy.txt | 0 .../data-raw}/icd_hcc_rawdata/hierarchy/2013_hierarchy.txt | 0 .../data-raw}/icd_hcc_rawdata/hierarchy/2014_hierarchy.txt | 0 .../data-raw}/icd_hcc_rawdata/hierarchy/2015_hierarchy.txt | 0 .../data-raw}/icd_hcc_rawdata/hierarchy/2016_hierarchy.txt | 0 .../data-raw}/icd_hcc_rawdata/hierarchy/2017_hierarchy.txt | 0 .../data-raw}/icd_hcc_rawdata/hierarchy/2018_hierarchy.txt | 0 .../data-raw}/icd_hcc_rawdata/icd10/2016_icd10hcc.txt | 0 .../data-raw}/icd_hcc_rawdata/icd10/2017_icd10hcc.txt | 0 .../data-raw}/icd_hcc_rawdata/icd10/2018_icd10hcc.txt | 0 .../data-raw}/icd_hcc_rawdata/icd10/2019_icd10hcc.txt | 0 {data-raw => inst/data-raw}/icd_hcc_rawdata/icd9/2007_icd9hcc.txt | 0 {data-raw => inst/data-raw}/icd_hcc_rawdata/icd9/2008_icd9hcc.txt | 0 {data-raw => inst/data-raw}/icd_hcc_rawdata/icd9/2009_icd9hcc.txt | 0 {data-raw => inst/data-raw}/icd_hcc_rawdata/icd9/2010_icd9hcc.txt | 0 {data-raw => inst/data-raw}/icd_hcc_rawdata/icd9/2011_icd9hcc.txt | 0 {data-raw => inst/data-raw}/icd_hcc_rawdata/icd9/2012_icd9hcc.txt | 0 {data-raw => inst/data-raw}/icd_hcc_rawdata/icd9/2013_icd9hcc.txt | 0 {data-raw => inst/data-raw}/icd_hcc_rawdata/icd9/2014_icd9hcc.txt | 0 {data-raw => inst/data-raw}/icd_hcc_rawdata/icd9/2015_icd9hcc.txt | 0 {data-raw => inst/data-raw}/icd_hcc_rawdata/icd9/2016_icd9hcc.txt | 0 .../data-raw}/icd_hcc_rawdata/labels/2007_labels.txt | 0 .../data-raw}/icd_hcc_rawdata/labels/2008_labels.txt | 0 .../data-raw}/icd_hcc_rawdata/labels/2009_labels.txt | 0 .../data-raw}/icd_hcc_rawdata/labels/2010_labels.txt | 0 .../data-raw}/icd_hcc_rawdata/labels/2011_labels.txt | 0 .../data-raw}/icd_hcc_rawdata/labels/2012_labels.txt | 0 .../data-raw}/icd_hcc_rawdata/labels/2013_labels.txt | 0 .../data-raw}/icd_hcc_rawdata/labels/2014_labels.txt | 0 .../data-raw}/icd_hcc_rawdata/labels/2015_labels.txt | 0 .../data-raw}/icd_hcc_rawdata/labels/2016_labels.txt | 0 .../data-raw}/icd_hcc_rawdata/labels/2017_labels.txt | 0 .../data-raw}/icd_hcc_rawdata/labels/2018_labels.txt | 0 .../data-raw}/icd_hcc_rawdata/labels/2019_labels.txt | 0 .../data-raw}/ver2016_ahrq-comformat_icd10cm_2016.txt | 0 51 files changed, 0 insertions(+), 0 deletions(-) rename {data-raw => inst/data-raw}/.gitignore (100%) rename {data-raw => inst/data-raw}/ICD10_Charlson.sas (100%) rename {data-raw => inst/data-raw}/ICD10_Elixhauser.sas (100%) rename {data-raw => inst/data-raw}/ICD9_E_Charlson.sas (100%) rename {data-raw => inst/data-raw}/ICD9_E_Elixhauser.sas (100%) rename {data-raw => inst/data-raw}/X.dxref.2015.csv (100%) rename {data-raw => inst/data-raw}/ccs_multi_dx_tool_2013.csv (100%) rename {data-raw => inst/data-raw}/ccs_multi_dx_tool_2015.csv (100%) rename {data-raw => inst/data-raw}/ccs_multi_pr_tool_2014.csv (100%) rename {data-raw => inst/data-raw}/comformat2012-2013.txt (100%) rename {data-raw => inst/data-raw}/comoanaly2012-2013.txt (100%) rename {data-raw => inst/data-raw}/icd_hcc_rawdata/hierarchy/2007_hierarchy.txt (100%) rename {data-raw => inst/data-raw}/icd_hcc_rawdata/hierarchy/2008_hierarchy.txt (100%) mode change 100755 => 100644 rename {data-raw => inst/data-raw}/icd_hcc_rawdata/hierarchy/2009_hierarchy.txt (100%) mode change 100755 => 100644 rename {data-raw => inst/data-raw}/icd_hcc_rawdata/hierarchy/2010_hierarchy.txt (100%) mode change 100755 => 100644 rename {data-raw => inst/data-raw}/icd_hcc_rawdata/hierarchy/2011_hierarchy.txt (100%) mode change 100755 => 100644 rename {data-raw => inst/data-raw}/icd_hcc_rawdata/hierarchy/2012_hierarchy.txt (100%) mode change 100755 => 100644 rename {data-raw => inst/data-raw}/icd_hcc_rawdata/hierarchy/2013_hierarchy.txt (100%) mode change 100755 => 100644 rename {data-raw => inst/data-raw}/icd_hcc_rawdata/hierarchy/2014_hierarchy.txt (100%) mode change 100755 => 100644 rename {data-raw => inst/data-raw}/icd_hcc_rawdata/hierarchy/2015_hierarchy.txt (100%) mode change 100755 => 100644 rename {data-raw => inst/data-raw}/icd_hcc_rawdata/hierarchy/2016_hierarchy.txt (100%) mode change 100755 => 100644 rename {data-raw => inst/data-raw}/icd_hcc_rawdata/hierarchy/2017_hierarchy.txt (100%) mode change 100755 => 100644 rename {data-raw => inst/data-raw}/icd_hcc_rawdata/hierarchy/2018_hierarchy.txt (100%) mode change 100755 => 100644 rename {data-raw => inst/data-raw}/icd_hcc_rawdata/icd10/2016_icd10hcc.txt (100%) rename {data-raw => inst/data-raw}/icd_hcc_rawdata/icd10/2017_icd10hcc.txt (100%) rename {data-raw => inst/data-raw}/icd_hcc_rawdata/icd10/2018_icd10hcc.txt (100%) rename {data-raw => inst/data-raw}/icd_hcc_rawdata/icd10/2019_icd10hcc.txt (100%) rename {data-raw => inst/data-raw}/icd_hcc_rawdata/icd9/2007_icd9hcc.txt (100%) mode change 100755 => 100644 rename {data-raw => inst/data-raw}/icd_hcc_rawdata/icd9/2008_icd9hcc.txt (100%) mode change 100755 => 100644 rename {data-raw => inst/data-raw}/icd_hcc_rawdata/icd9/2009_icd9hcc.txt (100%) mode change 100755 => 100644 rename {data-raw => inst/data-raw}/icd_hcc_rawdata/icd9/2010_icd9hcc.txt (100%) mode change 100755 => 100644 rename {data-raw => inst/data-raw}/icd_hcc_rawdata/icd9/2011_icd9hcc.txt (100%) mode change 100755 => 100644 rename {data-raw => inst/data-raw}/icd_hcc_rawdata/icd9/2012_icd9hcc.txt (100%) mode change 100755 => 100644 rename {data-raw => inst/data-raw}/icd_hcc_rawdata/icd9/2013_icd9hcc.txt (100%) mode change 100755 => 100644 rename {data-raw => inst/data-raw}/icd_hcc_rawdata/icd9/2014_icd9hcc.txt (100%) mode change 100755 => 100644 rename {data-raw => inst/data-raw}/icd_hcc_rawdata/icd9/2015_icd9hcc.txt (100%) mode change 100755 => 100644 rename {data-raw => inst/data-raw}/icd_hcc_rawdata/icd9/2016_icd9hcc.txt (100%) mode change 100755 => 100644 rename {data-raw => inst/data-raw}/icd_hcc_rawdata/labels/2007_labels.txt (100%) mode change 100755 => 100644 rename {data-raw => inst/data-raw}/icd_hcc_rawdata/labels/2008_labels.txt (100%) mode change 100755 => 100644 rename {data-raw => inst/data-raw}/icd_hcc_rawdata/labels/2009_labels.txt (100%) mode change 100755 => 100644 rename {data-raw => inst/data-raw}/icd_hcc_rawdata/labels/2010_labels.txt (100%) mode change 100755 => 100644 rename {data-raw => inst/data-raw}/icd_hcc_rawdata/labels/2011_labels.txt (100%) mode change 100755 => 100644 rename {data-raw => inst/data-raw}/icd_hcc_rawdata/labels/2012_labels.txt (100%) mode change 100755 => 100644 rename {data-raw => inst/data-raw}/icd_hcc_rawdata/labels/2013_labels.txt (100%) mode change 100755 => 100644 rename {data-raw => inst/data-raw}/icd_hcc_rawdata/labels/2014_labels.txt (100%) mode change 100755 => 100644 rename {data-raw => inst/data-raw}/icd_hcc_rawdata/labels/2015_labels.txt (100%) mode change 100755 => 100644 rename {data-raw => inst/data-raw}/icd_hcc_rawdata/labels/2016_labels.txt (100%) mode change 100755 => 100644 rename {data-raw => inst/data-raw}/icd_hcc_rawdata/labels/2017_labels.txt (100%) mode change 100755 => 100644 rename {data-raw => inst/data-raw}/icd_hcc_rawdata/labels/2018_labels.txt (100%) mode change 100755 => 100644 rename {data-raw => inst/data-raw}/icd_hcc_rawdata/labels/2019_labels.txt (100%) mode change 100755 => 100644 rename {data-raw => inst/data-raw}/ver2016_ahrq-comformat_icd10cm_2016.txt (100%) diff --git a/data-raw/.gitignore b/inst/data-raw/.gitignore similarity index 100% rename from data-raw/.gitignore rename to inst/data-raw/.gitignore diff --git a/data-raw/ICD10_Charlson.sas b/inst/data-raw/ICD10_Charlson.sas similarity index 100% rename from data-raw/ICD10_Charlson.sas rename to inst/data-raw/ICD10_Charlson.sas diff --git a/data-raw/ICD10_Elixhauser.sas b/inst/data-raw/ICD10_Elixhauser.sas similarity index 100% rename from data-raw/ICD10_Elixhauser.sas rename to inst/data-raw/ICD10_Elixhauser.sas diff --git a/data-raw/ICD9_E_Charlson.sas b/inst/data-raw/ICD9_E_Charlson.sas similarity index 100% rename from data-raw/ICD9_E_Charlson.sas rename to inst/data-raw/ICD9_E_Charlson.sas diff --git a/data-raw/ICD9_E_Elixhauser.sas b/inst/data-raw/ICD9_E_Elixhauser.sas similarity index 100% rename from data-raw/ICD9_E_Elixhauser.sas rename to inst/data-raw/ICD9_E_Elixhauser.sas diff --git a/data-raw/X.dxref.2015.csv b/inst/data-raw/X.dxref.2015.csv similarity index 100% rename from data-raw/X.dxref.2015.csv rename to inst/data-raw/X.dxref.2015.csv diff --git a/data-raw/ccs_multi_dx_tool_2013.csv b/inst/data-raw/ccs_multi_dx_tool_2013.csv similarity index 100% rename from data-raw/ccs_multi_dx_tool_2013.csv rename to inst/data-raw/ccs_multi_dx_tool_2013.csv diff --git a/data-raw/ccs_multi_dx_tool_2015.csv b/inst/data-raw/ccs_multi_dx_tool_2015.csv similarity index 100% rename from data-raw/ccs_multi_dx_tool_2015.csv rename to inst/data-raw/ccs_multi_dx_tool_2015.csv diff --git a/data-raw/ccs_multi_pr_tool_2014.csv b/inst/data-raw/ccs_multi_pr_tool_2014.csv similarity index 100% rename from data-raw/ccs_multi_pr_tool_2014.csv rename to inst/data-raw/ccs_multi_pr_tool_2014.csv diff --git a/data-raw/comformat2012-2013.txt b/inst/data-raw/comformat2012-2013.txt similarity index 100% rename from data-raw/comformat2012-2013.txt rename to inst/data-raw/comformat2012-2013.txt diff --git a/data-raw/comoanaly2012-2013.txt b/inst/data-raw/comoanaly2012-2013.txt similarity index 100% rename from data-raw/comoanaly2012-2013.txt rename to inst/data-raw/comoanaly2012-2013.txt diff --git a/data-raw/icd_hcc_rawdata/hierarchy/2007_hierarchy.txt b/inst/data-raw/icd_hcc_rawdata/hierarchy/2007_hierarchy.txt similarity index 100% rename from data-raw/icd_hcc_rawdata/hierarchy/2007_hierarchy.txt rename to inst/data-raw/icd_hcc_rawdata/hierarchy/2007_hierarchy.txt diff --git a/data-raw/icd_hcc_rawdata/hierarchy/2008_hierarchy.txt b/inst/data-raw/icd_hcc_rawdata/hierarchy/2008_hierarchy.txt old mode 100755 new mode 100644 similarity index 100% rename from data-raw/icd_hcc_rawdata/hierarchy/2008_hierarchy.txt rename to inst/data-raw/icd_hcc_rawdata/hierarchy/2008_hierarchy.txt diff --git a/data-raw/icd_hcc_rawdata/hierarchy/2009_hierarchy.txt b/inst/data-raw/icd_hcc_rawdata/hierarchy/2009_hierarchy.txt old mode 100755 new mode 100644 similarity index 100% rename from data-raw/icd_hcc_rawdata/hierarchy/2009_hierarchy.txt rename to inst/data-raw/icd_hcc_rawdata/hierarchy/2009_hierarchy.txt diff --git a/data-raw/icd_hcc_rawdata/hierarchy/2010_hierarchy.txt b/inst/data-raw/icd_hcc_rawdata/hierarchy/2010_hierarchy.txt old mode 100755 new mode 100644 similarity index 100% rename from data-raw/icd_hcc_rawdata/hierarchy/2010_hierarchy.txt rename to inst/data-raw/icd_hcc_rawdata/hierarchy/2010_hierarchy.txt diff --git a/data-raw/icd_hcc_rawdata/hierarchy/2011_hierarchy.txt b/inst/data-raw/icd_hcc_rawdata/hierarchy/2011_hierarchy.txt old mode 100755 new mode 100644 similarity index 100% rename from data-raw/icd_hcc_rawdata/hierarchy/2011_hierarchy.txt rename to inst/data-raw/icd_hcc_rawdata/hierarchy/2011_hierarchy.txt diff --git a/data-raw/icd_hcc_rawdata/hierarchy/2012_hierarchy.txt b/inst/data-raw/icd_hcc_rawdata/hierarchy/2012_hierarchy.txt old mode 100755 new mode 100644 similarity index 100% rename from data-raw/icd_hcc_rawdata/hierarchy/2012_hierarchy.txt rename to inst/data-raw/icd_hcc_rawdata/hierarchy/2012_hierarchy.txt diff --git a/data-raw/icd_hcc_rawdata/hierarchy/2013_hierarchy.txt b/inst/data-raw/icd_hcc_rawdata/hierarchy/2013_hierarchy.txt old mode 100755 new mode 100644 similarity index 100% rename from data-raw/icd_hcc_rawdata/hierarchy/2013_hierarchy.txt rename to inst/data-raw/icd_hcc_rawdata/hierarchy/2013_hierarchy.txt diff --git a/data-raw/icd_hcc_rawdata/hierarchy/2014_hierarchy.txt b/inst/data-raw/icd_hcc_rawdata/hierarchy/2014_hierarchy.txt old mode 100755 new mode 100644 similarity index 100% rename from data-raw/icd_hcc_rawdata/hierarchy/2014_hierarchy.txt rename to inst/data-raw/icd_hcc_rawdata/hierarchy/2014_hierarchy.txt diff --git a/data-raw/icd_hcc_rawdata/hierarchy/2015_hierarchy.txt b/inst/data-raw/icd_hcc_rawdata/hierarchy/2015_hierarchy.txt old mode 100755 new mode 100644 similarity index 100% rename from data-raw/icd_hcc_rawdata/hierarchy/2015_hierarchy.txt rename to inst/data-raw/icd_hcc_rawdata/hierarchy/2015_hierarchy.txt diff --git a/data-raw/icd_hcc_rawdata/hierarchy/2016_hierarchy.txt b/inst/data-raw/icd_hcc_rawdata/hierarchy/2016_hierarchy.txt old mode 100755 new mode 100644 similarity index 100% rename from data-raw/icd_hcc_rawdata/hierarchy/2016_hierarchy.txt rename to inst/data-raw/icd_hcc_rawdata/hierarchy/2016_hierarchy.txt diff --git a/data-raw/icd_hcc_rawdata/hierarchy/2017_hierarchy.txt b/inst/data-raw/icd_hcc_rawdata/hierarchy/2017_hierarchy.txt old mode 100755 new mode 100644 similarity index 100% rename from data-raw/icd_hcc_rawdata/hierarchy/2017_hierarchy.txt rename to inst/data-raw/icd_hcc_rawdata/hierarchy/2017_hierarchy.txt diff --git a/data-raw/icd_hcc_rawdata/hierarchy/2018_hierarchy.txt b/inst/data-raw/icd_hcc_rawdata/hierarchy/2018_hierarchy.txt old mode 100755 new mode 100644 similarity index 100% rename from data-raw/icd_hcc_rawdata/hierarchy/2018_hierarchy.txt rename to inst/data-raw/icd_hcc_rawdata/hierarchy/2018_hierarchy.txt diff --git a/data-raw/icd_hcc_rawdata/icd10/2016_icd10hcc.txt b/inst/data-raw/icd_hcc_rawdata/icd10/2016_icd10hcc.txt similarity index 100% rename from data-raw/icd_hcc_rawdata/icd10/2016_icd10hcc.txt rename to inst/data-raw/icd_hcc_rawdata/icd10/2016_icd10hcc.txt diff --git a/data-raw/icd_hcc_rawdata/icd10/2017_icd10hcc.txt b/inst/data-raw/icd_hcc_rawdata/icd10/2017_icd10hcc.txt similarity index 100% rename from data-raw/icd_hcc_rawdata/icd10/2017_icd10hcc.txt rename to inst/data-raw/icd_hcc_rawdata/icd10/2017_icd10hcc.txt diff --git a/data-raw/icd_hcc_rawdata/icd10/2018_icd10hcc.txt b/inst/data-raw/icd_hcc_rawdata/icd10/2018_icd10hcc.txt similarity index 100% rename from data-raw/icd_hcc_rawdata/icd10/2018_icd10hcc.txt rename to inst/data-raw/icd_hcc_rawdata/icd10/2018_icd10hcc.txt diff --git a/data-raw/icd_hcc_rawdata/icd10/2019_icd10hcc.txt b/inst/data-raw/icd_hcc_rawdata/icd10/2019_icd10hcc.txt similarity index 100% rename from data-raw/icd_hcc_rawdata/icd10/2019_icd10hcc.txt rename to inst/data-raw/icd_hcc_rawdata/icd10/2019_icd10hcc.txt diff --git a/data-raw/icd_hcc_rawdata/icd9/2007_icd9hcc.txt b/inst/data-raw/icd_hcc_rawdata/icd9/2007_icd9hcc.txt old mode 100755 new mode 100644 similarity index 100% rename from data-raw/icd_hcc_rawdata/icd9/2007_icd9hcc.txt rename to inst/data-raw/icd_hcc_rawdata/icd9/2007_icd9hcc.txt diff --git a/data-raw/icd_hcc_rawdata/icd9/2008_icd9hcc.txt b/inst/data-raw/icd_hcc_rawdata/icd9/2008_icd9hcc.txt old mode 100755 new mode 100644 similarity index 100% rename from data-raw/icd_hcc_rawdata/icd9/2008_icd9hcc.txt rename to inst/data-raw/icd_hcc_rawdata/icd9/2008_icd9hcc.txt diff --git a/data-raw/icd_hcc_rawdata/icd9/2009_icd9hcc.txt b/inst/data-raw/icd_hcc_rawdata/icd9/2009_icd9hcc.txt old mode 100755 new mode 100644 similarity index 100% rename from data-raw/icd_hcc_rawdata/icd9/2009_icd9hcc.txt rename to inst/data-raw/icd_hcc_rawdata/icd9/2009_icd9hcc.txt diff --git a/data-raw/icd_hcc_rawdata/icd9/2010_icd9hcc.txt b/inst/data-raw/icd_hcc_rawdata/icd9/2010_icd9hcc.txt old mode 100755 new mode 100644 similarity index 100% rename from data-raw/icd_hcc_rawdata/icd9/2010_icd9hcc.txt rename to inst/data-raw/icd_hcc_rawdata/icd9/2010_icd9hcc.txt diff --git a/data-raw/icd_hcc_rawdata/icd9/2011_icd9hcc.txt b/inst/data-raw/icd_hcc_rawdata/icd9/2011_icd9hcc.txt old mode 100755 new mode 100644 similarity index 100% rename from data-raw/icd_hcc_rawdata/icd9/2011_icd9hcc.txt rename to inst/data-raw/icd_hcc_rawdata/icd9/2011_icd9hcc.txt diff --git a/data-raw/icd_hcc_rawdata/icd9/2012_icd9hcc.txt b/inst/data-raw/icd_hcc_rawdata/icd9/2012_icd9hcc.txt old mode 100755 new mode 100644 similarity index 100% rename from data-raw/icd_hcc_rawdata/icd9/2012_icd9hcc.txt rename to inst/data-raw/icd_hcc_rawdata/icd9/2012_icd9hcc.txt diff --git a/data-raw/icd_hcc_rawdata/icd9/2013_icd9hcc.txt b/inst/data-raw/icd_hcc_rawdata/icd9/2013_icd9hcc.txt old mode 100755 new mode 100644 similarity index 100% rename from data-raw/icd_hcc_rawdata/icd9/2013_icd9hcc.txt rename to inst/data-raw/icd_hcc_rawdata/icd9/2013_icd9hcc.txt diff --git a/data-raw/icd_hcc_rawdata/icd9/2014_icd9hcc.txt b/inst/data-raw/icd_hcc_rawdata/icd9/2014_icd9hcc.txt old mode 100755 new mode 100644 similarity index 100% rename from data-raw/icd_hcc_rawdata/icd9/2014_icd9hcc.txt rename to inst/data-raw/icd_hcc_rawdata/icd9/2014_icd9hcc.txt diff --git a/data-raw/icd_hcc_rawdata/icd9/2015_icd9hcc.txt b/inst/data-raw/icd_hcc_rawdata/icd9/2015_icd9hcc.txt old mode 100755 new mode 100644 similarity index 100% rename from data-raw/icd_hcc_rawdata/icd9/2015_icd9hcc.txt rename to inst/data-raw/icd_hcc_rawdata/icd9/2015_icd9hcc.txt diff --git a/data-raw/icd_hcc_rawdata/icd9/2016_icd9hcc.txt b/inst/data-raw/icd_hcc_rawdata/icd9/2016_icd9hcc.txt old mode 100755 new mode 100644 similarity index 100% rename from data-raw/icd_hcc_rawdata/icd9/2016_icd9hcc.txt rename to inst/data-raw/icd_hcc_rawdata/icd9/2016_icd9hcc.txt diff --git a/data-raw/icd_hcc_rawdata/labels/2007_labels.txt b/inst/data-raw/icd_hcc_rawdata/labels/2007_labels.txt old mode 100755 new mode 100644 similarity index 100% rename from data-raw/icd_hcc_rawdata/labels/2007_labels.txt rename to inst/data-raw/icd_hcc_rawdata/labels/2007_labels.txt diff --git a/data-raw/icd_hcc_rawdata/labels/2008_labels.txt b/inst/data-raw/icd_hcc_rawdata/labels/2008_labels.txt old mode 100755 new mode 100644 similarity index 100% rename from data-raw/icd_hcc_rawdata/labels/2008_labels.txt rename to inst/data-raw/icd_hcc_rawdata/labels/2008_labels.txt diff --git a/data-raw/icd_hcc_rawdata/labels/2009_labels.txt b/inst/data-raw/icd_hcc_rawdata/labels/2009_labels.txt old mode 100755 new mode 100644 similarity index 100% rename from data-raw/icd_hcc_rawdata/labels/2009_labels.txt rename to inst/data-raw/icd_hcc_rawdata/labels/2009_labels.txt diff --git a/data-raw/icd_hcc_rawdata/labels/2010_labels.txt b/inst/data-raw/icd_hcc_rawdata/labels/2010_labels.txt old mode 100755 new mode 100644 similarity index 100% rename from data-raw/icd_hcc_rawdata/labels/2010_labels.txt rename to inst/data-raw/icd_hcc_rawdata/labels/2010_labels.txt diff --git a/data-raw/icd_hcc_rawdata/labels/2011_labels.txt b/inst/data-raw/icd_hcc_rawdata/labels/2011_labels.txt old mode 100755 new mode 100644 similarity index 100% rename from data-raw/icd_hcc_rawdata/labels/2011_labels.txt rename to inst/data-raw/icd_hcc_rawdata/labels/2011_labels.txt diff --git a/data-raw/icd_hcc_rawdata/labels/2012_labels.txt b/inst/data-raw/icd_hcc_rawdata/labels/2012_labels.txt old mode 100755 new mode 100644 similarity index 100% rename from data-raw/icd_hcc_rawdata/labels/2012_labels.txt rename to inst/data-raw/icd_hcc_rawdata/labels/2012_labels.txt diff --git a/data-raw/icd_hcc_rawdata/labels/2013_labels.txt b/inst/data-raw/icd_hcc_rawdata/labels/2013_labels.txt old mode 100755 new mode 100644 similarity index 100% rename from data-raw/icd_hcc_rawdata/labels/2013_labels.txt rename to inst/data-raw/icd_hcc_rawdata/labels/2013_labels.txt diff --git a/data-raw/icd_hcc_rawdata/labels/2014_labels.txt b/inst/data-raw/icd_hcc_rawdata/labels/2014_labels.txt old mode 100755 new mode 100644 similarity index 100% rename from data-raw/icd_hcc_rawdata/labels/2014_labels.txt rename to inst/data-raw/icd_hcc_rawdata/labels/2014_labels.txt diff --git a/data-raw/icd_hcc_rawdata/labels/2015_labels.txt b/inst/data-raw/icd_hcc_rawdata/labels/2015_labels.txt old mode 100755 new mode 100644 similarity index 100% rename from data-raw/icd_hcc_rawdata/labels/2015_labels.txt rename to inst/data-raw/icd_hcc_rawdata/labels/2015_labels.txt diff --git a/data-raw/icd_hcc_rawdata/labels/2016_labels.txt b/inst/data-raw/icd_hcc_rawdata/labels/2016_labels.txt old mode 100755 new mode 100644 similarity index 100% rename from data-raw/icd_hcc_rawdata/labels/2016_labels.txt rename to inst/data-raw/icd_hcc_rawdata/labels/2016_labels.txt diff --git a/data-raw/icd_hcc_rawdata/labels/2017_labels.txt b/inst/data-raw/icd_hcc_rawdata/labels/2017_labels.txt old mode 100755 new mode 100644 similarity index 100% rename from data-raw/icd_hcc_rawdata/labels/2017_labels.txt rename to inst/data-raw/icd_hcc_rawdata/labels/2017_labels.txt diff --git a/data-raw/icd_hcc_rawdata/labels/2018_labels.txt b/inst/data-raw/icd_hcc_rawdata/labels/2018_labels.txt old mode 100755 new mode 100644 similarity index 100% rename from data-raw/icd_hcc_rawdata/labels/2018_labels.txt rename to inst/data-raw/icd_hcc_rawdata/labels/2018_labels.txt diff --git a/data-raw/icd_hcc_rawdata/labels/2019_labels.txt b/inst/data-raw/icd_hcc_rawdata/labels/2019_labels.txt old mode 100755 new mode 100644 similarity index 100% rename from data-raw/icd_hcc_rawdata/labels/2019_labels.txt rename to inst/data-raw/icd_hcc_rawdata/labels/2019_labels.txt diff --git a/data-raw/ver2016_ahrq-comformat_icd10cm_2016.txt b/inst/data-raw/ver2016_ahrq-comformat_icd10cm_2016.txt similarity index 100% rename from data-raw/ver2016_ahrq-comformat_icd10cm_2016.txt rename to inst/data-raw/ver2016_ahrq-comformat_icd10cm_2016.txt From dd851699e13a34d90a5081c407d93aefa8083274 Mon Sep 17 00:00:00 2001 From: Patrick Date: Sun, 1 Mar 2020 23:48:14 -0500 Subject: [PATCH 36/51] attempt to fix "non-portable flag(s)" error on 3.6.2 travis build --- .travis.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.travis.yml b/.travis.yml index 87e34ffb..4ffd72a4 100644 --- a/.travis.yml +++ b/.travis.yml @@ -85,7 +85,7 @@ env: - _R_CHECK_LENGTH_1_LOGIC2_="verbose,abort" - _R_CHECK_NO_STOP_ON_TEST_ERROR_=FALSE # some of the following are ignored if --as-cran is set - - _R_CHECK_COMPILATION_FLAGS_=FALSE + - _R_CHECK_COMPILATION_FLAGS_=TRUE - _R_CHECK_COMPILATION_FLAGS_KNOWN_="-Wno-unused-parameter -Wno-unused-variable -Wno-ignored-attributes -Wno-cast-function-type -Wno-unknown-warning-option" # the following are to simulate cran, and # help debugging if we didn't use --as-cran From 8461d8dc182a3517233779bad3c036cef24d333e Mon Sep 17 00:00:00 2001 From: Patrick Date: Fri, 13 Mar 2020 01:49:17 -0400 Subject: [PATCH 37/51] updated URL MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit CIM-10-FR adds U071: Maladie à coronavirus 2019 [COVID-19] --- R/cim-10-fr.R | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/R/cim-10-fr.R b/R/cim-10-fr.R index 5cf4eefa..559ee340 100644 --- a/R/cim-10-fr.R +++ b/R/cim-10-fr.R @@ -8,7 +8,7 @@ "https://www.atih.sante.fr", "plateformes-de-transmission-et-logiciels", "logiciels-espace-de-telechargement", - "telecharger/gratuit/12713/456" + "telecharger/gratuit/13332/456" ), file_name = "LIBCIM10MULTI.TXT", dl_msg = "Working on ICD-10-FR (CIM-10-FR)", From 44dbc61eb26b33cb06735e9324c09b0d0ea4ff8b Mon Sep 17 00:00:00 2001 From: Patrick Date: Sun, 1 Mar 2020 15:47:12 -0500 Subject: [PATCH 38/51] remove stringsAsFactors argument stringsAsFactors is being deprecated generally. The code here is causing test-score.R#333 to fail on R-devel because the id column is not a factor. See https://developer.r-project.org/Blog/public/2020/02/16/stringsasfactors/ --- R/score.R | 22 ++--------- tests/testthat/test-score.R | 75 +------------------------------------ 2 files changed, 5 insertions(+), 92 deletions(-) diff --git a/R/score.R b/R/score.R index a4c1cc7e..9fbf2ab1 100644 --- a/R/score.R +++ b/R/score.R @@ -24,11 +24,6 @@ #' frame will be returned, with the first column named as in input data frame #' (i.e., \code{visit_name}), containing all the visits, and the second column #' containing the Charlson Comorbidity Index. -#' @param stringsAsFactors single logical, passed on when constructing -#' data.frame if \code{return_df} is \code{TRUE}. If the input data frame -#' \code{x} has a factor for the \code{visit_name}, this is not changed, but a -#' non-factor \code{visit_name} may be converted or not converted according to -#' your system default or this setting. #' @param ... further arguments to pass on to \code{icd9_comorbid_quan_deyo}, #' e.g. \code{name} #' @examples @@ -46,7 +41,6 @@ charlson <- function(x, visit_name = NULL, scoring_system = c("original", "charlson", "quan"), return_df = FALSE, - stringsAsFactors = getOption("stringsAsFactors"), # nolint ...) { UseMethod("charlson") } @@ -60,7 +54,6 @@ charlson.data.frame <- function(x, visit_name = NULL, scoring_system = c("original", "charlson", "quan"), return_df = FALSE, - stringsAsFactors = getOption("stringsAsFactors"), # nolint ...) { stopifnot(is.data.frame(x), ncol(x) >= 2, !is.null(colnames(x))) stopifnot(is.null(visit_name) || @@ -68,7 +61,6 @@ charlson.data.frame <- function(x, stopifnot(is.null(visit_name) || (is.character(visit_name) && length(visit_name) == 1L)) assert_flag(return_df) - assert_flag(stringsAsFactors) # nolint visit_name <- get_visit_name(x, visit_name) res <- charlson_from_comorbid( comorbid_quan_deyo(x, @@ -84,9 +76,8 @@ charlson.data.frame <- function(x, return(res) } out <- cbind(names(res), - data.frame("Charlson" = unname(res)), - stringsAsFactors = stringsAsFactors - ) # nolint + data.frame("Charlson" = unname(res)) + ) names(out)[1] <- visit_name out } @@ -301,7 +292,6 @@ count_codes_wide <- function(x, #' frame will be returned, with the first column named as in input data frame #' (i.e., \code{visit_name}), containing all the visits, and the second column #' containing the Charlson Comorbidity Index. -#' @template stringsAsFactors #' @template dotdotdot #' @examples #' mydf <- data.frame( @@ -325,7 +315,6 @@ count_codes_wide <- function(x, van_walraven <- function(x, visit_name = NULL, return_df = FALSE, - stringsAsFactors = getOption("stringsAsFactors"), # nolint ...) { UseMethod("van_walraven") } @@ -336,13 +325,11 @@ van_walraven <- function(x, van_walraven.data.frame <- function(x, visit_name = NULL, return_df = FALSE, - stringsAsFactors = getOption("stringsAsFactors"), # nolint ...) { stopifnot(is.data.frame(x), ncol(x) >= 2, !is.null(colnames(x))) stopifnot(is.null(visit_name) || (is.character(visit_name) && length(visit_name) == 1L)) assert_flag(return_df) - assert_flag(stringsAsFactors) # nolint visit_name <- get_visit_name(x, visit_name) tmp <- icd9_comorbid_quan_elix(x, visit_name, @@ -357,9 +344,8 @@ van_walraven.data.frame <- function(x, return(res) } out <- cbind(names(res), - data.frame("vanWalraven" = unname(res)), - stringsAsFactors = stringsAsFactors - ) # nolint + data.frame("vanWalraven" = unname(res)) + ) names(out)[1] <- visit_name out } diff --git a/tests/testthat/test-score.R b/tests/testthat/test-score.R index cd9d32a7..6ec50555 100644 --- a/tests/testthat/test-score.R +++ b/tests/testthat/test-score.R @@ -48,8 +48,7 @@ test_that("only matrix or data.frame accepted", { test_that("Charlson score", { mydf <- data.frame( visit_id = c("a", "b", "c"), - icd9 = c("441", "412.93", "042"), - stringsAsFactors = TRUE + icd9 = c("441", "412.93", "042") ) expect_equal( charlson_from_comorbid( @@ -64,7 +63,6 @@ test_that("Charlson score", { expect_equivalent( charlson(mydf, return_df = TRUE, - stringsAsFactors = TRUE, short_code = FALSE ), structure(list( @@ -79,77 +77,6 @@ test_that("Charlson score", { class = "data.frame" ) ) - mydff <- data.frame( - visit_id = c("a", "b", "c"), - icd9 = c("441", "412.93", "042"), - stringsAsFactors = FALSE - ) - expect_identical( - charlson(mydff, - return_df = TRUE, - stringsAsFactors = FALSE, - short_code = FALSE - ), - structure(list( - visit_id = c("a", "b", "c"), - Charlson = c(1, 1, 6) - ), - .Names = c("visit_id", "Charlson"), - row.names = c(NA, -3L), - class = "data.frame" - ) - ) - expect_identical( - charlson(mydff, - return_df = TRUE, - stringsAsFactors = TRUE, - short_code = FALSE - ), - structure(list( - visit_id = factor(c("a", "b", "c")), - Charlson = c(1, 1, 6) - ), - .Names = c("visit_id", "Charlson"), - row.names = c(NA, -3L), - class = "data.frame" - ) - ) - mydfff <- mydff - names(mydfff)[1] <- "v" - expect_equivalent( - charlson(mydfff, - return_df = TRUE, - stringsAsFactors = FALSE, - short_code = FALSE - ), - structure(list( - v = c("a", "b", "c"), - Charlson = c(1, 1, 6) - ), - .Names = c("v", "Charlson"), - row.names = c(NA, -3L), - class = "data.frame" - ) - ) - mydffff <- cbind(mydfff, data.frame(v2 = mydfff$v, stringsAsFactors = FALSE)) - mydffff$v <- NULL - expect_identical(get_icd_name(mydffff, NULL), "icd9") - expect_equivalent( - charlson(mydffff, - visit_name = "v2", - return_df = TRUE, - stringsAsFactors = FALSE, - short_code = FALSE - ), - structure(list( - v2 = c("a", "b", "c"), - Charlson = c(1, 1, 6) - ), - .Names = c("v2", "Charlson"), - row.names = c(NA, -3L), - class = "data.frame" - ) - ) }) test_that("Charlson - errors?", { From 494810e19181b9ca6c7e0ba9dd69311629b086ea Mon Sep 17 00:00:00 2001 From: Patrick Date: Sun, 1 Mar 2020 22:44:15 -0500 Subject: [PATCH 39/51] revert stringsToFactor change --- R/score.R | 22 +++++++++-- tests/testthat/test-score.R | 77 ++++++++++++++++++++++++++++++++++++- 2 files changed, 93 insertions(+), 6 deletions(-) diff --git a/R/score.R b/R/score.R index 9fbf2ab1..a4c1cc7e 100644 --- a/R/score.R +++ b/R/score.R @@ -24,6 +24,11 @@ #' frame will be returned, with the first column named as in input data frame #' (i.e., \code{visit_name}), containing all the visits, and the second column #' containing the Charlson Comorbidity Index. +#' @param stringsAsFactors single logical, passed on when constructing +#' data.frame if \code{return_df} is \code{TRUE}. If the input data frame +#' \code{x} has a factor for the \code{visit_name}, this is not changed, but a +#' non-factor \code{visit_name} may be converted or not converted according to +#' your system default or this setting. #' @param ... further arguments to pass on to \code{icd9_comorbid_quan_deyo}, #' e.g. \code{name} #' @examples @@ -41,6 +46,7 @@ charlson <- function(x, visit_name = NULL, scoring_system = c("original", "charlson", "quan"), return_df = FALSE, + stringsAsFactors = getOption("stringsAsFactors"), # nolint ...) { UseMethod("charlson") } @@ -54,6 +60,7 @@ charlson.data.frame <- function(x, visit_name = NULL, scoring_system = c("original", "charlson", "quan"), return_df = FALSE, + stringsAsFactors = getOption("stringsAsFactors"), # nolint ...) { stopifnot(is.data.frame(x), ncol(x) >= 2, !is.null(colnames(x))) stopifnot(is.null(visit_name) || @@ -61,6 +68,7 @@ charlson.data.frame <- function(x, stopifnot(is.null(visit_name) || (is.character(visit_name) && length(visit_name) == 1L)) assert_flag(return_df) + assert_flag(stringsAsFactors) # nolint visit_name <- get_visit_name(x, visit_name) res <- charlson_from_comorbid( comorbid_quan_deyo(x, @@ -76,8 +84,9 @@ charlson.data.frame <- function(x, return(res) } out <- cbind(names(res), - data.frame("Charlson" = unname(res)) - ) + data.frame("Charlson" = unname(res)), + stringsAsFactors = stringsAsFactors + ) # nolint names(out)[1] <- visit_name out } @@ -292,6 +301,7 @@ count_codes_wide <- function(x, #' frame will be returned, with the first column named as in input data frame #' (i.e., \code{visit_name}), containing all the visits, and the second column #' containing the Charlson Comorbidity Index. +#' @template stringsAsFactors #' @template dotdotdot #' @examples #' mydf <- data.frame( @@ -315,6 +325,7 @@ count_codes_wide <- function(x, van_walraven <- function(x, visit_name = NULL, return_df = FALSE, + stringsAsFactors = getOption("stringsAsFactors"), # nolint ...) { UseMethod("van_walraven") } @@ -325,11 +336,13 @@ van_walraven <- function(x, van_walraven.data.frame <- function(x, visit_name = NULL, return_df = FALSE, + stringsAsFactors = getOption("stringsAsFactors"), # nolint ...) { stopifnot(is.data.frame(x), ncol(x) >= 2, !is.null(colnames(x))) stopifnot(is.null(visit_name) || (is.character(visit_name) && length(visit_name) == 1L)) assert_flag(return_df) + assert_flag(stringsAsFactors) # nolint visit_name <- get_visit_name(x, visit_name) tmp <- icd9_comorbid_quan_elix(x, visit_name, @@ -344,8 +357,9 @@ van_walraven.data.frame <- function(x, return(res) } out <- cbind(names(res), - data.frame("vanWalraven" = unname(res)) - ) + data.frame("vanWalraven" = unname(res)), + stringsAsFactors = stringsAsFactors + ) # nolint names(out)[1] <- visit_name out } diff --git a/tests/testthat/test-score.R b/tests/testthat/test-score.R index 6ec50555..fa3cbdd3 100644 --- a/tests/testthat/test-score.R +++ b/tests/testthat/test-score.R @@ -48,7 +48,8 @@ test_that("only matrix or data.frame accepted", { test_that("Charlson score", { mydf <- data.frame( visit_id = c("a", "b", "c"), - icd9 = c("441", "412.93", "042") + icd9 = c("441", "412.93", "042"), + stringsAsFactors = TRUE ) expect_equal( charlson_from_comorbid( @@ -63,6 +64,7 @@ test_that("Charlson score", { expect_equivalent( charlson(mydf, return_df = TRUE, + stringsAsFactors = TRUE, short_code = FALSE ), structure(list( @@ -77,6 +79,77 @@ test_that("Charlson score", { class = "data.frame" ) ) + mydff <- data.frame( + visit_id = c("a", "b", "c"), + icd9 = c("441", "412.93", "042"), + stringsAsFactors = FALSE + ) + expect_identical( + charlson(mydff, + return_df = TRUE, + stringsAsFactors = FALSE, + short_code = FALSE + ), + structure(list( + visit_id = c("a", "b", "c"), + Charlson = c(1, 1, 6) + ), + .Names = c("visit_id", "Charlson"), + row.names = c(NA, -3L), + class = "data.frame" + ) + ) + expect_identical( + charlson(mydff, + return_df = TRUE, + stringsAsFactors = TRUE, + short_code = FALSE + ), + structure(list( + visit_id = factor(c("a", "b", "c")), + Charlson = c(1, 1, 6) + ), + .Names = c("visit_id", "Charlson"), + row.names = c(NA, -3L), + class = "data.frame" + ) + ) + mydfff <- mydff + names(mydfff)[1] <- "v" + expect_equivalent( + charlson(mydfff, + return_df = TRUE, + stringsAsFactors = FALSE, + short_code = FALSE + ), + structure(list( + v = c("a", "b", "c"), + Charlson = c(1, 1, 6) + ), + .Names = c("v", "Charlson"), + row.names = c(NA, -3L), + class = "data.frame" + ) + ) + mydffff <- cbind(mydfff, data.frame(v2 = mydfff$v, stringsAsFactors = FALSE)) + mydffff$v <- NULL + expect_identical(get_icd_name(mydffff, NULL), "icd9") + expect_equivalent( + charlson(mydffff, + visit_name = "v2", + return_df = TRUE, + stringsAsFactors = FALSE, + short_code = FALSE + ), + structure(list( + v2 = c("a", "b", "c"), + Charlson = c(1, 1, 6) + ), + .Names = c("v2", "Charlson"), + row.names = c(NA, -3L), + class = "data.frame" + ) + ) }) test_that("Charlson - errors?", { @@ -235,7 +308,7 @@ test_that("van_walraven_from_comorbid score calculation", { ) }) -test_that("van_walraven comorbidity index and score", { +test_that("van_walraven comodbidity index and score", { mydf <- data.frame( id = factor(c(rep(1, 20), rep(2, 20), rep(3, 18))), value = From 192bfbc923c8b781b615c1516e3600c81018bfff Mon Sep 17 00:00:00 2001 From: Patrick Date: Sun, 1 Mar 2020 23:13:51 -0500 Subject: [PATCH 40/51] fix typos --- tests/testthat/test-score.R | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/testthat/test-score.R b/tests/testthat/test-score.R index fa3cbdd3..cd9d32a7 100644 --- a/tests/testthat/test-score.R +++ b/tests/testthat/test-score.R @@ -308,7 +308,7 @@ test_that("van_walraven_from_comorbid score calculation", { ) }) -test_that("van_walraven comodbidity index and score", { +test_that("van_walraven comorbidity index and score", { mydf <- data.frame( id = factor(c(rep(1, 20), rep(2, 20), rep(3, 18))), value = From b33b1a178de21bd6843ef37b2cb7100862ef4192 Mon Sep 17 00:00:00 2001 From: Patrick Date: Fri, 13 Mar 2020 02:36:45 -0400 Subject: [PATCH 41/51] fix typo --- R/util-file.R | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/R/util-file.R b/R/util-file.R index 8d327e8c..979513ed 100644 --- a/R/util-file.R +++ b/R/util-file.R @@ -121,7 +121,7 @@ #' @param url URL of a zip file #' @param file_name file name of the resource within the zip file #' @param save_path file path to save the first file from the zip -#' @param insecure Logical value, wil disable certificate check which fails on +#' @param insecure Logical value, will disable certificate check which fails on #' some platforms for some ICD data from CDC and CMS, probably because of TLS #' version or certificate key length issues. Default is \code{TRUE}. #' @param ... additional arguments passed to \code{utils::download.file} From 12a77bef1bfd3e1d43a215be06bbfa9a82ac6ba0 Mon Sep 17 00:00:00 2001 From: Patrick Date: Fri, 13 Mar 2020 02:41:23 -0400 Subject: [PATCH 42/51] revert _R_CHECK_COMPILATION_FLAGS_=TRUE change --- .travis.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.travis.yml b/.travis.yml index 4ffd72a4..87e34ffb 100644 --- a/.travis.yml +++ b/.travis.yml @@ -85,7 +85,7 @@ env: - _R_CHECK_LENGTH_1_LOGIC2_="verbose,abort" - _R_CHECK_NO_STOP_ON_TEST_ERROR_=FALSE # some of the following are ignored if --as-cran is set - - _R_CHECK_COMPILATION_FLAGS_=TRUE + - _R_CHECK_COMPILATION_FLAGS_=FALSE - _R_CHECK_COMPILATION_FLAGS_KNOWN_="-Wno-unused-parameter -Wno-unused-variable -Wno-ignored-attributes -Wno-cast-function-type -Wno-unknown-warning-option" # the following are to simulate cran, and # help debugging if we didn't use --as-cran From 17e6f9b4001b38846072089f39455c96f9e718a5 Mon Sep 17 00:00:00 2001 From: Patrick Date: Sat, 28 Mar 2020 17:25:28 -0400 Subject: [PATCH 43/51] add qpdf avoid "WARNING 'qpdf' is needed for checks on size reduction of PDFs" --- .travis.yml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.travis.yml b/.travis.yml index 87e34ffb..2b317094 100644 --- a/.travis.yml +++ b/.travis.yml @@ -25,6 +25,8 @@ addons: apt: packages: - valgrind + # avoid "WARNING 'qpdf' is needed for checks on size reduction of PDFs" + - qpdf #- r-cran-tinytex #r_packages: From c7045eda2a7b22f6983537b576bb8f7dcf74ab2e Mon Sep 17 00:00:00 2001 From: Jack Wasey Date: Wed, 18 Mar 2020 10:52:59 -0400 Subject: [PATCH 44/51] try biarch true for remote builds/tests, e.g. rhub; redocumented with new roxyen travis and build tweaks add sets of environment variable definitions for bash and makevars, and enable in travis add R_REMOTES_STANDALONE=true to fix appveyor curl error See https://github.com/r-lib/remotes#standalone-mode and https://github.com/krlmlr/r-appveyor/issues/135 add qpdf avoid "WARNING 'qpdf' is needed for checks on size reduction of PDFs" --- .Rbuildignore | 1 + .travis.yml | 153 +++++++++++++++++-------------------- DESCRIPTION | 3 +- codemeta.json | 9 ++- configure | 148 +++++++++++++++++++++++++++-------- configure.ac | 74 ++++++++++++------ man/get_icd10cm2019_pc.Rd | 6 +- man/get_icd9cm2014_leaf.Rd | 6 +- man/icd9_map_ahrq.Rd | 4 +- man/icd9_map_elix.Rd | 4 +- man/icd9_map_hcc.Rd | 6 +- man/icd9_map_quan_deyo.Rd | 4 +- man/icd9_map_quan_elix.Rd | 4 +- man/icd9_map_single_ccs.Rd | 4 +- man/names_elix.Rd | 6 +- man/poa_choices.Rd | 4 +- src/Makevars.in | 16 +--- tools/env/cran | 13 ++++ tools/env/full | 23 ++++++ tools/env/jit | 46 +++++++++++ tools/env/plus | 44 +++++++++++ tools/env/quick | 33 ++++++++ tools/env/rhub | 3 + tools/env/rhub-san | 21 +++++ tools/env/travis-global | 37 +++++++++ tools/mk/strip.mk | 12 +++ tools/mk/travis-debug.mk | 8 ++ tools/mk/travis-macos.mk | 9 +++ tools/mk/travis-nowarn.mk | 8 ++ 29 files changed, 535 insertions(+), 174 deletions(-) create mode 100755 tools/env/cran create mode 100755 tools/env/full create mode 100755 tools/env/jit create mode 100755 tools/env/plus create mode 100755 tools/env/quick create mode 100644 tools/env/rhub create mode 100644 tools/env/rhub-san create mode 100644 tools/env/travis-global create mode 100644 tools/mk/strip.mk create mode 100644 tools/mk/travis-debug.mk create mode 100644 tools/mk/travis-macos.mk create mode 100644 tools/mk/travis-nowarn.mk diff --git a/.Rbuildignore b/.Rbuildignore index 2c84616e..fd557918 100644 --- a/.Rbuildignore +++ b/.Rbuildignore @@ -32,6 +32,7 @@ ^data-raw$ ^doc$ ^docs$ +^Dockerfile$ ^icd.*\.out$ ^icd\.Rcheck$ ^icd_.*tar\.gz diff --git a/.travis.yml b/.travis.yml index 2b317094..bf26bee5 100644 --- a/.travis.yml +++ b/.travis.yml @@ -4,7 +4,7 @@ language: r # https://docs.travis-ci.com/user/ci-environment/ # for RcppEigen to compile, (but disable if brew gcc on mac to avoid conflict) -# fortran: true # set explicitly in each stanza +# fortran: true # set explicitly in each stanza? but not recognized by an "include" group. # may need this for clang: # export LD_LIBRARY_PATH=/usr/local/clang/lib:$LD_LIBRARY_PATH @@ -16,7 +16,10 @@ language: r # # https://docs.travis-ci.com/user/languages/cpp/ -sudo: false +# assert the defaults for os and dist - will add macos and bionic etc. later +os: linux +dist: xenial + cache: - packages - ccache @@ -24,9 +27,8 @@ cache: addons: apt: packages: - - valgrind - # avoid "WARNING 'qpdf' is needed for checks on size reduction of PDFs" - qpdf +# - valgrind # when I do do this (probably too slow for travis anyway, then just put the apt addon in the specific build) #- r-cran-tinytex #r_packages: @@ -38,103 +40,60 @@ cran: https://cloud.r-project.org r_check_args: "" warnings_are_errors: true -# try to speed up compilation time before_install: + # - set -o allexport; source tools/env/travis-global; set +o allexport; # May need to set the R library directory so R CMD check finds packages # installed by travis (automatically, and in my scripts) and by R itself # https://stackoverflow.com/questions/31879011/r-cant-find-packages-installed-by-travis # - mkdir -p "$HOME/R.icd.lib" # - echo R_LIBS=$HOME/R.icd.lib:/usr/lib/R/site-library/" > ~/.Renviron # - sudo chmod 2777 "$HOME/R.icd.lib" - # - # Work-around r-lib/remotes bug which prevents travis building. - # https://github.com/r-lib/devtools/issues/2020#issuecomment-481219296 - - Rscript -e 'source("https://install-github.me/r-lib/remotes")' - # ready for Makevars - mkdir -p ~/.R ; - - echo 'CXXFLAGS=-Wno-unused-parameter -Wno-unused-variable -Wno-ignored-attributes -Wno-cast-function-type -Wno-unknown-warning-option' >> ~/.R/Makevars ; - - echo 'CXX11FLAGS=-Wno-unused-parameter -Wno-unused-variable -Wno-ignored-attributes -Wno-cast-function-type -Wno-unknown-warning-option' >> ~/.R/Makevars ; - - if [[ "$TRAVIS_R_VERSION_STRING" = 'devel' ]]; then - echo 'CFLAGS=-O0' >> ~/.R/Makevars ; - echo 'CXXFLAGS=-O0' >> ~/.R/Makevars ; - echo 'CXX11FLAGS=-O0' >> ~/.R/Makevars ; - fi - # ignore the stubs for the pre-built vignettes, as the latex environments on - # travis are heterogeneous! + - if [[ $TRAVIS_R_VERSION_STRING == devel ]]; then cat tools/mk/travis-debug.mk >> ~/.R/Makevars; fi; + # this is one of oldrel, release or devel per https://docs.travis-ci.com/user/languages/r#configuration-options + - cat tools/mk/travis-nowarn.mk >> ~/.R/Makevars + # ignore the stubs for the pre-built vignettes, as the latex environments on travis are heterogeneous! - echo '^vignettes\/.*-vignette\.Rnw$' >> .Rbuildignore - # Homebrew GCC currently version 8.3 from + # https://github.com/Homebrew/homebrew-core/blob/master/Formula/gcc.rb - - if [[ "$(uname -s)" = 'Darwin' && x"$ICD_USE_XCODE_CLANG" != 'xtrue' ]]; then - brew upgrade gcc; - command -v g++-9 >/dev/null 2>&1 || brew install gcc && echo 'CC=gcc-9' >> ~/.R/Makevars && echo 'CXX=g++-9' >> ~/.R/Makevars && echo 'CXX11=g++-9' >> ~/.R/Makevars && Rscript -e 'install.packages("Rcpp", type = "source")'; + # I think PKG_CXX etc only needed if Makevars in the package itself, not ~/.R/Makevars + # openblas may need brew linking. may be best NOT to overwrite gfortran? + - export HOMEBREW_NO_INSTALL_CLEANUP=1 && if [[ "$(uname -s)" = 'Darwin' ]] && [[ $ICD_USE_XCODE_CLANG != 'true' ]]; then + brew upgrade ; + brew install gcc ; + brew link --overwrite gcc ; + cat tools/mk/travis-macos.mk >> ~/.R/Makevars ; + Rscript -e 'install.packages("Rcpp", type = "source")' ; fi - cat ~/.R/Makevars - cat .Rbuildignore - - Rscript -e '.libPaths()' + - Rscript -e '.libPaths(); getOption("repos")' - pwd - - ls -R # for the pre-built static vignette stubs to include the actual vignettes. - # Make sure travis latex option is not false for relevant builds. - # - Rscript -e 'if (!require("tinytex")) {quit(status=1)} else {tinytex::install_tinytex(); tinytex::tlmgr_install("pdfpages", "ae")}' || hash tlmgr 2>/dev/null && { tlmgr --usermode install pdfpages ae; } + # Make sure travis latex: true is set just for relevant builds. Official way to add latex packages is: + # before_install: + # - tlmgr install index + # and/or? something like: + # - Rscript -e 'if (!require("tinytex", character.only = TRUE, quietly = TRUE, warn.conflicts = FALSE)) {quit(status=1)} else {tinytex::install_tinytex(); tinytex::tlmgr_install("pdfpages", "ae")}' || hash tlmgr 2>/dev/null && { tlmgr --usermode install pdfpages ae; } -env: - global: - - _R_CHECK_CRAN_INCOMING_=FALSE - - _R_CHECK_CRAN_INCOMING_REMOTE_=FALSE - - _R_CHECK_FORCE_SUGGESTS_=FALSE - - _R_CHECK_USE_INSTALL_LOG_=TRUE - - _R_CHECK_LENGTH_1_CONDITION_="verbose,abort" - - _R_CHECK_LENGTH_1_LOGIC2_="verbose,abort" - - _R_CHECK_NO_STOP_ON_TEST_ERROR_=FALSE - # some of the following are ignored if --as-cran is set - - _R_CHECK_COMPILATION_FLAGS_=FALSE - - _R_CHECK_COMPILATION_FLAGS_KNOWN_="-Wno-unused-parameter -Wno-unused-variable -Wno-ignored-attributes -Wno-cast-function-type -Wno-unknown-warning-option" - # the following are to simulate cran, and - # help debugging if we didn't use --as-cran - - _R_CHECK_ALL_NON_ISO_C_=TRUE - - _R_CHECK_ALWAYS_LOG_VIGNETTE_OUTPUT_=TRUE - - _R_CHECK_CODE_ASSIGN_TO_GLOBALENV_=TRUE - - _R_CHECK_CODETOOLS_PROFILE_="suppressLocalUnused=FALSE" - - _R_CHECK_EXIT_ON_FIRST_ERROR_=FALSE - - _R_CHECK_NATIVE_ROUTINE_REGISTRATION_=TRUE - - _R_CHECK_NO_STOP_ON_TEST_ERROR_=TRUE - - _R_CHECK_RD_EXAMPLES_T_AND_F_=TRUE - - _R_CHECK_RD_LINE_WIDTHS_=true - - _R_CHECK_TESTS_NLINES_=0 - - _R_CHECK_USE_INSTALL_LOG_=TRUE - - _R_CHECK_VIGNETTES_NLINES_=0 - - _R_CHECK_PKG_SIZES_THRESHOLD_=50 - - ICD_COVERAGE=false - - ICD_MINI_BENCH=false - - ICD_DATA_VERBOSE=true - - ICD_DATA_OFFLINE=true - - ICD_DATA_INTERACT=false - # 4 is the official travis suggestion, but the docker images only seem to - # have access to two cores/threads. - - OMP_NUM_THREADS=2 +#env: # global: instead of defining here, source tools/env/travis-global -matrix: +jobs: fast_finish: true include: - r: devel - os: linux - dist: xenial - compiler: - - gcc - - clang + dist: bionic + # note that the default compilers are quite far behind, e.g. bionic is only gcc 7 by default. See: + # https://docs.travis-ci.com/user/languages/c/#choosing-compilers-to-test-against + compiler: gcc env: - ICD_MINI_BENCH=true - r: release - os: linux - compiler: - - gcc - - clang - dist: xenial + compiler: clang + dist: bionic env: - ICD_MINI_BENCH=true - # https://docs.travis-ci.com/user/languages/c/#gcc-on-macos - r: release - os: linux compiler: gcc latex: false r_build_args: --no-build-vignettes --no-manual --resave-data=no @@ -144,48 +103,68 @@ matrix: - ICD_MINI_BENCH=false - ICD_TEST_SLOW=true - r: oldrel - os: linux - dist: trusty + compiler: gcc latex: false r_build_args: --no-build-vignettes --no-manual --resave-data=no r_check_args: --no-build-vignettes --no-vignettes --ignore-vignettes --no-codoc --no-manual - # MacOS: + # MacOS: https://docs.travis-ci.com/user/languages/c/#gcc-on-macos - r: release os: osx # xcode image is needed so things like _stdio.h are available to GCC. - osx_image: xcode10.1 + osx_image: xcode10.3 # compiler: gcc # redundant: done by logic in before_intall - fortran: false + addons: + homebrew: + packages: + - checkbashisms env: - ICD_MINI_BENCH=true - r: devel os: osx - osx_image: xcode10.2 + osx_image: xcode10.3 + addons: + homebrew: + packages: + - checkbashisms # compiler: gcc # redundant: done by logic in before_intall - fortran: false - r: devel os: osx + addons: + homebrew: + packages: + - checkbashisms # as of May 2019, default osx image is 9.4.1 # https://docs.travis-ci.com/user/reference/osx#xcode-version # compiler: clang # redundant - fortran: true env: ICD_USE_XCODE_CLANG=true - r: release os: osx + addons: + homebrew: + packages: + - checkbashisms # compiler: clang # redundant - fortran: true latex: false r_build_args: --no-build-vignettes --no-manual --resave-data=no r_check_args: --no-build-vignettes --no-vignettes --ignore-vignettes --no-codoc --no-manual env: - ICD_USE_XCODE_CLANG=true - ICD_MINI_BENCH=true + - r: release + arch: arm64 + r_build_args: --no-build-vignettes --no-manual --resave-data=no + r_check_args: --no-build-vignettes --no-vignettes --ignore-vignettes --no-codoc --no-manual + env: + - ICD_MINI_BENCH=true + - ICD_TEST_SLOW=true allow_failures: # allow any osx to fail for now: error prone tool chain - os: osx + - arch: arm64 + - arch: ppc64le + - arch: s390x - r: oldrel - r: release - os: linux latex: false r_build_args: --no-build-vignettes --no-manual --resave-data=no r_check_args: --no-build-vignettes --no-vignettes --ignore-vignettes --no-codoc --no-manual @@ -195,6 +174,10 @@ matrix: - ICD_TEST_SLOW=true before_script: +# n.b., before_install bash exports are not preserved beyond each shell invocation. + - set -o allexport; source tools/env/travis-global; set +o allexport; + - set + - echo "$LD_LIBRARY_PATH" - if [ x"$ICD_TEST_SLOW" = x"true" ]; then Rscript -e 'source("tools/split-tests.R"); testthat_split();'; fi diff --git a/DESCRIPTION b/DESCRIPTION index 2210a901..d77d9f06 100644 --- a/DESCRIPTION +++ b/DESCRIPTION @@ -71,6 +71,7 @@ LinkingTo: RcppEigen VignetteBuilder: knitr +Biarch: true Classification/ACM-2012: Social and professional topics~Medical records, Applied computing~Health care information systems, Applied computing~Health informatics, Applied computing~Bioinformatics @@ -79,4 +80,4 @@ Encoding: UTF-8 Language: en-US LazyData: true LazyDataCompression: xz -RoxygenNote: 7.0.2 +RoxygenNote: 7.1.0 diff --git a/codemeta.json b/codemeta.json index 633c621c..baa2c8c8 100644 --- a/codemeta.json +++ b/codemeta.json @@ -14,10 +14,10 @@ "programmingLanguage": { "@type": "ComputerLanguage", "name": "R", - "version": "3.6.0", + "version": "3.6.3", "url": "https://r-project.org" }, - "runtimePlatform": "R version 3.6.0 (2019-04-26)", + "runtimePlatform": "R version 3.6.3 (2020-02-29)", "provider": { "@id": "https://cran.r-project.org", "@type": "Organization", @@ -275,7 +275,7 @@ "sameAs": "https://CRAN.R-project.org/package=Rcpp" } ], - "releaseNotes": "https://github.com/jackwasey/icd/blob/master/NEWS.md", + "releaseNotes": "ssh://git@github.com/jackwasey/icd/blob/master/NEWS.md", "contIntegration": [ "https://travis-ci.org/jackwasey/icd", "https://ci.appveyor.com/project/jackwasey/icd/branch/master", @@ -285,5 +285,6 @@ "https://www.tidyverse.org/lifecycle/#stable", "https://www.repostatus.org/#active" ], - "relatedLink": "https://CRAN.R-project.org/package=icd" + "relatedLink": "https://CRAN.R-project.org/package=icd", + "readme": "https://github.com/jackwasey/icd/blob/master/README.md" } diff --git a/configure b/configure index 8ae1309a..955943aa 100755 --- a/configure +++ b/configure @@ -9,7 +9,7 @@ # This configure script is free software; the Free Software Foundation # gives unlimited permission to copy, distribute and modify it. # -# Copyright (C) 2014 - 2019 Jack O. Wasey +# Copyright (C) 2014 - 2020 Jack O. Wasey ## -------------------- ## ## M4sh Initialization. ## ## -------------------- ## @@ -596,6 +596,7 @@ CPPFLAGS LDFLAGS CXXFLAGS CXX +ICD_SHUTUP target_alias host_alias build_alias @@ -635,15 +636,18 @@ PACKAGE_TARNAME PACKAGE_NAME PATH_SEPARATOR SHELL' -ac_subst_files='' +ac_subst_files='ICD_STRIP' ac_user_opts=' enable_option_checking +enable_icd_shutup enable_openmp -enable_makevars +enable_icd_makevars +enable_icd_strip ' ac_precious_vars='build_alias host_alias target_alias +ICD_SHUTUP CXX CXXFLAGS LDFLAGS @@ -1268,11 +1272,14 @@ Optional Features: --disable-option-checking ignore unrecognized --enable/--with options --disable-FEATURE do not include FEATURE (same as --enable-FEATURE=no) --enable-FEATURE[=ARG] include FEATURE [ARG=yes] + --enable-icd-shutup Enable peaceful compilation on travis with yes or no --disable-openmp do not use OpenMP - --enable-makevars keep ~/.R/Makevars contents in binary for debugging + --enable-icd-makevars keep ~/.R/Makevars contents in binary for debugging (default is no) + --enable-icd-strip Enable stripping of binary on Linux and MacOS Some influential environment variables: + ICD_SHUTUP "If ICD_SHUTUP is defined CXX C++ compiler command CXXFLAGS C++ compiler flags LDFLAGS linker flags, e.g. -L if you have libraries in a @@ -1354,7 +1361,7 @@ Copyright (C) 2012 Free Software Foundation, Inc. This configure script is free software; the Free Software Foundation gives unlimited permission to copy, distribute and modify it. -Copyright (C) 2014 - 2019 Jack O. Wasey +Copyright (C) 2014 - 2020 Jack O. Wasey _ACEOF exit fi @@ -1805,6 +1812,7 @@ ac_config_files="$ac_config_files src/Makevars" + : ${R_HOME=$(R RHOME)} { $as_echo "$as_me:${as_lineno-$LINENO}: checking R_HOME already set" >&5 $as_echo_n "checking R_HOME already set... " >&6; } @@ -1863,6 +1871,25 @@ CFLAGS=`"${R_BIN}" CMD config CFLAGS` CPPFLAGS=`"${R_BIN}" CMD config CPPFLAGS` LIBS="${PKG_LIBS}" +# try to shut up travis/r-hub builds with huge warning burden with default compiler settings (Eigen). Can't seem to do with MAKEFLAGS, or string of R CMD check --install-opts=..... + + +# Check whether --enable-icd_shutup was given. +if test "${enable_icd_shutup+set}" = set; then : + enableval=$enable_icd_shutup; { $as_echo "$as_me:${as_lineno-$LINENO}: icd shutup enabled, without arguments." >&5 +$as_echo "$as_me: icd shutup enabled, without arguments." >&6;} +else + { $as_echo "$as_me:${as_lineno-$LINENO}: icd shutup enabled, with arguments..." >&5 +$as_echo "$as_me: icd shutup enabled, with arguments..." >&6;} +fi + + +if test "x$enable_icd-shutup" = "xyes"; then : + + CXX11FLAGS="${CXX11FLAGS} -w" + +fi + # changes what R_OPENMP and rest of script does: ac_ext=cpp ac_cpp='$CXXCPP $CPPFLAGS' @@ -1873,7 +1900,7 @@ ac_compiler_gnu=$ac_cv_cxx_compiler_gnu # https://www.gnu.org/software/autoconf/manual/autoconf-2.67/html_node/Generic-Compiler-Characteristics.html -# this macro is borrowed from R-devel source, and included in the icd/tools/m4 directory +# this macro is borrowed from R-devel source, and included in the icd /inst/m4 directory ac_ext=cpp ac_cpp='$CXXCPP $CPPFLAGS' ac_compile='$CXX -c $CXXFLAGS $CPPFLAGS conftest.$ac_ext >&5' @@ -2458,9 +2485,9 @@ ac_pkg_openmp=no # AC_MSG_RESULT([Do have OPENMP_CFLAGS from R_OPENMP]) #fi if test -n "${OPENMP_CXXFLAGS}"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: checking OpenMP available, but does it work in a package" >&5 + { $as_echo "$as_me:${as_lineno-$LINENO}: checking OpenMP available, but does it work in a package" >&5 $as_echo_n "checking OpenMP available, but does it work in a package... " >&6; } - cat confdefs.h - <<_ACEOF >conftest.$ac_ext + cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include int @@ -2471,30 +2498,31 @@ main () return 0; } _ACEOF - PKG_CFLAGS="${OPENMP_CFLAGS}" PKG_LIBS="${OPENMP_CFLAGS}" "$R_BIN" CMD SHLIB conftest.c 1>&5 2>&5 && "$R_BIN" --vanilla -q -e "dyn.load(paste('conftest',.Platform\$dynlib.ext,sep=''))" 1>&5 2>&5 && ac_pkg_openmp=yes - { $as_echo "$as_me:${as_lineno-$LINENO}: result: OpenMP available and working: ${ac_pkg_openmp}" >&5 + PKG_CFLAGS="${OPENMP_CFLAGS}" PKG_LIBS="${OPENMP_CFLAGS}" "$R_BIN" CMD SHLIB conftest.c 1>&5 2>&5 && "$R_BIN" --vanilla -q -e "dyn.load(paste('conftest',.Platform\$dynlib.ext,sep=''))" 1>&5 2>&5 && ac_pkg_openmp=yes + { $as_echo "$as_me:${as_lineno-$LINENO}: result: OpenMP available and working: ${ac_pkg_openmp}" >&5 $as_echo "OpenMP available and working: ${ac_pkg_openmp}" >&6; } -else - { $as_echo "$as_me:${as_lineno-$LINENO}: result: R did not think OpenMP is available" >&5 + else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: R did not think OpenMP is available" >&5 $as_echo "R did not think OpenMP is available" >&6; } -fi + fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: icd thinks openmp compilation possible: ${ac_pkg_openmp}" >&5 + { $as_echo "$as_me:${as_lineno-$LINENO}: result: icd thinks openmp compilation possible: ${ac_pkg_openmp}" >&5 $as_echo "icd thinks openmp compilation possible: ${ac_pkg_openmp}" >&6; } -# if ${ac_pkg_openmp} = "yes" then we have OMP, otherwise it will be "no" -if test "${ac_pkg_openmp}" = no; then - ICD_OPENMP_FLAG='' -else - ICD_OPENMP_FLAG='$(SHLIB_OPENMP_CXXFLAGS)' -fi + # if ${ac_pkg_openmp} = "yes" then we have OMP, otherwise it will be "no" + if test "${ac_pkg_openmp}" = no; then + ICD_OPENMP_FLAG='' + else + ICD_OPENMP_FLAG='$(SHLIB_OPENMP_CXXFLAGS)' + fi + echo "unsigned char Makevars[] = { 0x00 };" > src/makevars.h -# Check whether --enable-makevars was given. -if test "${enable_makevars+set}" = set; then : - enableval=$enable_makevars; - if test "x$enable_makevars" = "xyes"; then : +# Check whether --enable-icd_makevars was given. +if test "${enable_icd_makevars+set}" = set; then : + enableval=$enable_icd_makevars; + if test "x$enable_icd_makevars" = "xyes"; then : { $as_echo "$as_me:${as_lineno-$LINENO}: Enabling Makevars inclusion for debugging" >&5 $as_echo "$as_me: Enabling Makevars inclusion for debugging" >&6;} @@ -2523,8 +2551,8 @@ $as_echo "no" >&6; } else - { $as_echo "$as_me:${as_lineno-$LINENO}: Not enabling Makevars inclusion due to --enable-makevars=!yes" >&5 -$as_echo "$as_me: Not enabling Makevars inclusion due to --enable-makevars=!yes" >&6;} + { $as_echo "$as_me:${as_lineno-$LINENO}: Not enabling Makevars inclusion due to --enable-icd-makevars=!yes" >&5 +$as_echo "$as_me: Not enabling Makevars inclusion due to --enable-icd-makevars=!yes" >&6;} fi @@ -2536,7 +2564,24 @@ $as_echo "$as_me: Not enabling Makevars inclusion" >&6;} fi -# put the flag in Makevars + +# Check whether --enable-icd_strip was given. +if test "${enable_icd_strip+set}" = set; then : + enableval=$enable_icd_strip; { $as_echo "$as_me:${as_lineno-$LINENO}: icd strip enable, without arguments." >&5 +$as_echo "$as_me: icd strip enable, without arguments." >&6;} +else + { $as_echo "$as_me:${as_lineno-$LINENO}: icd strip enabled, with arguments..." >&5 +$as_echo "$as_me: icd strip enabled, with arguments..." >&6;} +fi + + +if test "x$enable_icd_strip" != "xno"; then : + ICD_STRIP=tools/mk/strip.mk +else + ICD_STRIP='' +fi + + cat >confcache <<\_ACEOF # This file is a shell script that caches the results of configure @@ -3290,7 +3335,24 @@ ac_tmp=$tmp # This happens for instance with `./config.status config.h'. if test -n "$CONFIG_FILES"; then - +if $AWK 'BEGIN { getline <"/dev/null" }' /dev/null; then + ac_cs_awk_getline=: + ac_cs_awk_pipe_init= + ac_cs_awk_read_file=' + while ((getline aline < (F[key])) > 0) + print(aline) + close(F[key])' + ac_cs_awk_pipe_fini= +else + ac_cs_awk_getline=false + ac_cs_awk_pipe_init="print \"cat <<'|#_!!_#|' &&\"" + ac_cs_awk_read_file=' + print "|#_!!_#|" + print "cat " F[key] " &&" + '$ac_cs_awk_pipe_init + # The final `:' finishes the AND list. + ac_cs_awk_pipe_fini='END { print "|#_!!_#|"; print ":" }' +fi ac_cr=`echo X | tr X '\015'` # On cygwin, bash can eat \r inside `` if the user requested igncr. # But we know of no other shell where ac_cr would be empty at this @@ -3308,6 +3370,17 @@ fi echo 'BEGIN {' >"$ac_tmp/subs1.awk" && _ACEOF +# Create commands to substitute file output variables. +{ + echo "cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1" && + echo 'cat >>"\$ac_tmp/subs1.awk" <<\\_ACAWK &&' && + echo "$ac_subst_files" | sed 's/.*/F["&"]="$&"/' && + echo "_ACAWK" && + echo "_ACEOF" +} >conf$$files.sh && +. ./conf$$files.sh || + as_fn_error $? "could not make $CONFIG_STATUS" "$LINENO" 5 +rm -f conf$$files.sh { echo "cat >conf$$subs.awk <<_ACEOF" && @@ -3384,7 +3457,7 @@ _ACAWK cat >>"\$ac_tmp/subs1.awk" <<_ACAWK && for (key in S) S_is_set[key] = 1 FS = "" - + \$ac_cs_awk_pipe_init } { line = $ 0 @@ -3402,10 +3475,16 @@ cat >>"\$ac_tmp/subs1.awk" <<_ACAWK && } else len += 1 + keylen } - + if (nfields == 3 && !substed) { + key = field[2] + if (F[key] != "" && line ~ /^[ ]*@.*@[ ]*$/) { + \$ac_cs_awk_read_file + next + } + } print line } - +\$ac_cs_awk_pipe_fini _ACAWK _ACEOF cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 @@ -3633,7 +3712,12 @@ s&@abs_builddir@&$ac_abs_builddir&;t t s&@abs_top_builddir@&$ac_abs_top_builddir&;t t $ac_datarootdir_hack " -eval sed \"\$ac_sed_extra\" "$ac_file_inputs" | $AWK -f "$ac_tmp/subs.awk" \ +eval sed \"\$ac_sed_extra\" "$ac_file_inputs" | +if $ac_cs_awk_getline; then + $AWK -f "$ac_tmp/subs.awk" +else + $AWK -f "$ac_tmp/subs.awk" | $SHELL +fi \ >$ac_tmp/out || as_fn_error $? "could not create $ac_file" "$LINENO" 5 test -z "$ac_datarootdir_hack$ac_datarootdir_seen" && diff --git a/configure.ac b/configure.ac index 85ed70ce..11d55af5 100644 --- a/configure.ac +++ b/configure.ac @@ -1,4 +1,4 @@ -# Copyright (C) 2014 - 2018 Jack O. Wasey +# Copyright (C) 2014 - 2020 Jack O. Wasey # # This file is part of icd. # @@ -15,14 +15,19 @@ # You should have received a copy of the GNU General Public License # along with icd. If not, see . +# to regenerate quickly and test: +# # e..g. export ICD_HOME=~/icd +# autoreconf -fv && "${ICD_HOME:-.}/configure" --enable-icd-strip --enable-icd-shutup && cat "${ICD_HOME:-.}/src/Makevars" && grep -v -q '@' "${ICD_HOME:-.}/src/Makevars" || echo "MISSING REPLACEMENT" + AC_PREREQ([2.62]) AC_INIT(icd) -AC_COPYRIGHT(Copyright (C) 2014 - 2019 Jack O. Wasey) +AC_COPYRIGHT(Copyright (C) 2014 - 2020 Jack O. Wasey) AC_CONFIG_SRCDIR([src]) AC_CONFIG_FILES([src/Makevars]) AC_CONFIG_MACRO_DIR([m4]) AC_CONFIG_MACRO_DIR([inst/m4]) + : ${R_HOME=$(R RHOME)} AC_MSG_CHECKING([R_HOME already set]) if test -z "${R_HOME}"; then @@ -69,12 +74,24 @@ CFLAGS=`"${R_BIN}" CMD config CFLAGS` CPPFLAGS=`"${R_BIN}" CMD config CPPFLAGS` LIBS="${PKG_LIBS}" +# try to shut up travis/r-hub builds with huge warning burden with default compiler settings (Eigen). Can't seem to do with MAKEFLAGS, or string of R CMD check --install-opts=..... +AC_ARG_VAR(ICD_SHUTUP, "If ICD_SHUTUP is defined, it tells configure to silence all compiler warnings. Alternatively, use --enable-icd-shutup in configure") + +AC_ARG_ENABLE([icd_shutup], + [AS_HELP_STRING([--enable-icd-shutup], [Enable peaceful compilation on travis with yes or no])], + [AC_MSG_NOTICE([icd shutup enabled, without arguments.])], + [AC_MSG_NOTICE([icd shutup enabled, with arguments...])]) + +AS_IF([test "x$enable_icd-shutup" = "xyes"], [ + CXX11FLAGS="${CXX11FLAGS} -w" + ]) + # changes what R_OPENMP and rest of script does: AC_LANG(C++) # https://www.gnu.org/software/autoconf/manual/autoconf-2.67/html_node/Generic-Compiler-Characteristics.html -# this macro is borrowed from R-devel source, and included in the icd/tools/m4 directory +# this macro is borrowed from R-devel source, and included in the icd /inst/m4 directory R_OPENMP # since some systems have broken OMP libraries @@ -84,33 +101,34 @@ ac_pkg_openmp=no # AC_MSG_RESULT([Do have OPENMP_CFLAGS from R_OPENMP]) #fi if test -n "${OPENMP_CXXFLAGS}"; then - AC_MSG_CHECKING([OpenMP available, but does it work in a package]) - AC_LANG_CONFTEST( - [AC_LANG_PROGRAM([[#include ]], [[ omp_get_num_threads (); return 0; ]])]) - PKG_CFLAGS="${OPENMP_CFLAGS}" PKG_LIBS="${OPENMP_CFLAGS}" "$R_BIN" CMD SHLIB conftest.c 1>&AS_MESSAGE_LOG_FD 2>&AS_MESSAGE_LOG_FD && "$R_BIN" --vanilla -q -e "dyn.load(paste('conftest',.Platform\$dynlib.ext,sep=''))" 1>&AS_MESSAGE_LOG_FD 2>&AS_MESSAGE_LOG_FD && ac_pkg_openmp=yes - AC_MSG_RESULT([OpenMP available and working: ${ac_pkg_openmp}]) -else - AC_MSG_RESULT([R did not think OpenMP is available]) -fi + AC_MSG_CHECKING([OpenMP available, but does it work in a package]) + AC_LANG_CONFTEST( + [AC_LANG_PROGRAM([[#include ]], [[ omp_get_num_threads (); return 0; ]])]) + PKG_CFLAGS="${OPENMP_CFLAGS}" PKG_LIBS="${OPENMP_CFLAGS}" "$R_BIN" CMD SHLIB conftest.c 1>&AS_MESSAGE_LOG_FD 2>&AS_MESSAGE_LOG_FD && "$R_BIN" --vanilla -q -e "dyn.load(paste('conftest',.Platform\$dynlib.ext,sep=''))" 1>&AS_MESSAGE_LOG_FD 2>&AS_MESSAGE_LOG_FD && ac_pkg_openmp=yes + AC_MSG_RESULT([OpenMP available and working: ${ac_pkg_openmp}]) + else + AC_MSG_RESULT([R did not think OpenMP is available]) + fi -AC_MSG_RESULT([icd thinks openmp compilation possible: ${ac_pkg_openmp}]) + AC_MSG_RESULT([icd thinks openmp compilation possible: ${ac_pkg_openmp}]) -# if ${ac_pkg_openmp} = "yes" then we have OMP, otherwise it will be "no" -if test "${ac_pkg_openmp}" = no; then - ICD_OPENMP_FLAG='' -else - ICD_OPENMP_FLAG='$(SHLIB_OPENMP_CXXFLAGS)' -fi + # if ${ac_pkg_openmp} = "yes" then we have OMP, otherwise it will be "no" + if test "${ac_pkg_openmp}" = no; then + ICD_OPENMP_FLAG='' + else + ICD_OPENMP_FLAG='$(SHLIB_OPENMP_CXXFLAGS)' + fi +AC_SUBST(ICD_OPENMP_FLAG) dnl Always write the stub as default to not include Makevars content: echo "unsigned char Makevars[[]] = { 0x00 };" > src/makevars.h -AC_ARG_ENABLE([makevars], - AS_HELP_STRING([--enable-makevars], +AC_ARG_ENABLE([icd_makevars], + AS_HELP_STRING([--enable-icd-makevars], [keep ~/.R/Makevars contents in binary for debugging (default is no)]), [ dnl also check that user didn't write --enable-makevars=no - AS_IF([test "x$enable_makevars" = "xyes"], + AS_IF([test "x$enable_icd_makevars" = "xyes"], [ AC_MSG_NOTICE([Enabling Makevars inclusion for debugging]) AC_MSG_CHECKING([$HOME/.R exists]) @@ -130,13 +148,21 @@ AC_ARG_ENABLE([makevars], AC_MSG_RESULT([no]) fi ], [ - AC_MSG_NOTICE([Not enabling Makevars inclusion due to --enable-makevars=!yes]) + AC_MSG_NOTICE([Not enabling Makevars inclusion due to --enable-icd-makevars=!yes]) ]) ], [ AC_MSG_NOTICE([Not enabling Makevars inclusion]) ] ) -# put the flag in Makevars -AC_SUBST(ICD_OPENMP_FLAG) + +AC_ARG_ENABLE([icd_strip], + [AS_HELP_STRING([--enable-icd-strip], [Enable stripping of binary on Linux and MacOS])], + [AC_MSG_NOTICE([icd strip enable, without arguments.])], + [AC_MSG_NOTICE([icd strip enabled, with arguments...])]) + +AS_IF([test "x$enable_icd_strip" != "xno"], [ICD_STRIP=[tools/mk/strip.mk]], [ICD_STRIP='']) +AC_SUBST_FILE([ICD_STRIP]) + +AC_SUBST(ICD_SHUTUP) AC_OUTPUT diff --git a/man/get_icd10cm2019_pc.Rd b/man/get_icd10cm2019_pc.Rd index 018cb7cc..75c16c3c 100644 --- a/man/get_icd10cm2019_pc.Rd +++ b/man/get_icd10cm2019_pc.Rd @@ -4,10 +4,12 @@ \name{get_icd10cm2019_pc} \alias{get_icd10cm2019_pc} \title{ICD-10-CM Procedure Codes} -\format{A named list of data frames. The elements of the list are named by +\format{ +A named list of data frames. The elements of the list are named by the year, e.g., \code{"2018"}. Each data frame contains two character columns, the first, named \code{code} is the procedure code; the second, - named \code{desc}, has the description.} + named \code{desc}, has the description. +} \description{ ICD-10-PCS is the annually-updated set of procedure codes designed by 3M for the US CMS. There is no directory of WHO ICD procedure codes. diff --git a/man/get_icd9cm2014_leaf.Rd b/man/get_icd9cm2014_leaf.Rd index c7481151..6fe00999 100644 --- a/man/get_icd9cm2014_leaf.Rd +++ b/man/get_icd9cm2014_leaf.Rd @@ -14,8 +14,10 @@ \alias{get_icd9cm2013_leaf} \alias{get_icd9cm2005_leaf} \title{ICD-9-CM, just billable/leaf codes} -\format{data frames with columns \code{code}, \code{short_desc}, and - \code{long_desc}.} +\format{ +data frames with columns \code{code}, \code{short_desc}, and + \code{long_desc}. +} \source{ \url{http://www.cms.gov/Medicare/Coding/ICD9ProviderDiagnosticCodes/codes.html} } diff --git a/man/icd9_map_ahrq.Rd b/man/icd9_map_ahrq.Rd index 374ff1b7..ae1cf2e4 100644 --- a/man/icd9_map_ahrq.Rd +++ b/man/icd9_map_ahrq.Rd @@ -6,7 +6,9 @@ \alias{ahrq} \alias{icd10_map_ahrq} \title{AHRQ comorbidities} -\format{list of character vectors} +\format{ +list of character vectors +} \source{ \url{http://www.hcup-us.ahrq.gov/toolssoftware/comorbidity/comorbidity.jsp} \url{http://www.hcup-us.ahrq.gov/toolssoftware/comorbidityicd10/comorbidity_icd10.jsp} diff --git a/man/icd9_map_elix.Rd b/man/icd9_map_elix.Rd index 50371051..546a52fd 100644 --- a/man/icd9_map_elix.Rd +++ b/man/icd9_map_elix.Rd @@ -5,7 +5,9 @@ \alias{icd9_map_elix} \alias{icd10_map_elix} \title{Elixhauser comorbidities} -\format{list of character vectors, each named by co-morbidity} +\format{ +list of character vectors, each named by co-morbidity +} \description{ This data comprises the original mapping of Elixhauser's ICD-9-CM to 30 comorbidities. According to Sharabiani, this mapping provides the diff --git a/man/icd9_map_hcc.Rd b/man/icd9_map_hcc.Rd index 148b4820..a532edc2 100644 --- a/man/icd9_map_hcc.Rd +++ b/man/icd9_map_hcc.Rd @@ -7,8 +7,10 @@ \alias{icd10_map_cc} \alias{icd_map_cc_hcc} \title{Medicare Hierarchical Condition Categories} -\format{\code{dataframe} with 3 columns (\code{icd_code}, \code{cc}, - and \code{year})} +\format{ +\code{dataframe} with 3 columns (\code{icd_code}, \code{cc}, + and \code{year}) +} \description{ Medicare HCC model was developed to use current year diagnoses and demographics predict current year healthcare expenditure. This diff --git a/man/icd9_map_quan_deyo.Rd b/man/icd9_map_quan_deyo.Rd index 65d461fe..3bf0337a 100644 --- a/man/icd9_map_quan_deyo.Rd +++ b/man/icd9_map_quan_deyo.Rd @@ -7,7 +7,9 @@ \alias{icd9_map_charlson} \alias{icd10_map_charlson} \title{Quan adaptation of Deyo/Charlson comorbidities} -\format{list of character vectors, each named by co-morbidity} +\format{ +list of character vectors, each named by co-morbidity +} \description{ Derived automatically from the SAS code used in the original publication. According to the referenced study, this provides the diff --git a/man/icd9_map_quan_elix.Rd b/man/icd9_map_quan_elix.Rd index 80a7db15..d3450aad 100644 --- a/man/icd9_map_quan_elix.Rd +++ b/man/icd9_map_quan_elix.Rd @@ -5,7 +5,9 @@ \alias{icd9_map_quan_elix} \alias{icd10_map_quan_elix} \title{Quan adaptation of Elixhauser comorbidities} -\format{list of character vectors, each named by co-morbidity} +\format{ +list of character vectors, each named by co-morbidity +} \description{ These were transcribed directly from the Quan paper referenced. } diff --git a/man/icd9_map_single_ccs.Rd b/man/icd9_map_single_ccs.Rd index 94716fdd..43a1b900 100644 --- a/man/icd9_map_single_ccs.Rd +++ b/man/icd9_map_single_ccs.Rd @@ -6,7 +6,9 @@ \alias{icd9_map_multi_ccs} \alias{icd10_map_ccs} \title{Clinical Classifications Software (CCS) for ICD9/10-CM} -\format{list of character vectors, each numbered by co-morbidity} +\format{ +list of character vectors, each numbered by co-morbidity +} \description{ The Clinical Classifications Software (CCS) for ICD-9/10-CM is one in a family of databases and software tools developed as part of the diff --git a/man/names_elix.Rd b/man/names_elix.Rd index 5f475cfb..40d27b9b 100644 --- a/man/names_elix.Rd +++ b/man/names_elix.Rd @@ -38,11 +38,13 @@ \alias{names_pccc} \alias{names_pccc_abbrev} \title{Comorbidity names} -\format{list, with character/numeric code. 'Hypertension, +\format{ +list, with character/numeric code. 'Hypertension, uncomplicated' and 'Hypertension, complicated' are labelled '6a' and '6b'. Diabetes, cancer, and metastasis are counted independently, as in the original paper, giving the original 30 - groups. "01" to "30"} + groups. "01" to "30" +} \description{ These lists provide correctly sorted names of the comorbidities and their particular permutations in both full and abbreviated forms. diff --git a/man/poa_choices.Rd b/man/poa_choices.Rd index 05f2ae25..b1f26b2d 100644 --- a/man/poa_choices.Rd +++ b/man/poa_choices.Rd @@ -4,7 +4,9 @@ \name{poa_choices} \alias{poa_choices} \title{Present-on-admission flags} -\format{An object of class \code{character} of length 4.} +\format{ +An object of class \code{character} of length 4. +} \usage{ poa_choices } diff --git a/src/Makevars.in b/src/Makevars.in index ca5fa8e4..4a9404b0 100644 --- a/src/Makevars.in +++ b/src/Makevars.in @@ -1,16 +1,4 @@ CXX_STD=CXX11 - -#PKG_CXXFLAGS=-DEIGEN_PERMANENTLY_DISABLE_STUPID_WARNINGS $(SHLIB_OPENMP_CXXFLAGS) -#PKG_LIBS=$(SHLIB_OPENMP_CXXFLAGS) - -PKG_CXXFLAGS=@ICD_OPENMP_FLAG@ -DEIGEN_PERMANENTLY_DISABLE_STUPID_WARNINGS +PKG_CXXFLAGS=@ICD_OPENMP_FLAG@ -DEIGEN_PERMANENTLY_DISABLE_STUPID_WARNINGS @ICD_SHUTUP@ PKG_LIBS=@ICD_OPENMP_FLAG@ - -# size is about 10% of unstripped on Linux, about 90% on Mac. CRAN Windows DLL is already small. -# -# Don't forget to comment out for debugging... and CRAN? -# -#strippedLib: $(SHLIB) -# if test -e "/usr/bin/strip" & test -e "/bin/uname" & [[ `uname` == "Linux" || `uname` == "Darwin" ]] ; \ -# then /usr/bin/strip -S $(SHLIB); fi -#.phony: strippedLib +@ICD_STRIP@ diff --git a/tools/env/cran b/tools/env/cran new file mode 100755 index 00000000..7a1c4a18 --- /dev/null +++ b/tools/env/cran @@ -0,0 +1,13 @@ +#!/usr/bin/env bash +#the goal here is to just go with the defaults from --as-cran for the active R release +#shellcheck disable=SC2034 +ICD_TEST_SLOW=FALSE +MAKEFLAGS=-j$(getconf _NPROCESSORS_ONLN) +_R_CHECK_COMPILATION_FLAGS_=FALSE +_R_CHECK_CRAN_INCOMING_=FALSE +_R_CHECK_CRAN_INCOMING_REMOTE_=FALSE +_R_CHECK_LENGTH_1_CONDITION_="verbose,abort" +_R_CHECK_LENGTH_1_LOGIC2_="verbose,abort" +_R_CHECK_NO_STOP_ON_TEST_ERROR_=FALSE +_R_CHECK_PKG_SIZES_=FALSE +_R_CHECK_USE_INSTALL_LOG_=TRUE diff --git a/tools/env/full b/tools/env/full new file mode 100755 index 00000000..ac99d9db --- /dev/null +++ b/tools/env/full @@ -0,0 +1,23 @@ +#!/usr/bin/env bash +#shellcheck disable=SC2034 +ICD_TEST_SLOW=TRUE +MAKEFLAGS=-j$(getconf _NPROCESSORS_ONLN) +_R_CHECK_ALL_NON_ISO_C_=TRUE +_R_CHECK_ALWAYS_LOG_VIGNETTE_OUTPUT_=TRUE +_R_CHECK_CODETOOLS_PROFILE_="suppressLocalUnused=FALSE" +_R_CHECK_CODE_ASSIGN_TO_GLOBALENV_=TRUE +_R_CHECK_COMPILATION_FLAGS_=FALSE +_R_CHECK_CRAN_INCOMING_=FALSE +_R_CHECK_CRAN_INCOMING_REMOTE_=FALSE +_R_CHECK_EXIT_ON_FIRST_ERROR_=TRUE +_R_CHECK_LENGTH_1_CONDITION_="verbose,abort" +_R_CHECK_LENGTH_1_LOGIC2_="verbose,abort" +_R_CHECK_NATIVE_ROUTINE_REGISTRATION_=TRUE +_R_CHECK_NO_STOP_ON_TEST_ERROR_=TRUE +_R_CHECK_PKG_SIZES_=FALSE +_R_CHECK_PKG_SIZES_=FALSE +_R_CHECK_RD_EXAMPLES_T_AND_F_=TRUE +_R_CHECK_RD_LINE_WIDTHS_=TRUE +_R_CHECK_TESTS_NLINES_=0 +_R_CHECK_USE_INSTALL_LOG_=TRUE +_R_CHECK_VIGNETTES_NLINES_=0 diff --git a/tools/env/jit b/tools/env/jit new file mode 100755 index 00000000..c2b9f91b --- /dev/null +++ b/tools/env/jit @@ -0,0 +1,46 @@ +#!/usr/bin/env bash +#shellcheck disable=SC2034 +ICD_TEST_SLOW=TRUE +MAKEFLAGS=-j$(getconf _NPROCESSORS_ONLN) +R_CHECK_CONSTANTS=5 +R_JIT_STRATEGY=3 +_R_CHECK_ALL_NON_ISO_C_=TRUE +_R_CHECK_ALWAYS_LOG_VIGNETTE_OUTPUT_=TRUE +_R_CHECK_CODETOOLS_PROFILE_="suppressLocalUnused=FALSE" +_R_CHECK_CODE_ASSIGN_TO_GLOBALENV_=TRUE +_R_CHECK_CODE_ATTACH_=TRUE +_R_CHECK_CODE_DATA_INTO_GLOBALENV_=TRUE +_R_CHECK_CODE_USAGE_VIA_NAMESPACES_=TRUE +_R_CHECK_COMPACT_DATA_=TRUE +_R_CHECK_COMPILATION_FLAGS_=FALSE +_R_CHECK_CRAN_INCOMING_=FALSE +_R_CHECK_CRAN_INCOMING_REMOTE_=FALSE +_R_CHECK_DEPRECATED_DEFUNCT_=TRUE +_R_CHECK_DOC_SIZES2_=TRUE +_R_CHECK_DOT_FIRSTLIB_=TRUE +_R_CHECK_EXECUTABLES_EXCLUSIONS_=FALSE +_R_CHECK_EXIT_ON_FIRST_ERROR_=FALSE +_R_CHECK_INSTALL_DEPENDS_=TRUE +_R_CHECK_LENGTH_1_CONDITION_="verbose,abort" +_R_CHECK_LENGTH_1_LOGIC2_="verbose,abort" +_R_CHECK_NATIVE_ROUTINE_REGISTRATION_=TRUE +_R_CHECK_NO_RECOMMENDED_=TRUE +_R_CHECK_NO_STOP_ON_TEST_ERROR_=TRUE +_R_CHECK_OVERWRITE_REGISTERED_S3_METHODS_=TRUE +_R_CHECK_PKG_SIZES_=FALSE +_R_CHECK_PRAGMAS_=TRUE +_R_CHECK_RD_EXAMPLES_T_AND_F_=TRUE +_R_CHECK_RD_LINE_WIDTHS_=TRUE +_R_CHECK_REPLACING_IMPORTS_=TRUE +_R_CHECK_R_DEPENDS_=warn +_R_CHECK_R_ON_PATH_=TRUE +_R_CHECK_S3_METHODS_NOT_REGISTERED_=TRUE +_R_CHECK_SCREEN_DEVICE_=stop +_R_CHECK_SERIALIZATION_=TRUE +_R_CHECK_SUGGESTS_ONLY_=TRUE +_R_CHECK_TESTS_NLINES_=0 +_R_CHECK_TIMINGS_=0 +_R_CHECK_TOPLEVEL_FILES_=TRUE +_R_CHECK_USE_INSTALL_LOG_=FALSE +_R_CHECK_VC_DIRS_=TRUE +_R_CHECK_VIGNETTES_NLINES_=0 diff --git a/tools/env/plus b/tools/env/plus new file mode 100755 index 00000000..2b0fb58b --- /dev/null +++ b/tools/env/plus @@ -0,0 +1,44 @@ +#!/usr/bin/env bash +#shellcheck disable=SC2034 +ICD_TEST_SLOW=TRUE +MAKEFLAGS=-j$(getconf _NPROCESSORS_ONLN) +_R_CHECK_ALL_NON_ISO_C_=TRUE +_R_CHECK_ALWAYS_LOG_VIGNETTE_OUTPUT_=TRUE +_R_CHECK_CODETOOLS_PROFILE_="suppressLocalUnused=FALSE" +_R_CHECK_CODE_ASSIGN_TO_GLOBALENV_=TRUE +_R_CHECK_CODE_ATTACH_=TRUE +_R_CHECK_CODE_DATA_INTO_GLOBALENV_=TRUE +_R_CHECK_CODE_USAGE_VIA_NAMESPACES_=TRUE +_R_CHECK_COMPACT_DATA_=TRUE +_R_CHECK_COMPILATION_FLAGS_=FALSE +_R_CHECK_CRAN_INCOMING_=FALSE +_R_CHECK_CRAN_INCOMING_REMOTE_=FALSE +_R_CHECK_DEPRECATED_DEFUNCT_=TRUE +_R_CHECK_DOC_SIZES2_=TRUE +_R_CHECK_DOT_FIRSTLIB_=TRUE +_R_CHECK_EXECUTABLES_EXCLUSIONS_=TRUE +_R_CHECK_EXIT_ON_FIRST_ERROR_=FALSE +_R_CHECK_INSTALL_DEPENDS_=TRUE +_R_CHECK_LENGTH_1_CONDITION_="verbose,abort" +_R_CHECK_LENGTH_1_LOGIC2_="verbose,abort" +_R_CHECK_NATIVE_ROUTINE_REGISTRATION_=TRUE +_R_CHECK_NO_RECOMMENDED_=TRUE +_R_CHECK_NO_STOP_ON_TEST_ERROR_=TRUE +_R_CHECK_OVERWRITE_REGISTERED_S3_METHODS_=TRUE +_R_CHECK_PKG_SIZES_=FALSE +_R_CHECK_PRAGMAS_=TRUE +_R_CHECK_RD_EXAMPLES_T_AND_F_=TRUE +_R_CHECK_RD_LINE_WIDTHS_=TRUE +_R_CHECK_REPLACING_IMPORTS_=TRUE +_R_CHECK_R_DEPENDS_=warn +_R_CHECK_R_ON_PATH_=TRUE +_R_CHECK_S3_METHODS_NOT_REGISTERED_=TRUE +_R_CHECK_SCREEN_DEVICE_=stop +_R_CHECK_SERIALIZATION_=TRUE +_R_CHECK_SUGGESTS_ONLY_=TRUE +_R_CHECK_TESTS_NLINES_=0 +_R_CHECK_TIMINGS_=0 +_R_CHECK_TOPLEVEL_FILES_=TRUE +_R_CHECK_USE_INSTALL_LOG_=FALSE +_R_CHECK_VC_DIRS_=TRUE +_R_CHECK_VIGNETTES_NLINES_=0 diff --git a/tools/env/quick b/tools/env/quick new file mode 100755 index 00000000..a12024f1 --- /dev/null +++ b/tools/env/quick @@ -0,0 +1,33 @@ +#!/usr/bin/env bash +#R_MAKEVARS_USER=${ICD_HOME}/tools/Makevars.quick +#shellcheck disable=SC2034 +ICD_TEST_SLOW=FALSE +MAKEFLAGS=-j$(getconf _NPROCESSORS_ONLN) +_R_CHECK_ALL_NON_ISO_C_=TRUE +_R_CHECK_CODETOOLS_PROFILE_="suppressLocalUnused=FALSE" +_R_CHECK_CODE_ASSIGN_TO_GLOBALENV_=TRUE +_R_CHECK_CODE_ATTACH_=FALSE +_R_CHECK_CODE_DATA_INTO_GLOBALENV_=TRUE +_R_CHECK_CODE_USAGE_VIA_NAMESPACES_=TRUE +_R_CHECK_COMPACT_DATA_=FALSE +_R_CHECK_COMPILATION_FLAGS_=FALSE +_R_CHECK_CRAN_INCOMING_=FALSE +_R_CHECK_CRAN_INCOMING_REMOTE_=FALSE +_R_CHECK_DEPRECATED_DEFUNCT_=FALSE +_R_CHECK_DOC_SIZES2_=FALSE +_R_CHECK_DOT_FIRSTLIB_=FALSE +_R_CHECK_EXECUTABLES_EXCLUSIONS_=FALSE +_R_CHECK_EXIT_ON_FIRST_ERROR_=TRUE +_R_CHECK_INSTALL_DEPENDS_=FALSE +_R_CHECK_LENGTH_1_CONDITION_="verbose,abort" +_R_CHECK_LENGTH_1_LOGIC2_="verbose,abort" +_R_CHECK_NATIVE_ROUTINE_REGISTRATION_=TRUE +_R_CHECK_NO_RECOMMENDED_=FALSE +_R_CHECK_NO_STOP_ON_TEST_ERROR_=FALSE +_R_CHECK_OVERWRITE_REGISTERED_S3_METHODS_=FALSE +_R_CHECK_PKG_SIZES_=FALSE +_R_CHECK_RD_EXAMPLES_T_AND_F_=TRUE +_R_CHECK_RD_LINE_WIDTHS_=TRUE +_R_CHECK_TESTS_NLINES_=0 +_R_CHECK_USE_INSTALL_LOG_=FALSE +_R_CHECK_VIGNETTES_NLINES_=0 diff --git a/tools/env/rhub b/tools/env/rhub new file mode 100644 index 00000000..dc477586 --- /dev/null +++ b/tools/env/rhub @@ -0,0 +1,3 @@ +_R_CHECK_DOC_SIZES_=FALSE +_R_CHECK_DOC_SIZES2_=FALSE +MAKEFLAGS="CXXFLAGS=-Wno-unused-parameter\\ -Wno-unused-variable\\ -Wno-ignored-attributes\\ -Wno-cast-function-type\\ -Wno-unknown-warning-option\\ -Wno-unknown-pragma" diff --git a/tools/env/rhub-san b/tools/env/rhub-san new file mode 100644 index 00000000..96dd1e23 --- /dev/null +++ b/tools/env/rhub-san @@ -0,0 +1,21 @@ +CXX=g++ -std=c++11 +CXX11=g++ -std=c++11 +MAKEFLAGS = "CXX11FLAGS+=-std=c++11\\ -Wno-ignored-attributes CXXFLAGS+=-std=c++11\\ -Wno-ignored-attributes") +GNUMAKEFLAGS = "CXX11FLAGS+=-std=c++11\\ -Wno-ignored-attributes CXXFLAGS+=-std=c++11\\ -Wno-ignored-attributes") +ICD_TEST_SLOW=TRUE +_R_CHECK_COMPACT_DATA_=FALSE +_R_CHECK_COMPILATION_FLAGS_=FALSE +_R_CHECK_CRAN_INCOMING_=FALSE +_R_CHECK_CRAN_INCOMING_REMOTE_=FALSE +_R_CHECK_DEPRECATED_DEFUNCT_=FALSE +_R_CHECK_DOC_SIZES2_=FALSE +_R_CHECK_DOC_SIZES_=FALSE +_R_CHECK_DOT_FIRSTLIB_=FALSE +_R_CHECK_EXECUTABLES_EXCLUSIONS_=FALSE +_R_CHECK_EXIT_ON_FIRST_ERROR_=FALSE +_R_CHECK_INSTALL_DEPENDS_=FALSE +_R_CHECK_NO_RECOMMENDED_=FALSE +_R_CHECK_NO_STOP_ON_TEST_ERROR_=FALSE +_R_CHECK_OVERWRITE_REGISTERED_S3_METHODS_=FALSE +_R_CHECK_PKG_SIZES_=FALSE +_R_CHECK_S3_METHODS_NOT_REGISTERED_=TRUE diff --git a/tools/env/travis-global b/tools/env/travis-global new file mode 100644 index 00000000..cb126bae --- /dev/null +++ b/tools/env/travis-global @@ -0,0 +1,37 @@ +_R_CHECK_CRAN_INCOMING_=FALSE +_R_CHECK_CRAN_INCOMING_REMOTE_=FALSE +_R_CHECK_FORCE_SUGGESTS_=FALSE +_R_CHECK_USE_INSTALL_LOG_=TRUE +_R_CHECK_LENGTH_1_CONDITION_="verbose,abort" +_R_CHECK_LENGTH_1_LOGIC2_="verbose,abort" +_R_CHECK_NO_STOP_ON_TEST_ERROR_=FALSE + +# some/all of the following are ignored if --as-cran is set, so not using --as-cran, and setting env directly. +_R_CHECK_COMPILATION_FLAGS_=FALSE +_R_CHECK_COMPILATION_FLAGS_KNOWN_="-Wno-unused-parameter -Wno-unused-variable -Wno-ignored-attributes -Wno-cast-function-type -Wno-unknown-warning-option -Wno-unknown-pragmas -Qunused-arguments" + +# the following are to simulate cran, and +# help debugging if we didn't use --as-cran +_R_CHECK_ALL_NON_ISO_C_=TRUE +_R_CHECK_ALWAYS_LOG_VIGNETTE_OUTPUT_=TRUE +_R_CHECK_CODE_ASSIGN_TO_GLOBALENV_=TRUE +_R_CHECK_CODETOOLS_PROFILE_="suppressLocalUnused=FALSE" +_R_CHECK_DOC_SIZES_=FALSE +_R_CHECK_DOC_SIZES2_=FALSE +_R_CHECK_EXIT_ON_FIRST_ERROR_=FALSE +_R_CHECK_NATIVE_ROUTINE_REGISTRATION_=TRUE +_R_CHECK_NO_STOP_ON_TEST_ERROR_=TRUE +_R_CHECK_RD_EXAMPLES_T_AND_F_=TRUE +_R_CHECK_RD_LINE_WIDTHS_=true +_R_CHECK_TESTS_NLINES_=0 +_R_CHECK_USE_INSTALL_LOG_=TRUE +_R_CHECK_VIGNETTES_NLINES_=0 +_R_CHECK_PKG_SIZES_THRESHOLD_=50 +ICD_COVERAGE=false +ICD_MINI_BENCH=false +ICD_DATA_VERBOSE=true +ICD_DATA_OFFLINE=true +ICD_DATA_INTERACT=false + +# 4 is the official travis suggestion, the docker images have two cores, presumably four threads. +OMP_NUM_THREADS=4 diff --git a/tools/mk/strip.mk b/tools/mk/strip.mk new file mode 100644 index 00000000..d15e17db --- /dev/null +++ b/tools/mk/strip.mk @@ -0,0 +1,12 @@ +#!/usr/bin/env make +#Enable using configure --enable-icd-strip +#With binary stripping, size is about 10% on Linux, 90% on Mac. CRAN Windows DLL is already small. +strippedLib: $(SHLIB) + # so clumsy, but unambiguous, avoids weird multi level make vs bash escaping + command -v strip >/dev/null && \ + command -v uname >/dev/null && \ + [ x$(uname -s) = xLinux ] && strip -S $(SHLIB) || true + command -v strip >/dev/null && \ + command -v uname >/dev/null && \ + [ x$(uname -s) = xDarwin ] && strip -S $(SHLIB) || true +.phony: strippedLib diff --git a/tools/mk/travis-debug.mk b/tools/mk/travis-debug.mk new file mode 100644 index 00000000..23931e9d --- /dev/null +++ b/tools/mk/travis-debug.mk @@ -0,0 +1,8 @@ +#!/usr/bin/env make + +CFLAGS+=-O0 +CXXFLAGS+=-O0 +CXX11FLAGS+=-O0 +CXX14FLAGS+=-O0 +CXX17FLAGS+=-O0 +CXX20FLAGS+=-O0 diff --git a/tools/mk/travis-macos.mk b/tools/mk/travis-macos.mk new file mode 100644 index 00000000..f2fa7078 --- /dev/null +++ b/tools/mk/travis-macos.mk @@ -0,0 +1,9 @@ +#!/usr/bin/env make + +# belt and braces +CC+=/usr/local/bin/gcc-9 +CXX+=/usr/local/bin/g++-9 +CXX11+=/usr/local/bin/g++-9 +CXX14+=/usr/local/bin/g++-9 +CXX17+=/usr/local/bin/g++-9 +CXX20+=/usr/local/bin/g++-9 diff --git a/tools/mk/travis-nowarn.mk b/tools/mk/travis-nowarn.mk new file mode 100644 index 00000000..9a7a962e --- /dev/null +++ b/tools/mk/travis-nowarn.mk @@ -0,0 +1,8 @@ +#!/usr/bin/env make + +# belt and braces - should just need CXXFLAGS +CXXFLAGS+=-Wno-unknown-warning-option -Wno-unused-parameter -Wno-unused-variable -Wno-ignored-attributes -Wno-cast-function-type -Wno-unknown-pragmas +CXX11FLAGS+=-Wno-unknown-warning-option -Wno-unused-parameter -Wno-unused-variable -Wno-ignored-attributes -Wno-cast-function-type -Wno-unknown-warning-option -Wno-unknown-pragmas +CXX14FLAGS+=-Wno-unknown-warning-option -Wno-unused-parameter -Wno-unused-variable -Wno-ignored-attributes -Wno-cast-function-type -Wno-unknown-warning-option -Wno-unknown-pragmas +CXX17FLAGS+=-Wno-unknown-warning-option -Wno-unused-parameter -Wno-unused-variable -Wno-ignored-attributes -Wno-cast-function-type -Wno-unknown-warning-option -Wno-unknown-pragmas +CXX20FLAGS+=-Wno-unknown-warning-option -Wno-unused-parameter -Wno-unused-variable -Wno-ignored-attributes -Wno-cast-function-type -Wno-unknown-warning-option -Wno-unknown-pragmas From 00e04b891c15c3777ae676ba503a3308befbda63 Mon Sep 17 00:00:00 2001 From: Patrick Date: Sat, 28 Mar 2020 18:41:39 -0400 Subject: [PATCH 45/51] fix conflict --- .travis.yml | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/.travis.yml b/.travis.yml index bf26bee5..ab6816d6 100644 --- a/.travis.yml +++ b/.travis.yml @@ -24,10 +24,9 @@ cache: - packages - ccache -addons: - apt: - packages: - - qpdf +#addons: +# apt: +# packages: # - valgrind # when I do do this (probably too slow for travis anyway, then just put the apt addon in the specific build) #- r-cran-tinytex From 71c1cd7a133b91b8de721c8324900f2a275da2b1 Mon Sep 17 00:00:00 2001 From: Patrick Date: Sat, 28 Mar 2020 18:43:02 -0400 Subject: [PATCH 46/51] resolve conflict --- .travis.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.travis.yml b/.travis.yml index ab6816d6..338c5f37 100644 --- a/.travis.yml +++ b/.travis.yml @@ -26,7 +26,7 @@ cache: #addons: # apt: -# packages: +# packages: # - valgrind # when I do do this (probably too slow for travis anyway, then just put the apt addon in the specific build) #- r-cran-tinytex From 70167219abc39cc1d5ff120b10386feb1f3f4da8 Mon Sep 17 00:00:00 2001 From: Patrick Date: Sat, 28 Mar 2020 18:55:25 -0400 Subject: [PATCH 47/51] add qpdf to packages --- .travis.yml | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/.travis.yml b/.travis.yml index 338c5f37..bf26bee5 100644 --- a/.travis.yml +++ b/.travis.yml @@ -24,9 +24,10 @@ cache: - packages - ccache -#addons: -# apt: -# packages: +addons: + apt: + packages: + - qpdf # - valgrind # when I do do this (probably too slow for travis anyway, then just put the apt addon in the specific build) #- r-cran-tinytex From 24cb44d9cb75d17c6e22248c8b9156c94aac8c57 Mon Sep 17 00:00:00 2001 From: Patrick Date: Sat, 28 Mar 2020 18:56:35 -0400 Subject: [PATCH 48/51] fix conflict --- .travis.yml | 3 +++ 1 file changed, 3 insertions(+) diff --git a/.travis.yml b/.travis.yml index bf26bee5..8630abe0 100644 --- a/.travis.yml +++ b/.travis.yml @@ -28,6 +28,9 @@ addons: apt: packages: - qpdf +#addons: +# apt: +# packages: # - valgrind # when I do do this (probably too slow for travis anyway, then just put the apt addon in the specific build) #- r-cran-tinytex From 1df316c69573f97e4cc5cd2ac2faa0d05273c563 Mon Sep 17 00:00:00 2001 From: Patrick Date: Sat, 28 Mar 2020 18:57:23 -0400 Subject: [PATCH 49/51] fix conflict --- .travis.yml | 4 ---- 1 file changed, 4 deletions(-) diff --git a/.travis.yml b/.travis.yml index 8630abe0..338c5f37 100644 --- a/.travis.yml +++ b/.travis.yml @@ -24,10 +24,6 @@ cache: - packages - ccache -addons: - apt: - packages: - - qpdf #addons: # apt: # packages: From 570acbde94737e2b1670954678cd0f2add05a027 Mon Sep 17 00:00:00 2001 From: Patrick Date: Sat, 28 Mar 2020 18:58:34 -0400 Subject: [PATCH 50/51] add qpdf --- .travis.yml | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/.travis.yml b/.travis.yml index 338c5f37..19a2c82c 100644 --- a/.travis.yml +++ b/.travis.yml @@ -33,6 +33,12 @@ cache: #r_packages: # - tinytex +# git conflict if I modify above lines +addons: + apt: + packages: + - qpdf + cran: https://cloud.r-project.org # by default, DON'T do --as-cran, as it stops us using environment variables # that conflict. Instead, state approximate CRAN check environment variables explicitly. From eb82ba543e9bf377d2b8b05fb45407c9413f82d5 Mon Sep 17 00:00:00 2001 From: Patrick Date: Sun, 29 Mar 2020 17:46:13 -0400 Subject: [PATCH 51/51] set R_QPDF --- .travis.yml | 10 ++++------ tools/env/travis-global | 1 + 2 files changed, 5 insertions(+), 6 deletions(-) diff --git a/.travis.yml b/.travis.yml index 19a2c82c..a13ce8c2 100644 --- a/.travis.yml +++ b/.travis.yml @@ -33,12 +33,6 @@ cache: #r_packages: # - tinytex -# git conflict if I modify above lines -addons: - apt: - packages: - - qpdf - cran: https://cloud.r-project.org # by default, DON'T do --as-cran, as it stops us using environment variables # that conflict. Instead, state approximate CRAN check environment variables explicitly. @@ -183,6 +177,10 @@ before_script: - set -o allexport; source tools/env/travis-global; set +o allexport; - set - echo "$LD_LIBRARY_PATH" +# qpdf debugging start + - which qpdf || true + - which gs || true +# qpdf debugging end - if [ x"$ICD_TEST_SLOW" = x"true" ]; then Rscript -e 'source("tools/split-tests.R"); testthat_split();'; fi diff --git a/tools/env/travis-global b/tools/env/travis-global index cb126bae..4beb8a94 100644 --- a/tools/env/travis-global +++ b/tools/env/travis-global @@ -27,6 +27,7 @@ _R_CHECK_TESTS_NLINES_=0 _R_CHECK_USE_INSTALL_LOG_=TRUE _R_CHECK_VIGNETTES_NLINES_=0 _R_CHECK_PKG_SIZES_THRESHOLD_=50 +R_QPDF= ICD_COVERAGE=false ICD_MINI_BENCH=false ICD_DATA_VERBOSE=true