strprint: String Representation of Print

Description Usage Arguments Details Examples

Description

Extends S3 dispatch of strprint to lists and any R6 class.

Usage

1
2
3
4
5
6
7
strprint(x,...)

## S3 method for class 'R6'
strprint(x, ...)

## S3 method for class 'list'
strprint(x, ...)

Arguments

x

R6 object

...

Additional arguments

Details

strprint is a suggested method that should be included in all R6 classes to be passed to methods such as cat, summary and print. Additionally can be used to easily parse R6 objects into data-frames, see examples.

Examples

1
2
3
4
5
6
7
8
ClassExample <- R6::R6Class("ClassExample",public=list(
strprint = function() return("Test"),
print = function() print(strprint)))
ce = ClassExample$new()
print(ce)
data.frame(A = strprint(ce))
strprint(ce)
strprint(list(ce,ce))

RaphaelS1/RSmisc documentation built on June 7, 2019, 8:20 p.m.