Hello,
as you can imagine, I am new to R. I have a problem plotting the results of my
svm classification of microarray data.
So, I have a matrix of 30 rows (samples) and 306 columns (significant genes). I
transform the matrix to a data frame in order to do the classification.
My code is:
data<-t(significantGenes)
labels<-gl(2,20,30)
data<-data.frame(data)
svm.cross <- svm(data, labels, type="C-classification", kernel="polynomial",
degree=5, gamma=0.5, coef0=1, cross=10)
This code works great!
But when I try to plot the results (using many different ways listed online), I
get the following error:
"Error in terms.default(x) : no terms component nor attribute"
Here is SOME of the ways I've tried to plot the result:
plot(svm.cross, data, formula = V1~V2)
plot(svm.cross, data, formula = V1~V2, slice = list(V1=2,V2=2))
plot(svm.cross, data, formula = data[,1]~data[,2])
and
plot(svm.cross, data,formula=data["V1"]~data[V2]) with error: "Error in
model.frame.default(formula, data) :
invalid type (list) for variable 'data["V1"]'"
Note that str(data) gives: 'data.frame': 30 obs. of 306 variables:
$ V1 : num 10.8 10.3 12.5 12.7 11.7 ...
$ V2 : num 9.5 10.34 11.25 11.56 9.74 ...
$ V3 : num 9.36 11.67 10.52 11.57 10.25 ...
$ V4 : num 9.25 8.52 10.61 11.21 9.84 ...
etc.
Thank you so much for your response.
Kind regards,
Despina
[[alternative HTML version deleted]]
______________________________________________
[email protected] mailing list -- To UNSUBSCRIBE and more, see
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.