mldr_from_dataframe {mldr} | R Documentation |
Generates an mldr object from a data.frame and a vector with label indices
Description
This function creates a new mldr
object from the data
stored in a data.frame
, taking as labels the columns pointed by the
indexes given in a vector.
Usage
mldr_from_dataframe(dataframe, labelIndices, attributes, name)
Arguments
dataframe |
The |
labelIndices |
Vector containing the indices of attributes acting as labels. Usually the
labels will be at the end (right-most columns) or the beginning (left-most columns) of the |
attributes |
Vector with the attributes type, as returned by the |
name |
Name of the dataset. The name of the dataset given as first parameter will be used by default |
Value
An mldr object containing the multilabel dataset
See Also
Examples
library(mldr)
df <- data.frame(matrix(rnorm(1000), ncol = 10))
df$Label1 <- c(sample(c(0,1), 100, replace = TRUE))
df$Label2 <- c(sample(c(0,1), 100, replace = TRUE))
mymldr <- mldr_from_dataframe(df, labelIndices = c(11, 12), name = "testMLDR")
summary(mymldr)
[Package mldr version 0.4.3 Index]