R/textToObject.R

Defines functions textToObject

Documented in textToObject

# textToObject -----------------------------------------------------------------

#' Convert Text Representation Back to R Object
#'
#' @param x vector of character as returned by \code{\link{objectToText}}
#' @return R object
#' @export
#' @examples
#' textToObject("c(1:10)")
#' stopifnot(identical(iris, textToObject(objectToText(iris))))
textToObject <- function(x)
{
  stopifnot(is.character(x))

  dget(textConnection(x))
}
KWB-R/kwb.utils documentation built on April 1, 2024, 7:12 a.m.