as_mi_df: Coerce to MI data frame

View source: R/mi_df.R

as_mi_dfR Documentation

Coerce to MI data frame

Description

as_mi_df() turns an existing object, such as a data frame, into a MI data frame, a data frame with 'mi_df'. This is in contrast with mi_df(), which builds a MI data frame from individual columns.

Usage

as_mi_df(
  x,
  bag_label = "bag_label",
  bag_name = "bag_name",
  instance_label = "instance_label",
  ...
)

Arguments

x

A data-frame or similar to convert.

bag_label

A character (default 'bag_label') describing which column refers to the bag label.

bag_name

A character (default 'bag_name') describing which column refers to the bag name.

instance_label

A character (default 'instance_label') describing which column refers to the instance labels. If NULL, no instance_labels will be used.

...

Arguments reserved for other methods.

Value

A 'mi_df' object. This data.frame-like has columns bag_label, bag_name, and potentially others. It also inherits from the 'tbl_df' and 'tbl' classes.

Author(s)

Sean Kent

See Also

mi_df() to build a mi_df object.

Examples

x = data.frame('bag_LABEL' = factor(c(1, 1, 0)),
               'bag_name' = c(rep('bag_1', 2), 'bag_2'),
               'X1' = c(-0.4, 0.5, 2),
               'instance_label' = c(0, 1, 0))

df <- as_mi_df(x)


mildsvm documentation built on July 14, 2022, 9:08 a.m.