Skip to content

separate_wider_position & names_sep #1588

Open
@hanguojun007

Description

@hanguojun007

Hi ,this is my example, i think it may be wrong.
when i set names_sep = "_" and cols_remove = FALSE,the x column become x_x.

df4 <- tibble(x = c("202215TX", "202122LACC", "202325"))
df4 |>
  separate_wider_position(
    x,
    widths = c(year = 4, age = 2, state = 2),
    names_sep = "_",
    too_few = "align_start",
    too_many = "drop",
    cols_remove = FALSE
  )

A tibble: 3 × 4

x_year x_age x_state x_x

1 2022 15 TX 202215TX
2 2021 22 LA 202122LACC
3 2023 25 NA 202325

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions