mldr {mldr} | R Documentation |
Creates an object representing a multilabel dataset
Description
Reads a multilabel dataset from a file and returns an mldr
object
containing the data and additional measures. The file has to be in ARFF format.
The label information could be in a separate XML file (MULAN style) or in the
the arff header (MEKA style)
Usage
mldr(filename, use_xml = TRUE, auto_extension = TRUE, xml_file,
label_indices, label_names, label_amount,
force_read_from_file = !all(c(missing(xml_file),
missing(label_indices), missing(label_names), missing(label_amount),
use_xml, auto_extension)), ...)
Arguments
filename |
Name of the dataset |
use_xml |
Specifies whether to use an associated XML file to identify the labels. Defaults to TRUE |
auto_extension |
Specifies whether to add the '.arff' and '.xml' extensions to the filename where appropriate. Defaults to TRUE |
xml_file |
Path to the XML file. If not provided, the filename ending in ".xml" will be assumed |
label_indices |
Optional vector containing the indices of the attributes that should be read as labels |
label_names |
Optional vector containing the names of the attributes that should be read as labels |
label_amount |
Optional parameter indicating the number of labels in the dataset, which will be taken from the last attributes of the dataset |
force_read_from_file |
Set this parameter to TRUE to always read from a local file, or set it to FALSE to look for the dataset within the 'mldr.datasets' package |
... |
Extra parameters to be passed to 'read_arff' |
Value
An mldr object containing the multilabel dataset
See Also
mldr_from_dataframe
, read.arff
, summary.mldr
Examples
library(mldr)
## Not run:
# Read "yeast.arff" and labels from "yeast.xml"
mymld <- mldr("yeast")
# Read "yeast.arff" and labels from "yeast.xml", converting categorical
# attributes to factors
mymld <- mldr("yeast", stringsAsFactors = TRUE)
# Read "yeast-tra.arff" and labels from "yeast.xml"
mymld <- mldr("yeast-tra", xml_file = "yeast.xml")
# Read "yeast.arff" specifying the amount of attributes to be used as labels
mymld <- mldr("yeast", label_amount = 14)
# Read MEKA style dataset, without XML file and giving extension
mymld <- mldr("IMDB.arff", use_xml = FALSE, auto_extension = FALSE)
## End(Not run)