Learn R Programming

glioblastomaEHRsData (version 1.1.0)

Munich2019datasetDescriptiveStatistics: Munich2019datasetDescriptiveStatistics

Description

Provides descriptive statistics for the 'munich2019dataset'. It can display summary statistic for continuous variables, frequency tables for categorical variables or both.

Usage

Munich2019datasetDescriptiveStatistics(show = "all")

Value

A list or an object depending on the value of show: - If show = "continuous" A data frame with descriptive statistics. - If show = "categorical" A list of frequency tables. - If show = "all" A list of 2 items, the first is a data frame for continuous variable, the second is a list for categorical variables. - If show is not one of the above return a warning.

Arguments

show

character string for the type of statistic to show. There are three options:

  • 'continuous', summary statistic for continuous variables will be displayed.

  • 'categorical', frequency tables for categorical variables will be displayed.

  • 'all', both summary will be displayed.

  • none of the above a warning will be launched.

See Also

summarytools::descr(), summarytools::freq()

Examples

Run this code
  # Show both continuous and categorical stats
  all <- Munich2019datasetDescriptiveStatistics(show = "all")

  # Mean value for the OS_months columns
  all$continuous["Mean", "OS_months"]

  # Min, Median and Max value for ALL the numeric columns
  all$continuous[c("Min","Median","Max"),]

  # Get the frequency table of the third categorical column
  all$categorical[[3]]

  # Only continuous variables
  cont <- Munich2019datasetDescriptiveStatistics("continuous")

  # Statistics for age_years column
  cont[, "age_years"]

  # Only categorical variables
  cat <- Munich2019datasetDescriptiveStatistics("categorical")

  # Frequency values for all factors of the first categorical column
  cat[[1]][,"Freq"]

  # Statistics for the Low factor of the first categorical column
  cat[[1]]["Low",]

  # Frequency of the Low factor, a value of the first categorical column
  cat[[1]]["Low", "Freq"]

Run the code above in your browser using DataLab