You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Some workflows I'm testing that involve using dplyr::bind_rows() on data frames that have collateral columns cause them to lose their formatting:
library(tidyverse)
library(collateral)
test=# tidy up and trim down for the examplemtcars %>%
rownames_to_column(var="car") %>%
as_tibble() %>%
select(car, cyl, disp, wt) %>%
# spike some rows in cyl == 4 to make them fail
mutate(wt=dplyr::case_when(
wt<2~-wt,
TRUE~wt)) %>%
# nest and do some operations quietly()
nest(-cyl) %>%
mutate(qlog= map_quietly(data, ~ log(.$wt)))
# now slice them up...test1=test %>% slice(1)
test2=test %>% slice(2)
test3=test %>% slice(3)
# ... and combine them. problem!test_rejoined= bind_rows(test1, test2, test3)
#> Warning in bind_rows_(x, .id): Vectorizing 'quietly_mapped' elements may#> not preserve their attributes#> Warning in bind_rows_(x, .id): Vectorizing 'quietly_mapped' elements may#> not preserve their attributes#> Warning in bind_rows_(x, .id): Vectorizing 'quietly_mapped' elements may#> not preserve their attributestest_rejoined#> # A tibble: 3 x 3#> cyl data qlog #> <dbl> <list> <list> #> 1 6 <tibble [7 x 3]> <list [4]>#> 2 4 <tibble [11 x 3]> <list [4]>#> 3 8 <tibble [14 x 3]> <list [4]>
class(test_rejoined$qlog)
#> [1] "list"
This took me by surprise a little, as my understanding is that classes are supposed to be exempt from attributes getting wiped when a vector is modified. So I'm not 100% sure what's happening, but it may be that I need to handle collateral lists getting concatenated or subsetted a little more explicitly.
R/format.r has some extra S3 methods that I mostly added because I was trying to follow along with the pillar documentation, but I wonder if—for example—these two might deserve some more attention:
Some workflows I'm testing that involve using
dplyr::bind_rows()
on data frames that have collateral columns cause them to lose their formatting:Created on 2019-07-09 by the reprex package (v0.3.0)
This took me by surprise a little, as my understanding is that classes are supposed to be exempt from attributes getting wiped when a vector is modified. So I'm not 100% sure what's happening, but it may be that I need to handle collateral lists getting concatenated or subsetted a little more explicitly.
R/format.r
has some extra S3 methods that I mostly added because I was trying to follow along with thepillar
documentation, but I wonder if—for example—these two might deserve some more attention:Originally posted by @Rensa in #9 (comment)
The text was updated successfully, but these errors were encountered: