[R] how to store object without loosing their class property

Immanuel B mane.desk at googlemail.com
Tue May 31 15:43:51 CEST 2011


Hello all,

I'm trying to store some objects (class = "svm") , but if I use a list
the objects get somehow converted and I can't retrieve them as objects
of type "svm".
So how to I properly store objects of that kind?

best regards
-----------

library(e1071)

data(iris)
attach(iris)

## classification mode
# default with factor response:
model <- svm(Species ~ ., data = iris)


print(class(model))
models = list()
models = c(model,model)

print(class(models[[1]]))
-----------



More information about the R-help mailing list