describeDataFrame: A convenient method to describe a full data.frame.

Description Usage Arguments Value Examples

View source: R/statistic_functions.R

Description

A convenient method to describe a full data.frame.

Usage

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
describeDataFrame(
  data,
  variables = colnames(data),
  applicable = NULL,
  group = NULL,
  group_str = NULL,
  p_value = FALSE,
  all = FALSE,
  desc = c("Mean", "Median", "Range"),
  round = 3,
  confint = FALSE,
  NA_asModality = FALSE,
  NA_group_AsModality = FALSE
)

Arguments

data

a data.frame containing the data to describe

variables

a character vector contening the name of columns to describe. Default to colnames(data).

applicable

a list of boolean vector generating based on manageNotApplicable(). Use in cas of NonApplicable data

group

a character vector of length 1. The name of the factor column to use as commparaison group. Default to NULL.

group_str

a numeric vector. The index of the levels of the group variable to use. Default to NULL.

p_value

a boolean. If TRUE, comparaison test are performed.

all

a boolean. If TRUE, total column will be displayed. Default to FALSE

desc

a character vector. Could contain "Mean", "Median", "Range" and/or "Mode"

round

an integer, number of maximal decimal. Default to 3

confint

a boolean. If TRUE, the confidence interval of the mean will be displayed. Default to FALSE

NA_asModality

a boolean. If TRUE, missing data of the factor variable to describe will be considered as levels. Default to FALSE

NA_group_AsModality

a boolean. If TRUE, missing data of the group variable will be considered as levels. Default to FALSE

Value

a data.frame containing the description of the variables

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
data(mtcars)
labels <- data.frame(Variable = c("vs", "vs", "am", "am"),
                     Modality = c(0, 1, 0, 1),
                     Label = c("V-shaped", "Straight", "Automatic", "Manual"))
labelVariable <- data.frame(Variable = c("mpg", "cyl", "disp", "hp", "drat", "wt",
                                         "qsec", "vs", "am", "gear", "carb"),
                            Label = c("Miles/(US) gallon", "Number of cylinders", "Displacement (cu.in.)",
                                      "Gross horsepower ", "Rear axle ratio", "Weight (1000 lbs)",
                                      "1/4 mile time", "Engine", "Transmission", "Number of forward gears",
                                      "Number of carburetors"))
labelledData <- statsBordeaux::labellisationDataFrame(mtcars, labels)
labelledData <- statsBordeaux::setLabelToVariable(labelledData, labelVariable)
comparaison <- describeDataFrame(mtcars, group = "vs", p_value = TRUE)

rgriffier/statsBordeaux documentation built on Aug. 11, 2021, 9:59 a.m.