R/revealLocation.R

Defines functions revealLocation

Documented in revealLocation

#' @title \code{revealLocation} Revealing locations encoded as a string calculation.
#'
#' @description Reveals the location by parsing and evaluating the string.
#'
#'
#' @export revealLocation
#'
#' @param hiddenLocation A character vector of calculation strings.
#'
#' @return Returns the value of the each calculation.
#'
#' @seealso \code{\link{hideLocation}}
#'
#' @examples
#' trueLoc <- hideLocation(3,100)
#' trueLoc
#' revealLocation(trueLoc)
#'
#' n <- 200
#' trueLoc <- sample(1:n, 3)
#' trueLoc
#' ans <- hideLocation(trueLoc , n)
#' ans
#' revealLocation(ans)
#'
#' @export revealLocation
#'
revealLocation <- function(hiddenLocation){
  nLocs <- length(hiddenLocation)
  # parse and evaluate the text
  sapply(1:nLocs, FUN = function(i) {eval(parse(text = hiddenLocation[i]))}
  )
}

Try the qqtest package in your browser

Any scripts or data that you put into this service are public.

qqtest documentation built on March 26, 2020, 7:57 p.m.