View source: R/basetable-class.R
| as_basetable | R Documentation |
as_basetable() turns a data frame, a list of equal-length columns, a
matrix, or anything else as.data.frame() accepts into a basetable: an
ordinary data frame carrying basetable's lightweight class, the same object
every basetable verb returns. Use it when a package or script wants to hand
its own data to basetable explicitly, rather than relying on a verb to stamp
the class.
as_basetable(x, ...)
## S3 method for class 'basetable'
as_basetable(x, ...)
## S3 method for class 'data.frame'
as_basetable(x, ...)
## Default S3 method:
as_basetable(x, ...)
x |
An object to coerce. |
... |
Passed to |
The data are left unchanged; only the class and the row.names attribute
are normalised. An object that is already a basetable is returned as-is,
and as.data.frame() strips the class again.
A basetable: a data frame with the basetable class.
is_basetable()
bt <- as_basetable(data.frame(g = c("a", "b"), x = 1:2))
class(bt)
identical(as_basetable(bt), bt)
as_basetable(list(g = c("a", "b"), x = 1:2))
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.