Learn R Programming

RSofia (version 1.1)

read.svmlight: Read Files in SVM-Light Format

Description

Read datasets in SVM-Light sparse data format:

: ... :\n

qid: : ... :\n

: ... :# Optional comment or extra data, following the optional "#" symbol.\n

Usage

read.svmlight(file)

Arguments

file
a character string giving the name of the file to read.

Value

read.svmlight returns a list containing the following components:
data
a numeric matrix. The explanatory variables for the model
labels
a numeric vector. The response variable
no_bias_term
NULL

Details

I don't believe this implementation of "read.svmlight" to be particularly robust and should be used with caution.

See Also

write.svmlight

Examples

Run this code

data(irismod)

x <- parse_formula(Is.Virginica ~ ., irismod)

tmp <- tempfile()
 
write.svmlight(x$labels, x$data, file = tmp)

irismod.svmlight <- read.svmlight(tmp)

unlink(tmp)

Run the code above in your browser using DataLab