prGetStatistics: Get statistics according to the type

View source: R/private_functions.R

prGetStatisticsR Documentation

Get statistics according to the type

Description

A simple function applied by the getDescriptionStatsBy() for the total column. This function is also used by printCrudeAndAdjustedModel() in case of a basic linear regression is asked for a raw stat column

Usage

prGetStatistics(
  x,
  show_perc = FALSE,
  html = TRUE,
  digits = 1,
  numbers_first = TRUE,
  useNA = "no",
  show_all_values = FALSE,
  continuous_fn = describeMean,
  factor_fn = describeFactors,
  prop_fn = factor_fn,
  percentage_sign = percentage_sign
)

Arguments

x

The variable that we want the statistics for

show_perc

If this is a factor/proportion variable then we might want to show the percentages

html

If the output should be in html or LaTeX formatting

digits

Number of decimal digits

numbers_first

If number is to be prior to the percentage

useNA

If missing should be included

show_all_values

This is by default false as for instance if there is no missing and there is only one variable then it is most sane to only show one option as the other one will just be a complement to the first. For instance sex - if you know gender then automatically you know the distribution of the other sex as it's 100 % - other %.

continuous_fn

A function for describing continuous variables defaults to describeMean()

factor_fn

A function for describing factors, defaults to describeFactors()

prop_fn

A function for describing proportions, defaults to the factor function

percentage_sign

If you want to suppress the percentage sign you can set this variable to FALSE. You can also choose something else that the default % if you so wish by setting this variable.

Value

A matrix or a vector depending on the settings

TODO: Use the Gmisc function instead of this copy


Greg documentation built on Nov. 16, 2022, 5:06 p.m.