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, ...)

## S3 method for class 'record_asis'
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 xfun:::.record_cls.

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.


xfun documentation built on Nov. 1, 2024, 1:06 a.m.