eth-mds / ricu

🏥 ICU data with R 🏥
https://eth-mds.github.io/ricu/
GNU General Public License v3.0
35 stars 10 forks source link

win_tbl interval determination #67

Open dplecko opened 4 months ago

dplecko commented 4 months ago

(@nbenn) Below is a minimal reproducible example:

> res <- as_id_tbl(
+   data.table(id = 1, start = hours(1), end = hours(2)),
+   id_vars = "id"
+ )
> as_win_tbl(res, index_var = "start", dur_var = "end", by_ref = TRUE)
Error in `assert_that()`:
! x is not compatible with an interval of Inf hours
Run `rlang::last_trace()` to see where the error occurred.
Warning message:
In min(numeric(0), na.rm = TRUE) :
 no non-missing arguments to min; returning Inf

It seems that the error comes from L378 in tbl-class.R, in which interval(index_col(res)) is called, which throws this error.