R/print.R

Defines functions print.rfexpr print.sref print.slice print.ref

#' @importFrom utils capture.output
#' @method print ref
#' @export
print.ref <- function(x, ...){
  tryCatch(cat(paste0(capture.output(print(getEnv(x))), " => ", getSym(x))), error=function(e) cat("<NULL>"))
}

#' @importFrom utils capture.output
#' @method print slice
#' @export
print.slice <- function(x, ...){
  tryCatch(cat(paste0(capture.output(print(getEnv(x))), " => ", getSym(x), "[]")), error=function(e) cat("<NULL>"))
}

#' @importFrom utils capture.output
#' @method print ref
#' @export
print.sref <- function(x, ...){
  tryCatch(cat(paste0(capture.output(print(getEnv(x))), " => ", getSym(x))), error=function(e) cat("<NULL>"))
}

#' @importFrom utils capture.output
#' @method print rfexpr
#' @export
print.rfexpr <- function(x, ...){
  class(x) <- NULL
  cat(paste0("<", capture.output(print(dederef_exp_(x))), ">"))
}

Try the refer package in your browser

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

refer documentation built on Nov. 8, 2021, 5:08 p.m.