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

Preparing grouped summaries: expectation and replication #427

Open
larnsce opened this issue Oct 30, 2020 · 2 comments
Open

Preparing grouped summaries: expectation and replication #427

larnsce opened this issue Oct 30, 2020 · 2 comments

Comments

@larnsce
Copy link

larnsce commented Oct 30, 2020

I am trying to replicate the output of the following R Code chunk in TidyBlocks:

library(palmerpenguins)
library(dplyr)

penguins %>%
  group_by(species) %>%
  summarise(species_count = n()) 
#> `summarise()` ungrouping output (override with `.groups` argument)
#> # A tibble: 3 x 2
#>   species   species_count
#>   <fct>             <int>
#> 1 Adelie              152
#> 2 Chinstrap            68
#> 3 Gentoo              124

Created on 2020-10-30 by the reprex package (v0.3.0)

I have managed to do so with the following Block:

grafik

I expected the following to work:

grafik

Question 1: Why is the output of summarise not collapsed into 2 columns and 3 rows? It seems counterintutive that a new column is added to the original data instead.

Question 2: How do I name the output object? On the right pane und the tab "Results" I see "unnamed 1" and have not managed to figure out how to change this name.

@gvwilson
Copy link
Owner

gvwilson commented Nov 8, 2020

  1. We add a label to show groups so that users can re-group if they want to - given the block metaphor, we couldn't find another visual way to do this. Happy to discuss alternatives.
  2. The "save as" block will save its input under whatever name you choose and pass it to the output unmodified.
    Screen Shot 2020-11-08 at 7 44 04 AM

@gvwilson gvwilson self-assigned this Nov 8, 2020
@larnsce
Copy link
Author

larnsce commented Nov 9, 2020

Thanks, should have seen the "Save as" block.

On 1: Could you elaborate on the re-grouping? I am not sure I understand the benefit from a user perspective.

Would you also use of the following code block sequence to get the output that I re-produced above with R? I want to make sure that I am not missing something and would get to this output in a simpler way.

@gvwilson gvwilson removed their assignment Nov 7, 2021
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

No branches or pull requests

2 participants