Skip to content

separate_rows() has error when column is a factor #1058

@al-obrien

Description

@al-obrien

When separating rows with a column in factor format, the following error occurs: Error in nchar(u, itype) : 'nchar()' requires a character vector

This occurred when transitioning to the 1.1.2 version of tidyr using separate_rows(); a similar issue was resolved in the prior version (1.1.1): #1014

Works fine:

df <- tibble(
  x = 1:3,
  y = c("a", "d,e,f", "g,h"),
  z = c("1", "2,3,4", "5,6")
)
separate_rows(df, y, z, convert = TRUE)

Has error: Error in nchar(u, itype) : 'nchar()' requires a character vector

df <- tibble(
  x = 1:3,
  y = factor("a", "d,e,f", "g,h"),
  z = c("1", "2,3,4", "5,6")
)
separate_rows(df, y, z, convert = TRUE)

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