capture: Displays the result of a command with the command itself

Description Usage Arguments Details Examples

View source: R/capture.R

Description

In {learnr}, the results of running an exercise are posted below the code-entry box. When there are multiple commands, this breaks the direct link between the command itself and the printed results. capture() prints out both the command and the result along with an optional message. annot() turns a character string into a line that looks like a comment.

Usage

1
capture(cmd, message = "", digits = 4)

Arguments

cmd

An R expression, typically piped into capture()

message

a comment to print after the result of cmd.

Details

You must use the built-in pipe (|>) into capture(). Use whatever you like to the left of |>. Meant for results that are very short vectors, either numeric or character string.

Examples

1
2
cos(7) |> capture("Example 3")
annot("Show the plot")

dtkaplan/mosaicUSAFA documentation built on Aug. 21, 2021, 10:37 p.m.