record_print: Print methods for 'record()'

View source: R/record.R

record_printR Documentation

Print methods for record()

Description

An S3 generic function to be called to print visible values in code when the code is recorded by record(). It is similar to knitr::knit_print(). By default, it captures the normal print() output and returns the result as a character vector. The knitr_kable method is for printing knitr::kable() output. Users and package authors can define other S3 methods to extend this function.

Usage

record_print(x, ...)

## Default S3 method:
record_print(x, ...)

new_record(x, class)

Arguments

x

For record_print(), the value to be printed. For new_record(), a character vector to be included in the printed results.

...

Other arguments to be passed to record_print() methods.

class

A class name. Possible values are: \Sexpr{paste(xfun:::.record_cls, collapse = ', ')}.

Value

A record_print() method should return a character vector or a list of character vectors. The original classes of the vector will be discarded, and the vector will be treated as console output by default (i.e., new_record(class = "output")). If it should be another type of output, wrap the vector in new_record() and specify a class name.


yihui/xfun documentation built on May 14, 2024, 1:29 p.m.