score_from_lv1 | R Documentation |
Create a score variable from factors
score_from_lv1(data, name, vars_list)
data |
A data.frame. |
name |
The name of the variable to create. |
vars_list |
The list of the factors to count (only the first level is counted, as 1) ; as a character vector. |
The data.frame, with a new variable.
data <- tibble::tibble(group = factor(c("G1", "G1", "G2", "G2", "G3", "G3")),
a = factor(c("Oui", "Oui", "Oui", "Oui", "Non", "Oui")),
b = factor(c("Oui", "Non", "Non", "Oui", "Non", "Oui")),
c = factor(c("Oui", "Oui", "Non", "Non", "Oui", "Oui")))
data |>
score_from_lv1("score", vars_list = c("a", "b", "c")) |>
tab(group, score, digits = 1)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.