The text that print() shows for a value whose type has no Display or
Print impl: a header naming the type, and each field on its own line,
a nested value's fields indented under it. A vector shows its element
type, its length, and its first head items; a factor, a matrix, a table,
and a sparse matrix show their shape. The header of a Rust-stored value
shows the size of its state in IEC binary units. A nested value whose
type implements Display shows the impl's text. The layout reads no
vector whole.
Details
A list or a data frame lays out the same way, with each element's type
inferred from the R object: the header names the class and the number of
elements, or rows x columns (<data.frame> 150 x 5), and each element or
column follows on its own line. A nested list shows as list[3] with its
elements indented, to a depth of three; an element without a name shows
its position, [[2]]. A level shows at most 32 elements, and the layout
at most 128 lines.
A Display or Print impl can build on the layout with r8text() and
c().
Examples
GBM <- new_struct("GBM", fields = list(
n_trees = field(type_integer()),
shrinkage = field(type_double())
))
r8layout(GBM(n_trees = 500L, shrinkage = 0.01))#> <global::GBM>
#> n_trees: 500
#> shrinkage: 0.01#> <list> 3 elements
#> model: "GBM"
#> n_trees: 500
#> auc: double[3] 0.81 0.84 0.79r8layout(iris)#> <data.frame> 150 x 5
#> Sepal.Length: double[150] 5.1 4.9 4.7 4.6 5 5.4 4.6 5 ...
#> Sepal.Width: double[150] 3.5 3 3.2 3.1 3.6 3.9 3.4 3.4 ...
#> Petal.Length: double[150] 1.4 1.4 1.3 1.5 1.4 1.7 1.4 1.5 ...
#> Petal.Width: double[150] 0.2 0.2 0.2 0.2 0.2 0.4 0.3 0.2 ...
#> Species: factor[150] setosa setosa setosa setosa setosa setosa setosa setosa ... (3 levels)