Learn R Programming

farff (version 1.1.1)

readARFF: Read ARFF file into data.frame.

Description

Implementation of a fast ARFF parser that produces consistent results compared to the reference implementation in RWeka. The “DATA” section is read with read_delim.

Usage

readARFF(
  path,
  data.reader = "readr",
  tmp.file = tempfile(),
  convert.to.logicals = TRUE,
  show.info = TRUE,
  ...
)

Arguments

path

[character(1)] Path to ARFF file with read access.

data.reader

[character(1)] Package back-end to parse ARFF data section with. At the moment only readr is supported. Default is “readr”.

tmp.file

[character(1)] The ARFF file must be preprocessed a bit, before it can be fed to the data.reader. Path to TEMP output file, where this result is stored. The file is deleted on exit. Default is tempfile().

convert.to.logicals

[logical(1)] Should factors with values T or F be converted to logicals? (RWeka does this by default). Default is TRUE.

show.info

[logical(1)] Default is TRUE

...

[any] Further parameters passed to read_delim.

Value

[data.frame].

Details

ARFF parsers are already available in package RWeka in read.arff and package foreign in read.arff. The RWeka parser requires Java and rJava, a dependency which is notoriously hard to configure for users in R. It is also quite slow. The parser in foreign in written in pure R, slow and not fully consistent with the reference implementation in RWeka.

Examples

Run this code
# NOT RUN {
path = tempfile()
writeARFF(iris, path = path)
d = readARFF(path)
# }

Run the code above in your browser using DataLab