Package for producing table of averages?

Hi, I'm looking for a way to summarize my data (which has two groups), showing the overall average, the average for each of the group groups, and the cross-tabulated averages.

For example, if I had the following data set:

my_df <- tibble::tribble(
  ~group1, ~group2, ~value,
     "A1",    "B1",     0L,
     "A1",    "B1",     2L,
     "A1",    "B1",     4L,
     "A1",    "B2",     6L,
     "A1",    "B2",     8L,
     "A2",    "B1",    10L,
     "A2",    "B1",    12L,
     "A2",    "B2",    14L,
     "A2",    "B2",    16L

Then I would like to get a table similar to the following:


I'm sure a package exists that does this, can anyone point me in the right direction? Thank you!

table function in base R should be able to do this.

This topic was automatically closed 21 days after the last reply. New replies are no longer allowed.