desc_cont {vigicaen}R Documentation

Summarize continuous variables

Description

[Stable] Summarize continuous data and handle output format.

Usage

desc_cont(
  .data,
  vc,
  format = "median (q1-q3) [min-max]",
  digits = 1,
  export_raw_values = FALSE
)

Arguments

.data

A data.frame, where vc are column names of continuous variables

vc

A character vector, list of column names. Should only contain continuous variables

format

A character string. How would you like the output? See details.

digits

A numeric. How many digits? This argument calls internal formatting function

export_raw_values

A logical. Should the raw values be exported?

Details

Many other packages provide tools to summarize data. This one is just the package author's favorite. This makes it much easier to map to nice labeling thereafter. The format argument shows the output of the function. You can change square and round brackets, spaces, separators... Important format inputs are

The analogous for categorical variables is desc_facvar().

Value

A data.frame with columns

See Also

desc_facvar()

Examples

df <-
  data.frame(
    smoke_status = c("smoker", "non-smoker",
           "smoker", "smoker",
           "smoker", "smoker",
           "non-smoker"
           ),
    age = c(60, 50, 56, 49, 75, 69, 85),
    bmi = c(18, 30, 25, 22, 23, 21, 22)
  )

# Use default formatting

desc_cont(.data = df, vc = c("age", "bmi"))

# Use custom formatting

desc_cont(.data = df,
          vc = c("age", "bmi"),
          format = "median (q1;q3)"
          )

# You might want to export raw values, to run plotting or
# other formatting functions

desc_cont(.data = df, vc = c("age", "bmi"),
          export_raw_values = TRUE)

[Package vigicaen version 0.15.6 Index]