Description Usage Arguments Value See Also Examples
Not to be confused with a total row count of a dataframe (ie 'nrow()'), this is a shortcut for 'group_by_all()' followed by 'count()'.
1 | observation_count(data, desc = TRUE)
|
data |
A dataframe or tibble. |
desc |
If TRUE, the output is arranged in descending order. Otherwise it is arranged in ascending order. |
Ungrouped dataframe with all input columns with the addition of an 'n' column for the count.
group_by_all
,count
,group_by
,arrange
Other summary functions:
summarize_variables()
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)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.