View source: R/descriptive_analysis.r
nt_describe | R Documentation |
It calculates a descriptive table for quantitative and qualitative variables in a publishable format.
nt_describe(
data,
group = NULL,
labels = NULL,
measures_qt = list(helper_mean_sd, helper_median_iqr, helper_median_range,
helper_missing),
measures_ql = list(helper_count_perc),
digits = 2,
save = FALSE,
file = "descriptive_analysis",
...
)
data |
a data frame with the variables. |
group |
a character value indicating the group variable. |
labels |
a list of labels with components given by their variable names. |
measures_qt |
a list of functions to summarise quantitative variables. See more in details. |
measures_ql |
a list of functions to summarise qualitative variables. See more in details. |
digits |
a numeric value specifying the number of digits to present the results. |
save |
a logical value indicating whether the output should be saved as a csv file. |
file |
a character indicating the name of output file in csv format to be saved. |
... |
a list with additional arguments to be passed to the helper functions. |
For quantitative variables, mean +/- sd, median (quantile 0.25 - quantile 0.75),
median (minimum - maximum) and number of missing observations are calculated using the
functions helper_mean_sd
, helper_median_iqr
,
helper_median_range
and helper_missing
.
For qualitative variables, percentage (frequency) is calculated using
helper_perc_count
.
a data frame with summary for all variables by group.
data(iris)
iris |> nt_describe(group = Species,
labels = list(Sepal.Length = "Sepal Length",
Sepal.Width = "Sepal Width",
Petal.Length = "Petal Length",
Petal.Width = "Petal Width"))
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.