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
Adding a row at the bottom works as expected:
But adding a row to the top silently converts
mydata$ato a character vector: