knitr::opts_chunk$set( collapse = TRUE, comment = "#>" ) options(rmarkdown.html_vignette.check_title = FALSE) frag_path <- here::here("man", "fragments", "ehi") paths <- list.files(frag_path, "Rmd", full.names = TRUE) names(paths) <- gsub("\\.Rmd", "", basename(paths)) paths <- as.list(paths)
01 - Writing
02 - Drawing
03 - Throwing
04 - Use scissors
05 - Brush teeth
06 - Use knife (without fork)
07 - Use spoon
08 - Use broom (top hand)
09 - Strike match (holding match)
10 - Opening container (hand on lid)
ehi
functionsThe nominal value from the EHI is based on the answer to question number 1, regarding writing.
The ehi_factorise_nominal
function should be supplied this answer directly, and will return a factor vector of equal length with the categories.
library(dplyr) library(questionnaires) writing <- c(2, 2, -1, 0, 1, -2) ehi_factorise_nominal(writing)
Calculating the laterality quotient requires the entire dataset of all EHI columns to be computed, and as such takes an entire data.frame, with a tidy-selector selecting the columns that contain the EHI columns. If you are working with MOAS-like data, the columns are select by default settings.
# Make some synthetic data to try on ehi_data <- data.frame( ehi_01 = c(2L, 2L, -2L, 1L, 2L), ehi_02 = c(2L, 1L, -2L, 1L, 2L), ehi_03 = c(2L, 0L, -1L, 0L, 1L), ehi_04 = c(2L, -1L, -2L, -1L, 1L), ehi_05 = c(2L, 0L, -1L, 1L, 1L), ehi_06 = c(1L, 0L, -1L, 0L, 1L), ehi_07 = c(2L, 2L, -1L, 0L, 1L), ehi_08 = c(1L, 2L, 1L, -1L, 1L), ehi_09 = c(2L, 1L, -2L, -1L, 1L), ehi_10 = c(2L, 0L, -1L, 0L, 1L) ) ehi_data
ehi_data %>% ehi_compute_lq()
These values can then be categorized into the two different laterality factors we have available.
ehi_data %>% ehi_compute_lq() %>% ehi_factorise_lq() ehi_data %>% ehi_compute_lq() %>% ehi_factorise_lqa()
In most cases, people will want to add the data derived from the ehi
functions directly into their data.frame.
This is in most cases best done using dplyr::mutate
.
ehi_data %>% mutate( ehi_lq = ehi_compute_lq(ehi_data), ehi_nominal = ehi_factorise_nominal(ehi_01), ehi_lq_cat = ehi_factorise_lq(ehi_lq), ehi_lqa_cat = ehi_factorise_lqa(ehi_lq), )
Because this is a little cumbersome to remember, a convenience function is made that will add columns using this naming convention.
ehi_data %>% ehi_compute()
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.