Learn R Programming

datana (version 1.1.3)

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 = 3,
  eng = TRUE,
  full = FALSE,
  reduced = FALSE,
  all.outputs = FALSE,
  landscape = FALSE
)

Value

This function wraps descriptive statistics into a summarize table having the following statistics: sample size, minimum, maximum, mean, median, SD, and coefficient of variation. If the full option is set to TRUE, the following statistics will be 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. The default is set to 3.

eng

logical; if TRUE (by default), the language of the statistics will be in English; if "FALSE" will be in Spanish. descriptive statistics. The default is to FALSE.

full

logical; if TRUE, the output includes some extra descriptive statistics. The default is to FALSE.

reduced

logical; if TRUE, the output includes the same descriptive statistics as using the summary() basis R function.

all.outputs

logical; if TRUE, the returns several elements as results of the function, which can be of importance for further analyses later on. The default is to FALSE.

landscape

logical; the default is set to FALSE, thus the output table will have the statistics as rows, and in each column the variables. Otherwise, if TRUE the variables will be the rows, and each statistics the columns. Therefore this last option is only advisable when full=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. https://eljatib.com

Examples

Run this code
df <- datana::idahohd
head(df)
df.h<-df[,c("dbh","toth")]
## using the function
descstat(data=df.h)
descstat(data=df.h,decnum=1,eng=FALSE)
descstat(df.h,2)
descstat(df.h,2,full=TRUE)
descstat(df.h,2,reduced=TRUE)
descstat(df.h,2,reduced=TRUE,eng=FALSE)
descstat(data=df.h[,"dbh"],decnum=1,eng=FALSE,landscape = FALSE)

Run the code above in your browser using DataLab