get_output: Write console output to clipboard

View source: R/get_output.R

get_outputR Documentation

Write console output to clipboard

Description

Captures console output of a command (show()) and copies it to clipboard as a HTML code block.

Usage

get_output(
  x,
  style = FALSE,
  global_style = FALSE,
  css = "background:#002140;color:white;width:max-content;margin:auto"
)

Arguments

x

Valid R command whose output you want to copy.

style

logical. Should the code block be styled. Default is FALSE.

global_style

logical. If TRUE, the style gets applied to all code blocks on the page, otherwise just this one. Default is FALSE.

css

character. A string with valid CSS to set the style.

Examples

x <- rnorm(100)
y <- 4 + .7 * x + rnorm(100)
get_output(summary(lm(y ~ x)))

mivalek/teachR documentation built on Aug. 26, 2022, 6 a.m.