R/utils.R

#' Visualize html document
#' 
#' @export
#' 
visualize <- function(h) {
  if (interactive()) {
    dir <- tempfile()
    dir.create(dir)
    html_file <- file.path(dir, "index.html")
    enc <- stringi::stri_enc_detect(h)[[1]]$Encoding[1]
    h <- iconv(h, from = "UTF-8", to = "ISO-8859-1")
    cat(h, file = html_file)
    rstudioapi::viewer(html_file)
  }
}

#' Pipe operator
#'
#' See \code{\link[magrittr]{\%>\%}} for more details.
#'
#' @name %>%
#' @rdname pipe
#' @keywords internal
#' @export
#' @importFrom magrittr %>%
#' @usage lhs \%>\% rhs
NULL
jtrecenti/NFP documentation built on May 20, 2019, 3:15 a.m.