print.record: Format or Display

Description Usage Arguments Details Value Control See Also Examples

View source: R/record-print.R

Description

Format or display a record or dataset object.

Usage

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
## S3 method for class 'dataset'
format(x, limit = NA, line = NA, control = NULL,
       meta = FALSE, ...)
## S3 method for class 'record'
format(x, limit = NA, line = NA, control = NULL,
       meta = FALSE, ...)

## S3 method for class 'dataset'
print(x, limit = NULL, line = NULL, control = NULL, ...)
## S3 method for class 'record'
print(x, limit = NULL, line = NULL, control = NULL, ...)

Arguments

x

object to format or display.

limit

the maximum number of fields to format or display.

line

the maximum number of characters in a line.

control

additional formatting options (see “Control” below.

meta

whether to include information that should used to format the result for display.

...

ignored.

Details

The format.record and format.dataset convert their argument x to a record or dataset, respectively, and then return a record or dataset with entries replaced by string representations suitable for display.

The print.record and print.dataset functions format their arguments using the corresponding format method and then display the results to the screen.

The limit argument sets the maximum number of fields or rows do display for a record or dataset, respectively. Non-positive and NA values are interpreted as no maximum. A NULL value is interpreted as the result of getOption("format.limit"), or 20 if the latter is NULL.

The line argument specifies the width of a line, in characters. A non-positive or NA value is interpreted as no limit. A NULL value is interpreted as the result of getOption("width").

The control argument is a list of formatting options, described in the next section.

Value

For print.record and print.dataset, return the argument x after conversion to record or dataset, respectively.

Control

The print and format functions allow the user to specify additional formatting options via the conrol argument, a list of named values. These values include the following:

When the control argument is NULL, these values are taken from getOption("format.control"). If that value is NULL, then tab and pages get taken from getOption("format.tab") and getOption("format.pages"); otherwise 4 and 1 if either those values are NULL.

See Also

record, dataset.

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
# record
(x <- record(a = 1, b = "hello"))

# nested record
record(x, y = "hello", z = record(f = record(foo = TRUE, bar = FALSE)))

# dataset
(x <- as.dataset(mtcars))

print(x, NA) # no limit

# nested dataset
(x <- dataset(first = 1:32, second = rnorm(32), third = runif(32), mtcars))

print(x, control = list(pages = NA)) # no page limit

patperry/r-frame documentation built on May 6, 2019, 8:34 p.m.