I'm writing a tutorial for my students to demonstrate what group_by() does. I want to highlight the fact that it doesn't do anything that is visible to the tibble except denote the grouping variable.Like this:
However, rmarkdown (I'm using the learnr package, but don't think it should matter) renders the table nicely and eliminates the header portion. How do I get that header portion to display in the rmarkdown output? I thought the results='asis' option would do the trick, but it has no effect. Any help would be appreciated.
That's how I want my output to show up in my output file. But it's getting formattted as a nice table, something under the good is changing the format. The only difference is that my header is like this because I'm using learnr.
---
title: "Data Wrangling in R"
output: learnr::tutorial
runtime: shiny_prerendered
---
I didn't think that would make a difference.
I was already using the echo=TRUE option and I didn't see any difference with the second suggestion. I'm now wondering if learnr or shiny is doing something in the background. Here's what I see in my output file:
I neglected to go back to the top post. group_by doesn't do anything unless you %>% it to count or summarize other than to indicate that the grouping attribute has been set
As mentioned in my reply in a similar question, to control the output format of tables in learnr tutorials — to show the tibble as it would be printed in the console, for example — you can set the df_print option in the YAML frontmatter:
---
output:
learnr::tutorial:
df_print: default # the learnr default is "paged"
---