title: R - Hadoop - rmr2 - SVM Model - conver result "list" class to original class "svm.formula" "svm"
body: <p>I have following R configuration:</p>
  
  <p>OS:Linux
  R version 3.0.1 (2013-05-16)
  rmr2 version 2.2.1
  rhdfs version 1.0.6
  hadoop version 1.2.0</p>
  
  <p>How can i convert result of svm model by using hadoop with rmr2 package? So i can use builded model as usual uses like:</p>
  
  <pre><code>predict(svm1, "new data")
  </code></pre>
  
  <p>I have folowing code:</p>
  
  <pre><code># set eviremonet variables
  Sys.setenv(HADOOP_CMD="~/Downloads/hadoop-1.2.0/bin/hadoop")
  Sys.setenv(HADOOP_HOME="~/Downloads/hadoop-1.2.0/")
  
  # start hadoop
  
  # load librarys
  library(rmr2)
  library(rhdfs)
  library(e1071)
  
  # load sample data
  data(iris)
  
  # init hdfs
  hdfs.init()
  
  # push data to hdfs
  iris.dfs &lt;- to.dfs(iris)
  
  # define map function
  iris.map &lt;- function(k, v) 
    {
    svm(v$Species ~ ., data=v)
    }
  
  # rum mar job
  iris.svm &lt;- mapreduce(input=iris.dfs, map=iris.map)
  
  # get result back
  iris.res &lt;- from.dfs(iris.svm)
  
  svm1 &lt;- svm(iris$Species ~ ., data=iris)
  
  class(iris.res)
  class(svm1)
  </code></pre>
  
  <p>The result of both class show folowing:</p>
  
  <pre><code>&gt; class(iris.res)
  [1] "list"
  &gt; class(svm1)
  [1] "svm.formula" "svm"
  
  &gt; str(svm1)
  List of 30
   $ call           : language svm(formula = iris$Species ~ ., data = iris)
   $ type           : num 0
   $ kernel         : num 2
   $ cost           : num 1
   $ degree         : num 3
   $ gamma          : num 0,25
   $ coef0          : num 0
   $ nu             : num 0,5
   $ epsilon        : num 0,1
   $ sparse         : logi FALSE
   $ scaled         : logi [1:4] TRUE TRUE TRUE TRUE
   $ x.scale        :List of 2
    ..$ scaled:center: Named num [1:4] 5,84 3,06 3,76 1,20
    .. ..- attr(*, "names")= chr [1:4] "Sepal.Length" "Sepal.Width" "Petal.Length" "Petal.Width"
    ..$ scaled:scale : Named num [1:4] 0,828 0,436 1,765 0,762
    .. ..- attr(*, "names")= chr [1:4] "Sepal.Length" "Sepal.Width" "Petal.Length" "Petal.Width"
   $ y.scale        : NULL
   $ nclasses       : int 3
   $ levels         : chr [1:3] "setosa" "versicolor" "virginica"
   $ tot.nSV        : int 51
   $ nSV            : int [1:3] 8 22 21
   $ labels         : int [1:3] 1 2 3
   $ SV             : num [1:51, 1:4] -1,743 -1,864 -0,173 -0,535 -1,501 ...
    ..- attr(*, "dimnames")=List of 2
    .. ..$ : chr [1:51] "9" "14" "16" "21" ...
    .. ..$ : chr [1:4] "Sepal.Length" "Sepal.Width" "Petal.Length" "Petal.Width"
   $ index          : int [1:51] 9 14 16 21 23 24 26 42 51 53 ...
   $ rho            : num [1:3] -0,0203 0,1312 -0,0629
   $ compprob       : logi FALSE
   $ probA          : NULL
   $ probB          : NULL
   $ sigma          : NULL
   $ coefs          : num [1:51, 1:2] 0,0891 0,0000 0,8652 0,0000 0,0000 ...
   $ na.action      : NULL
   $ fitted         : Factor w/ 3 levels "setosa","versicolor",..: 1 1 1 1 1 1 1 1 1 1 ...
    ..- attr(*, "names")= chr [1:150] "1" "2" "3" "4" ...
   $ decision.values: num [1:150, 1:3] 1,20 1,06 1,18 1,11 1,19 ...
    ..- attr(*, "dimnames")=List of 2
    .. ..$ : chr [1:150] "1" "2" "3" "4" ...
    .. ..$ : chr [1:3] "setosa/versicolor" "setosa/virginica" "versicolor/virginica"
   $ terms          :Classes 'terms', 'formula' length 3 iris$Species ~ Sepal.Length + Sepal.Width + Petal.Length + Petal.Width
    .. ..- attr(*, "variables")= language list(iris$Species, Sepal.Length, Sepal.Width, Petal.Length, Petal.Width)
    .. ..- attr(*, "factors")= int [1:5, 1:4] 0 1 0 0 0 0 0 1 0 0 ...
    .. .. ..- attr(*, "dimnames")=List of 2
    .. .. .. ..$ : chr [1:5] "iris$Species" "Sepal.Length" "Sepal.Width" "Petal.Length" ...
    .. .. .. ..$ : chr [1:4] "Sepal.Length" "Sepal.Width" "Petal.Length" "Petal.Width"
    .. ..- attr(*, "term.labels")= chr [1:4] "Sepal.Length" "Sepal.Width" "Petal.Length" "Petal.Width"
    .. ..- attr(*, "order")= int [1:4] 1 1 1 1
    .. ..- attr(*, "intercept")= num 0
    .. ..- attr(*, "response")= int 1
    .. ..- attr(*, ".Environment")=&lt;environment: R_GlobalEnv&gt; 
    .. ..- attr(*, "predvars")= language list(iris$Species, Sepal.Length, Sepal.Width, Petal.Length, Petal.Width)
    .. ..- attr(*, "dataClasses")= Named chr [1:5] "factor" "numeric" "numeric" "numeric" ...
    .. .. ..- attr(*, "names")= chr [1:5] "iris$Species" "Sepal.Length" "Sepal.Width" "Petal.Length" ...
   - attr(*, "class")= chr [1:2] "svm.formula" "svm"
  &gt; str(iris.res)
  List of 2
   $ key: NULL
   $ val:List of 30
    ..$ call           : language svm(formula = v$Species ~ ., data = v)
    ..$ type           : num 0
    ..$ kernel         : num 2
    ..$ cost           : num 1
    ..$ degree         : num 3
    ..$ gamma          : num 0,25
    ..$ coef0          : num 0
    ..$ nu             : num 0,5
    ..$ epsilon        : num 0,1
    ..$ sparse         : logi FALSE
    ..$ scaled         : logi [1:4] TRUE TRUE TRUE TRUE
    ..$ x.scale        :List of 2
    .. ..$ scaled:center: Named num [1:4] 5,84 3,06 3,76 1,20
    .. .. ..- attr(*, "names")= chr [1:4] "Sepal.Length" "Sepal.Width" "Petal.Length" "Petal.Width"
    .. ..$ scaled:scale : Named num [1:4] 0,828 0,436 1,765 0,762
    .. .. ..- attr(*, "names")= chr [1:4] "Sepal.Length" "Sepal.Width" "Petal.Length" "Petal.Width"
    ..$ y.scale        : NULL
    ..$ nclasses       : int 3
    ..$ levels         : chr [1:3] "setosa" "versicolor" "virginica"
    ..$ tot.nSV        : int 51
    ..$ nSV            : int [1:3] 8 22 21
    ..$ labels         : int [1:3] 1 2 3
    ..$ SV             : num [1:51, 1:4] -1,743 -1,864 -0,173 -0,535 -1,501 ...
    .. ..- attr(*, "dimnames")=List of 2
    .. .. ..$ : chr [1:51] "9" "14" "16" "21" ...
    .. .. ..$ : chr [1:4] "Sepal.Length" "Sepal.Width" "Petal.Length" "Petal.Width"
    ..$ index          : int [1:51] 9 14 16 21 23 24 26 42 51 53 ...
    ..$ rho            : num [1:3] -0,0203 0,1312 -0,0629
    ..$ compprob       : logi FALSE
    ..$ probA          : NULL
    ..$ probB          : NULL
    ..$ sigma          : NULL
    ..$ coefs          : num [1:51, 1:2] 0,0891 0,0000 0,8652 0,0000 0,0000 ...
    ..$ na.action      : NULL
    ..$ fitted         : Factor w/ 3 levels "setosa","versicolor",..: 1 1 1 1 1 1 1 1 1 1 ...
    .. ..- attr(*, "names")= chr [1:150] "1" "2" "3" "4" ...
    ..$ decision.values: num [1:150, 1:3] 1,20 1,06 1,18 1,11 1,19 ...
    .. ..- attr(*, "dimnames")=List of 2
    .. .. ..$ : chr [1:150] "1" "2" "3" "4" ...
    .. .. ..$ : chr [1:3] "setosa/versicolor" "setosa/virginica" "versicolor/virginica"
    ..$ terms          :Classes 'terms', 'formula' length 3 v$Species ~ Sepal.Length + Sepal.Width + Petal.Length + Petal.Width
    .. .. ..- attr(*, "variables")= language list(v$Species, Sepal.Length, Sepal.Width, Petal.Length, Petal.Width)
    .. .. ..- attr(*, "factors")= int [1:5, 1:4] 0 1 0 0 0 0 0 1 0 0 ...
    .. .. .. ..- attr(*, "dimnames")=List of 2
    .. .. .. .. ..$ : chr [1:5] "v$Species" "Sepal.Length" "Sepal.Width" "Petal.Length" ...
    .. .. .. .. ..$ : chr [1:4] "Sepal.Length" "Sepal.Width" "Petal.Length" "Petal.Width"
    .. .. ..- attr(*, "term.labels")= chr [1:4] "Sepal.Length" "Sepal.Width" "Petal.Length" "Petal.Width"
    .. .. ..- attr(*, "order")= int [1:4] 1 1 1 1
    .. .. ..- attr(*, "intercept")= num 0
    .. .. ..- attr(*, "response")= int 1
    .. .. ..- attr(*, ".Environment")=&lt;environment: 0xb639820&gt; 
    .. .. ..- attr(*, "predvars")= language list(v$Species, Sepal.Length, Sepal.Width, Petal.Length, Petal.Width)
    .. .. ..- attr(*, "dataClasses")= Named chr [1:5] "factor" "numeric" "numeric" "numeric" ...
    .. .. .. ..- attr(*, "names")= chr [1:5] "v$Species" "Sepal.Length" "Sepal.Width" "Petal.Length" ...
  </code></pre>
  
  <p>But how to convert the result list to the same class as usual smv call?</p>