descriptive: Produces counts with respective proportions from specified...

View source: R/descriptive-table.R

descriptiveR Documentation

Produces counts with respective proportions from specified variables in a dataframe.

Description

This function has been superseeded by tab_linelist(). Please use that function instead.

Usage

descriptive(
  df,
  counter,
  grouper = NULL,
  multiplier = 100,
  digits = 1,
  proptotal = FALSE,
  coltotals = FALSE,
  rowtotals = FALSE,
  explicit_missing = TRUE
)

Arguments

df

A dataframe (e.g. your linelist)

counter

A name of the variable (in quotation marks) that you would like to have as rows.

grouper

A name of the variable (in quotation marks) that you would like to have as columns.

multiplier

What you would like to have your proportions as (default is per 100).

digits

The number of decimal places you would like in your proportions (default is 1).

proptotal

A TRUE/FALSE variable specifying whether you would proportions to be of total cases.The default is FALSE and returns proportions for each column.

coltotals

Add column totals on the end

rowtotals

Add row totals (only sums counts)

explicit_missing

if TRUE, missing values will be marked as Missing and tabulated. Defaults to FALSE, where missing values are excluded from the computation

Details

The descriptive() function returns a single table with counts and proportions of a categorical variable (counter). Adding a grouper adds more columns, stratifying "n" and "prop", the option coltotals = TRUE adds one row and rowtotals = TRUE (useful if a grouper is present) adds one column.

The multi_descriptive() function allows you to combine several counter variables into a single table where each row represents a variable and the columns represent counts and proportions of the values within those variables. This function assumes that all of the variables have the same values (e.g. Yes/No values) and atttempts no correction.


R4EPI/tuni documentation built on March 20, 2023, 4:37 p.m.