View source: R/describe_vars.r
describe_vars | R Documentation |
This function is essentially a customized version of the function describe()
included the package psych
, but provides some additional benefits: First, it transforms the the output into a tibble. Second, it reduces the number of psychometrics down to the most important ones. Third, it allows to include item formulations drawn from an additional data frame (needs to have a variable "code" that includes similar variable codes as the original data frame and a variable named "item" that includes the item formulations). Overall, it provides enough functionality to create a printable "Table 1".
describe_vars(data, items = NULL, var_name = NULL, brief = FALSE,
first_col = "code", n = FALSE, print = FALSE, digits = 2, ...)
data |
A data frame that includes that variables that should be evaluated. Can also be a vector with numeric values. |
items |
A data frame containing the variable codes (first column "code") and item formulations (second column "item"). |
var_name |
If you are evaluating a single vector, you specify the variable name here. |
brief |
A logical value indicating wether all psychometrics or only the mean and the standard deviations should be printed |
first_col |
How should the first column be named? Defaults to "code". |
n |
Logical value indicating whether the number of valid cases should be included in the output. |
print |
Logical value indicating whether the output should be formated according to APA-guidelines (if true, the output can easily be printed with the function |
digits |
A numeric value indicating how many digits should be printed (only works together with |
... |
Further arguments that can be passed to |
A data frame with relevant item statistics such as mean, standard deviation, minimum, maximum, skewness and kurtosis.
describe_vars(mtcars)
describe_vars(mtcars, n = TRUE, print = TRUE, digits = 3)
describe_vars(mtcars$cyl, var_name = "cylinder")
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.