R/meanprox.R

Defines functions meanprox

Documented in meanprox

#' Calculate raw score for black hole and its related tests
#'
#' This function calculates raw scores for tests that are simlilar to the Black
#' Hole test. It actually calculated the proximity of the users' response
#' location to the real location.
#'
#' @param data Raw data of class \code{data.frame}.
#' @param ... Other input argument for future expansion.
#' @return The raw score calculated of \code{double} type.
#' @importFrom magrittr %>%
#' @export
meanprox <- function(data, ...) {
  mean_dist <- data %>%
    dplyr::pull("RespLocDist") %>%
    purrr::map(~ strsplit(.x, "-")) %>%
    unlist() %>%
    as.numeric() %>%
    mean()
  10 - mean_dist
}
psychelzh/dataprocr documentation built on Oct. 12, 2019, 1:50 a.m.