wrapObject | R Documentation |
Wrap a data frame to create an object instance
wrapObject(df, className, required = NULL, optional = NULL, cleanse = FALSE)
df |
Data frame to be wrapped (data.frame) |
className |
Class of new instance (character) |
required |
Names of required columns, NULL if none (character, optional) |
optional |
Name of optional columns, NULL if none (character, optional) |
cleanse |
If TRUE, remove all but the required and optional columns (logical) |
The input data frame, converted to a tibble, possibly
cleansed of extraneous columns (cleanse = TRUE
),
and with a class attribute given by className
.
df <- data.frame(Pi = pi, E = exp(1), Foo = "fum")
wrapObject(df, "Numbers")
wrapObject(df, "Numbers", required = c("Pi"), cleanse = TRUE)
wrapObject(df, "Numbers", required = c("Pi"), optional = c("E"))
wrapObject(df, "Numbers", required = c("Pi"), optional = c("E"), cleanse = TRUE)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.