utils: Utility functions

easierprofR Documentation

Utility functions

Description

easierprof() is a simple wrapper of utils::Rprof() and utils::summaryRprof().

getenv() converts a result of Sys.getenv() to data.frame.

reprex_tidyverse() wraps reprex::reprex()

Usage

easierprof(expr, interval = 0.02, memory = FALSE)

getenv(pattern = NULL)

reprex_tidyverse(venue = "r", n = 8L, html_preview = FALSE)

Arguments

expr

R expression

interval

numeric

memory

logical

pattern

R expression

venue

Character. Must be one of the following (case insensitive):

  • "gh" for GitHub-Flavored Markdown, the default

  • "r" for a runnable R script, with commented output interleaved. Also useful for Slack code snippets; select "R" from the "Type" drop-down menu to enjoy nice syntax highlighting.

  • "rtf" for Rich Text Format (not supported for un-reprexing)

  • "html" for an HTML fragment suitable for inclusion in a larger HTML document (not supported for un-reprexing)

  • "slack" for pasting into a Slack message. Optimized for people who opt out of Slack's WYSIWYG interface. Go to Preferences > Advanced > Input options and select "Format messages with markup". (If there is demand for a second Slack venue optimized for use with WYSIWYG, please open an issue to discuss.)

  • "so" for Stack Overflow Markdown. Note: this is just an alias for "gh", since Stack Overflow started to support CommonMark-style fenced code blocks in January 2019.

  • "ds" for Discourse, e.g., community.rstudio.com. Note: this is currently just an alias for "gh".

n

passed to pillar.print_max

html_preview

Logical. Whether to show rendered output in a viewer (RStudio or browser). Always FALSE in a noninteractive session. Read more about opt().


heavywatal/rwtl documentation built on April 2, 2024, 6:08 p.m.