View source: R/basetable-class.R
| asbasetable | R Documentation |
asbasetable() 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.
asbasetable(x, ...)
## S3 method for class 'basetable'
asbasetable(x, ...)
## S3 method for class 'data.frame'
asbasetable(x, ...)
## Default S3 method:
asbasetable(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 plain basetable is returned
as-is. A subclass of basetable (an object carrying extra classes in front
of "basetable") is returned as a plain basetable, as as.data.frame()
returns a plain data frame, and as.data.frame() strips the class again.
A basetable: a data frame with the basetable class.
isbasetable()
bt <- asbasetable(data.frame(g = c("a", "b"), x = 1:2))
class(bt)
identical(asbasetable(bt), bt)
asbasetable(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.