[R] Creating DataFrame of Vectors Data Structure for Classification

Gundala Viswanath gundalav at gmail.com
Mon Jul 5 13:50:19 CEST 2010


Dear Experts,

I have a input file that looks like this

-0.438185,svm,1
-0.766791,svm,1
0.695282,svm,-1
0.759100,svm,-1
0.034400,svm,1
0.524807,svm,1
-0.27647800,nn,1
-0.16120810,nn,-1
0.63911350,nn,1
0.400554110,nn,1
0.429192240,nn,-1
0.454239140,nn,1

How can I create a data structure in R so that
it gives this:

> print(a_data_structure)
$hiv.svm
$hiv.svm$predictions
$hiv.svm$predictions[[1]]
  [1] -0.438185 -0.766791  0.695282
$hiv.svm$predictions[[2]]
  [1]  0.759100  0.034400  0.524807
$hiv.svm$labels
$hiv.svm$labels[[1]]
  [1]  1  1  -1
$hiv.svm$labels[[2]]
  [1]  -1  1  1
$hiv.nn
$hiv.nn$predictions
$hiv.nn$predictions[[1]]
  [1] -0.27647800 -0.16120810  0.63911350
$hiv.nn$predictions[[2]]
  [1]  0.400554110  0.429192240  0.454239140
$hiv.nn$labels
$hiv.nn$labels[[1]]
  [1]  1  -1  1
$hiv.nn$labels[[2]]
  [1]  1  -1  1

I'm new in R. Truly need help

Regards,
G. Viswanath



More information about the R-help mailing list