dajuntian / InjurySeverityScore

Translate ICD-9 to Injury Severity Score
1 stars 0 forks source link

dplyr 0.8.1 #1

Open romainfrancois opened 5 years ago

romainfrancois commented 5 years ago

As part of performing reverse dependency checks for dplyr 0.8.1, soon to be released, I'm getting this error:

[master*] 408.5 MiB ❯ revdep_details(revdep = "InjurySeverityScore")
══ Reverse dependency check ═══════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════ InjurySeverityScore 0.0.0.1 ══

Status: BROKEN

── Newly failing

✖ checking examples ... ERROR

── Before ────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────
0 errors ✔ | 0 warnings ✔ | 0 notes ✔

── After ─────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────
❯ checking examples ... ERROR
  Running examples in ‘InjurySeverityScore-Ex.R’ failed
  The error most likely occurred in:

  > ### Name: injury_score
  > ### Title: Calculate injury severity score from ICD-9
  > ### Aliases: injury_score
  > 
  > ### ** Examples
  > 
  > pat_id <- c(2,2,2,2,2,1,2,1,2,1,2,1,1,1,1,1,1,1,1,1,1,1,1,1)
  > icd9 <- c('874.2', '874.8', '900.81', '900.82', '900.89', '805.06', 
  +           'E966', '805.07', 'V14.0', '807.02', 'V70.4', '821.01', '823.20', 
  +           '860.0', '861.01', '861.21', '861.22', '863.84', '864.04', '865.04', 
  +           '865.09', '866.02', '868.04', '958.4')
  > sample_data <- data.frame(subj = pat_id, code = icd9, stringsAsFactors = FALSE)
  > injury_score(sample_data, subj, code)
  Error: Argument 3 must be an integer vector, not a double vector
  Backtrace:
      █
   1. └─InjurySeverityScore::injury_score(sample_data, subj, code)
   2.   ├─base::cbind(...)
   3.   └─dplyr::coalesce(iss_br$max_wo_9, iss_br$max_w_9, iss_br$severity_default)
   4.     └─dplyr:::replace_with(...) /Users/romainfrancois/git/tidyverse/dplyr/R/coalesce.R:42:4
   5.       └─dplyr:::check_type(val, x, name) /Users/romainfrancois/git/tidyverse/dplyr/R/utils-replace-with.R:7:2
   6.         └─dplyr:::glubort(header, "must be {friendly_type_of(template)}, not {friendly_type_of(x)}") /Users/romainfrancois/git/tidyverse/dplyr/R/utils-replace-with.R:52:2
  Execution halted

1 error ✖ | 0 warnings ✔ | 0 notes ✔

I have not looked it up in details yet.

romainfrancois commented 5 years ago

Still getting the same results in latest revdep

dajuntian commented 5 years ago

This error was caused by the function dplyr::coalesce. For example, following code would produce an error dplyr::coalesce(1L, 3.14)

dajuntian commented 5 years ago

I could work around this but wonder whether this behavior of dplyr::coalesce was intended.