sum_up: Gives summary statistics (corresponds to Stata command...

Description Usage Arguments Value Examples

View source: R/sum_up.R

Description

Gives summary statistics (corresponds to Stata command summarize)

Usage

1
sum_up(df, ..., d = FALSE, wt = NULL)

Arguments

df

a data.frame

...

Variables to include. Defaults to all non-grouping variables. See the select documentation.

d

Should detailed summary statistics be printed?

wt

Weights. Default to NULL.

Value

a data.frame

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
library(dplyr)
N <- 100
df <- tibble(
  id = 1:N,
  v1 = sample(5, N, TRUE),
  v2 = sample(1e6, N, TRUE)
)
sum_up(df)
sum_up(df, v2, d = TRUE)
sum_up(df, v2, wt = v1)
df %>% group_by(v1) %>% sum_up(starts_with("v"))

statar documentation built on Jan. 13, 2021, 9:33 p.m.