Skip to content

intl_pct: error on R<1000 warning #574

Closed

Description

@vincentarelbundock

Hi,

Thanks for your work on rsample!

I get an error when I try to compute percentile intervals. I think it is related to the warning issued when the number of bootstrap replicates is smaller than 1000.

In some applications, I don’t get any problems, but I was able to save a data frame with splits and results that generates the error.

library(rsample)
b <- readRDS(url("https://arelbundock.com/rsample_reprex.rds"))
int_pctl(b, statistics = results)
#> Error in "lapply(text, glue_cmd, .envir = .envir)": ! Could not evaluate cli `{}`
#> expression: `cli::qty(terms)`.
#> Caused by error in `make_quantity(expr)`:
#> ! length(object) == 1 is not TRUE

Activity

  1. changed the title [-]`intl_pct`: `glue` error on R<1000 warning[/-] [+]`intl_pct`: error on R<1000 warning[/+] on Jun 22, 2025
  2. vincentarelbundock commented on Jun 23, 2025

    @vincentarelbundock
    Author

    The problem does not affect 1.2.1. It was introduced in 1.3.0.

    The issue is that in my example data, the term column is numeric. But here, cli::qty() assumes that terms<-x$term is character, and raises the un-informative error above when terms is numeric.

      if (nrow(x) > 0) {
        terms <- x$term
        cli_warn(
          "Recommend at least {B} non-missing bootstrap resamples for {cli::qty(terms)} term{?s} {.code {terms}}.",
          call = call
        )
      }

    A simple solution would be to:

        terms <- as.character(x$term)
  3. added
    bugan unexpected problem or unintended behavior
    on Jun 23, 2025
  4. added a commit that references this issue on Jan 29, 2026
    ba11b2a
  5. hfrick commented on Jan 29, 2026

    @hfrick
    Member

    @vincentarelbundock Thank you for the bug report and suggested fix! 🙌

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugan unexpected problem or unintended behavior

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions