| print.tf | R Documentation |
Prints and formats tf-objects for display. See details / examples for options that
give finer control.
## S3 method for class 'tf'
print(x, n = 6, ...)
## S3 method for class 'tfd_reg'
print(x, n = 6, ...)
## S3 method for class 'tfd_irreg'
print(x, n = 6, ...)
## S3 method for class 'tfb'
print(x, n = 5, ...)
## S3 method for class 'tf'
format(
x,
digits = 2,
nsmall = 0,
width = options()$width,
sparkline = TRUE,
prefix = FALSE,
...
)
x |
any R object (conceptually); typically numeric. |
n |
how many elements of |
... |
handed over to |
digits |
a positive integer indicating how many significant digits
are to be used for
numeric and complex |
nsmall |
the minimum number of digits to the right of the decimal
point in formatting real/complex numbers in non-scientific formats.
Allowed values are |
width |
|
sparkline |
use a sparkline representation? defaults to |
prefix |
prefix with names / index positions? defaults to |
By default, tf objects on regular grids are shown as
"sparklines" (cli::spark_bar()), set sparkline = FALSE for a text
representation.
Sparklines are based on running mean values of the function values, but these don't check for non-equidistant grids, so the visual impression will be misleading for very unequal grid distances.
Sparklines use
options()$width/3 bins for printing/formatting by default, use bins
argument to set the number of bins explicitly.
For pillar::glimpse(), we use 8 bins by default for compact display.
print: prints out x and returns it invisibly.
a character representation of x.
t <- seq(0, 1, l = 201)
cosine <- lapply(1:4, \(i) cos(i * pi * t)) |> tfd(arg = t)
cosine
tf_sparsify(cosine, dropout = .8)
format(cosine, sparkline = FALSE)
format(cosine, bins = 5)
format(cosine, bins = 40)
#! very non-equidistant grids --> sparklines can mislead about actual shapes:
tfd(cosine, arg = t^3)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.