Description Usage Arguments Details Value Control See Also Examples
Format or display a record or dataset object.
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, ...)
|
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. |
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.
For print.record and print.dataset, return the argument x
after conversion to record or dataset, respectively.
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:
faint and bold, ANSI SGR control codes
specifying the format for faint and bold text for terminals
that support ANSI styling;
tab, the width (in spaces) of a tab;
pages, the maximum number of pages of output to produce
when line wrapping is required;
horiz2, ellipsis, vellipsis,
and vline, characters to use for double horizontal lines,
ellipsis, vertical ellipsis, and vertical line.
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.
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
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.