summarize_variables: Summarize a Variable

Description Usage Arguments See Also Examples

View source: R/summarize_.R

Description

Summarize a Variable

Usage

1
2
3
4
5
6
7
summarize_variables(
  data,
  as_number = rubix::all_numeric_cols(data),
  names_to = "Variable",
  values_to = "Value",
  grouper
)

Arguments

data

A dataframe or tibble.

names_to

Passed to 'tidyr::pivot_longer()'.

values_to

Passed to 'tidyr::pivot_longer()'.

grouper

(Optional) Group by column.

incl_num_calc

If TRUE, includes an additional dataframe of summary statistics on the numeric columns in the dataframe.

See Also

pivot_longer reexports,group_by_all,vars,summarise_all,select

Other summary functions: observation_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
31
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)
        )


summarize_variables(data = test_data,
                    incl_num_calc = FALSE)

summarize_variables(data = test_data,
                    incl_num_calc = TRUE)

summarize_variables(data = test_data,
                    incl_num_calc = TRUE,
                    grouper = Group)

summarize_variables(data = test_data,
                    incl_num_calc = FALSE,
                    grouper = Group)


observation_count(data = test_data)


value_count(data = test_data)
value_count(data = test_data,
            grouper = Group)

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