Skip to content
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

fix: Avoid stray argument #2054

Merged
merged 5 commits into from
Nov 5, 2024
Merged

fix: Avoid stray argument #2054

merged 5 commits into from
Nov 5, 2024

Conversation

krlmlr
Copy link
Contributor

@krlmlr krlmlr commented Nov 3, 2024

Closes #2050.

@@ -308,7 +308,6 @@ pier_summary_hierarchical <- function(cards,
# this ensures the correct order when there are 10+ groups
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@edelarua can you take a look at this?

  • I think we may just need to replace the preceding |> with %>% to put the input data frame in thte second argument.
  • If we don't already have a test for AE tables with 10+ by levels, can we add one?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

With both |> or %>%, the LHS comes in as the first argument, and cards_no_attr |> ... as the second. The dot comes in third, and is mapped to copy, which currently is never touched in dplyr and hence never errors.

Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Using the dot with %>% would change the default location of the argument placement. From the %>% help file:

image

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Oh, right, I forgot about that. Can we use y = _ with the base pipe too?

Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, that would work too!

@edelarua let's use %>% so we can support R 4.1, since the base R placeholder was introduced in R 4.2

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

How about storing the RHS in a variable?

Copy link
Owner

@ddsjoberg ddsjoberg left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you @krlmlr and @edelarua for the update!

@ddsjoberg ddsjoberg merged commit e6a6421 into ddsjoberg:main Nov 5, 2024
7 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Checks fail with duckplyr
3 participants