knitr::opts_chunk$set( collapse = TRUE, comment = "#>" )
The package comes with a simulated dataset of HoNOS scores in "wide" format.
A helper function can be used to transform this data into "long" format (pivot_honos_longer
).
library(honos)
honos_data
Although the original variable names in honos_data
are somewhat self-explanatory, they are not good!
Therefore this package also offers a function to rename the variables (rename_honos()
) to be more consistent and allow for easier further data manipulation.
honos_data_renamed <- honos_data %>% rename_honos(value_vars_current = c("q1", "q2", "q3", "q4", "q5", "q6", "q7", "q8", "q9", "q10", "q11", "q12", "q13"), prob_var_item8 = c("q8_prob"), spec_var_item8 = c("q8_spec"), value_vars_history = c("qa", "qb", "qc", "qd", "qe")) honos_data_renamed %>% rename_honos(value_vars_current = c(paste0("honos", "_", "i", 1:13, "_value")), prob_var_item8 = c("honos_i8_prob"), spec_var_item8 = c("honos_i8_spec"), value_vars_history = paste0("honos", "_", "i", 14:18, "_value"))
There are two options to create a long data set:
pivot = "all_items"
honos_long <- honos_data %>% pivot_honos_longer(value_vars_current = c("q1", "q2", "q3", "q4", "q5", "q6", "q7", "q8", "q9", "q10", "q11", "q12", "q13"), prob_var_item8 = c("q8_prob"), spec_var_item8 = c("q8_spec"), value_vars_history = c("qa", "qb", "qc", "qd", "qe"), pivot = "all_items") honos_long
pivot = "item_scores"
honos_longish <- honos_data %>% pivot_honos_longer(value_vars_current = c("q1", "q2", "q3", "q4", "q5", "q6", "q7", "q8", "q9", "q10", "q11", "q12", "q13"), prob_var_item8 = c("q8_prob"), spec_var_item8 = c("q8_spec"), value_vars_history = c("qa", "qb", "qc", "qd", "qe"), pivot = "item_scores") honos_longish
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.