Skip to content

add_row() silently converts factor to character vector #296

Description

@wibom
mydata <- tibble(
     a = letters[1:3] %>% factor(),
     b = 1:3)

Adding a row at the bottom works as expected:

mydata %>% add_row(b = 4)
# A tibble: 4 x 2
       a     b
  <fctr> <dbl>
1      a     1
2      b     2
3      c     3
4     NA     4

But adding a row to the top silently converts mydata$a to a character vector:

 mydata %>% add_row(b = 4, .before = 1)
# A tibble: 4 x 2
      a     b
  <chr> <dbl>
1  <NA>     4
2     a     1
3     b     2
4     c     3

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Fields

    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions