Learn R Programming

rmcfs (version 1.1.0)

write.arff: Writes data to ARFF

Description

Exports data into ARFF format. This format is used by Weka Data Mining software http://www.cs.waikato.ac.nz/ml/weka/.

Usage

write.arff(x, file = "", target = NA, chunk.size=100000)

Arguments

x
data frame with data
file
exported filename
target
sets target attribute in ARFF format. Default value is NA what refers to the last column.
chunk.size
it defines size of chunk (number of cells) that are processed and exported. The bigger the value, the function is faster for small data and slower for big data.

Examples

Run this code
# Load rmcfs library.
  library(rmcfs)
  
  # Load alizadeh dataset.
  data(alizadeh)
  d <- alizadeh
  
  #Fix input data to be consistent with ARFF and ADX formats. 
  #It is not necessary but for some data can help to export in proper format.
  d <- fix.data(d)
  write.arff(d, file = paste0(tempdir(), "/alizadeh.arff"), target = "class")

Run the code above in your browser using DataLab