crimeutils (version 0.1.0)

make_desc_stats_table: Create a descriptive statistics table from numeric variables

Description

Create a descriptive statistics table from numeric variables

Usage

make_desc_stats_table(
  data,
  columns,
  output = c("min", "median", "mean", "sd", "max", "sum", "NAs"),
  decimals = 2,
  title = NULL,
  subtitle = NULL,
  footnote = NULL
)

Arguments

data

A data.frame with the data you want to make the table from.

columns

A string or vector of strings with the names of the columns you want to use.

output

A string or vector of strings indicating which math functions you want to perform on the columns and present in the table. Options are: 'min', 'median', 'mean', 'sd', 'max', and 'N'. Default is to use all of these math functions. The order you put in these values is the order the table will present the columns.

decimals

A positive integer for how many decimal places you want to round to.

title

A string with the text you want as the title

subtitle

A string with the text you want as the subtitle.

footnote

A string with the text you want as the footnote.

Value

A data.frame with the data that generates the table, which is outputted in the Viewer tab.

Examples

Run this code
# NOT RUN {
make_desc_stats_table(mtcars, columns = c("mpg", "disp", "wt", "cyl"))

make_desc_stats_table(mtcars, c("mpg", "disp", "wt"), output = c("mean", "min"),
decimals = 4, title = "hello", subtitle = "world")
# }

Run the code above in your browser using DataCamp Workspace