Learn R Programming

datana (version 1.0.6)

descstat: Creates a descriptive statistics table for continuous variables

Description

Function to create a descriptive statistics table for continuous variables from a dataframe.

Usage

descstat(data = data, decnum = 4, full = FALSE)

Value

This function wraps descriptive statistics into a summarize table having the following descriptive statistics: sample size, minimum, maximum, mean, median, SD, and coefficient of variation. If the full option is set to TRUE, the following statistics are added to the table: 25th and 75th percentiles, the interquartile range, skewness, and kurtosis.

Arguments

data

a dataframe containing numeric variables as columns.

decnum

the number of decimals to be used in the output.

full

TRUE for a longer output (i.e. more descriptive statistics). The default is to FALSE.

Author

Christian Salas-Eljatib and Tomas Cayul.

Details

The resulting table offers the main central and dispersion statistics.

References

Salas-Eljatib, C. 2021. Análisis de datos con el programa estadístico R: una introducción aplicada. Ediciones Universidad Mayor, Santiago, Chile. 170 p. https://eljatib.com/rlibro

Examples

Run this code

#creating a fictitious dataframe
set.seed(1234)
df <- as.data.frame(cbind(variable1=rnorm(5, 0), variable2=rnorm(5, 2)))
## adding one missing value
df[3,1] <- NA
df
#' #using the function
descstat(data=df)
descstat(data=df,decnum=1)
descstat(df,2)

Run the code above in your browser using DataLab