as_mild_df {mildsvm} | R Documentation |
Coerce to MILD data frame
Description
as_mild_df()
turns an existing object, such as a data frame, into a MILD
data frame, a data frame with 'mild_df'. This is in contrast with
mild_df()
, which builds a MILD data frame from individual columns.
Usage
as_mild_df(
x,
bag_label = "bag_label",
bag_name = "bag_name",
instance_name = "instance_name",
instance_label = "instance_label",
...
)
Arguments
x |
A data-frame or similar to convert. |
bag_label |
A character (default |
bag_name |
A character (default |
instance_name |
A character (default |
instance_label |
A character (default |
... |
Arguments reserved for other methods. |
Value
A 'mild_df' object. This data.frame-like has columns bag_label
,
bag_name
, instance_name
, and potentially others. It also inherits from
the 'tbl_df'
and 'tbl'
classes.
Author(s)
Sean Kent
See Also
mild_df()
to build a mild_df
object.
Examples
x <- data.frame('bag_LABEL' = factor(c(1, 1, 0)),
'bag_name' = c(rep('bag_1', 2), 'bag_2'),
'instance_name' = c('bag_1_inst_1', 'bag_1_inst_2', 'bag_2_inst_1'),
'X1' = c(-0.4, 0.5, 2),
'instance_label' = c(0, 1, 0))
df <- as_mild_df(x)