-
Notifications
You must be signed in to change notification settings - Fork 8
.f
with tibble output and non-null new_col_name
results in packed tibble column
#534
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
Does having to do As for the docs issue: this is mentioned in the Details section of the slide docs here.
Though admittedly this information is both:
We've been in maintenance mode wrt slide docs, just making sure they aren't incorrect, through the recent migrations, but we really need to take a pass through it for readability for people who are not already experts with |
yes, they came up with a pretty way to print it, but nested tibbles are not even dplyr-friendly. If you're e.g. listing the column names, you only get the top level, and not > ex <- tibble(a = c(1,2), b = tibble(c=c(1,3),d=c(1,5)))
> ex
# A tibble: 2 × 2
a b$c $d
<dbl> <dbl> <dbl>
1 1 1 1
2 2 3 5
> names(ex)
[1] "a" "b"
> ex %>% select(ends_with("c"))
# A tibble: 2 × 0
As far as most functions are concerned, there are only 2 columns. Since recipes relies on column logic quite a bit, it can't handle nested tibbles. |
This issue is relatively low priority because it's possible to route around by just naming things yourself, either in the function or using |
Ah I see, so it creates a nested structure which doesn't seem to be well-supported by tidyselect. @brookslogan do you know of a workaround for this? I think the intention of removing |
-- Context -- This behavior was intentional. My goal was to
Tidyeval here is following data-masking (used by -- My guess at tidyverse context --
I'm pretty sure this is intended behavior. It's meant to hide/bundle those columns.
Packed tibbles seem like they were meant to be a solution to a lot of such naming issues in tidyverse, though maybe recipes doesn't use this solution (and allowing for multiple roles is more flexible than packing). Instead of relying on naming schemes & patterns to maybe select the intended set of columns, you can pack all the relevant columns into one bundle when you generate them & reference them via the packed col with the friendly name. Or you can pack a column or columns with variable names into a column with a fixed name, rather than using/struggling with Tidyverse's solution to outputting new columns based on old ones + suffixes is by using Tidyverse's solution to prefixes is via an -- Workarounds --
-- Idea --
|
.f
with multi-line output and non-null new_col_name
results in nested tibbles.f
with multi-line output and non-null new_col_name
results in packed tibbles
.f
with multi-line output and non-null new_col_name
results in packed tibbles.f
with tibble output and non-null new_col_name
results in packed tibble column
@dshemetov this is the issue I was talking about. I'm going to just route around it by not using
step_epi_slide
for now.taking
test_data
from test_epi_slide.Rwith the case where
new_col_name
isNULL
I ran into this in
step_epi_slide
, where there is always a column name added, and where nested tibbles don't interact nicely with recipes. I don't know if this is intended behavior, but I think it would probably be better to be consistent about always appending normal-ish row data. in the case of a name being specified, I was expecting"fooa"
and"foob"
, or maybe"foo_a"
and"foo_b"
.Also, the docs are thankfully pretty precise about the expected input of
.f
. They are not, however, very precise about the expected output.The text was updated successfully, but these errors were encountered: