Learn R Programming

mldr (version 0.2.82)

mldr_from_dataframe: 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, name = NULL)

Arguments

dataframe
The data.frame containing the dataset attributes and labels.
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 data.frame
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

mldr, summary.mldr

Examples

Run this code
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)

Run the code above in your browser using DataLab