#----------------------------------------------------------------------------
# Descriptive statistics
# Example 1a: Descriptive statistics for 'mpg', 'cyl', and 'hp'
descript(mpg, cyl, hp, data = mtcars)
# Alternative specification using the 'data' argument
descript(mtcars[, c("mpg", "cyl", "hp")])
# Example 1b: Print all available statistical measures
descript(mpg, cyl, hp, data = mtcars, print = "all")
# Example 1c: Print default statistical measures plus median
descript(mpg, cyl, hp, data = mtcars, print = c("default", "med"))
#----------------------------------------------------------------------------
# Grouping and Split Variable
# Example 2a: Grouping variable
descript(mpg, cyl, hp, data = mtcars, group = "vs")
# Alternative specification
descript(mtcars[, c("mpg", "cyl", "hp")], group = mtcars$vs)
# Example 2b: Split variable
descript(mpg, cyl, hp, data = mtcars, split = "am")
# Alternative specification
descript(mtcars[, c("mpg", "cyl", "hp")], split = mtcars$am)
# Example 2c: Grouping and split variable
descript(mpg, cyl, hp, data = mtcars, group = "vs", split = "am")
# Alternative specification
descript(mtcars[, c("mpg", "cyl", "hp")], group = mtcars$vs, split = mtcars$am)
if (FALSE) {
#----------------------------------------------------------------------------
# Write Output
# Example 3a: Text file
descript(mtcars, write = "Descript_Text.txt")
# Example 3b: Excel file
descript(mtcars, write = "Descript_Excel.xlsx")}
Run the code above in your browser using DataLab