summarize_max: Summarizes each column with max value

Description Usage Arguments See Also Examples

Description

Summarizes each column with max value

Usage

1
summarize_max(data, ..., na.rm = TRUE, grouper)

Arguments

data

A dataframe or tibble.

...

(Optional) Numeric columns to summarize.

na.rm

TRUE if true NA are to be removed.

grouper

(Optional) Group by column.

See Also

tidyeval-compat

Other summarize functions: value_count()

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
library(tidyverse)
test_data <- 
        tibble(
                Group = sample(c("Apple", "Pear"), size = 10, replace = TRUE),
                A     = sample(c(NA_integer_, 1:3), size = 10, replace = TRUE),
                B     = sample(c(NA_integer_, 4:6), size = 10, replace = TRUE),
                C     = sample(c(NA_real_, seq(from = 6.01, to = 6.09, by = 0.01)), size = 10, replace = TRUE)
        )


# Checking that all numeric cols are captured
all_numeric_cols(data = test_data)

# Ungrouped Summary
summarize_max(test_data)
summarize_max(test_data, A)

# Grouped Summary
summarize_max(test_data,
              grouper = Group)

summarize_max(test_data,
              B,
              na.rm = TRUE,
              grouper = Group)

summarize_max(test_data,
              B,
              na.rm = FALSE,
              grouper = Group)

meerapatelmd/rubix documentation built on Sept. 5, 2021, 8:30 p.m.