I came across the below error for the following edge case where no inputs are being used. @catalamarti can this instead return an empty summarised result (or an informative error)?
library(PatientProfiles)
#> Warning: package 'PatientProfiles' was built under R version 4.2.3
library(dplyr)
#> Warning: package 'dplyr' was built under R version 4.2.3
#>
#> Attaching package: 'dplyr'
#> The following objects are masked from 'package:stats':
#>
#> filter, lag
#> The following objects are masked from 'package:base':
#>
#> intersect, setdiff, setequal, union
cdm <- mockPatientProfiles()
cdm$cohort1 |>
summariseResult(
group = list(),
variables = list(),
estimates = list(),
counts = FALSE
)
#> ℹ The following estimates will be computed:
#> → Start summary of data, at 2024-04-15 20:59:57
#> Error in `dplyr::inner_join()`:
#> ! Join columns in `x` must be present in the data.
#> ✖ Problem with `strata_id`.
#> Backtrace:
#> ▆
#> 1. └─PatientProfiles::summariseResult(...)
#> 2. ├─PatientProfiles:::orderVariables(...)
#> 3. └─PatientProfiles:::summariseInternal(...)
#> 4. ├─dplyr::arrange(...)
#> 5. ├─dplyr::select(...)
#> 6. ├─dplyr::inner_join(dplyr::bind_rows(result), strataGroup, by = "strata_id")
#> 7. └─dplyr:::inner_join.data.frame(dplyr::bind_rows(result), strataGroup, by = "strata_id")
#> 8. └─dplyr:::join_mutate(...)
#> 9. └─dplyr:::join_cols(...)
#> 10. └─dplyr:::check_join_vars(by$x, x_names, by$condition, "x", error_call = error_call)
#> 11. └─rlang::abort(bullets, call = error_call)
I came across the below error for the following edge case where no inputs are being used. @catalamarti can this instead return an empty summarised result (or an informative error)?
Created on 2024-04-15 with reprex v2.0.2