Skip to content

[BUG] fslice crash when ordering by variable with only missing values #867

Description

@chihyunkim

Describe the bug
Running fslice will yield an 'R encountered a fatal error' crash when grouping by a variable and a group has only missing values in the order.by variable.

Steps/Code to Reproduce

tibble::tibble(group_var = c("a", "a", "b", "b", "c", "c"),
                      order_var = c(1, 2, 3, NA, NA, NA)) |>
  collapse::fslice(group_var,
                   order.by = order_var,
                   how = "min", n = 1)

Expected behavior
In the repro example, group c should return only the first row in the group (or both rows if with.ties = TRUE)

Additional context
Run in R version 4.6.0 (2026-04-24) -- "Because it was There".

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions