Modeling by "lda" in R
0
0
Entering edit mode
2.4 years ago

I'm trying to train my data of gene expression based on cancer Recurrence(R) or Non-Recurrence(NR). My dataset that I'm working on :

dim(all_C) [1] 87 11

87 samples and 10 Genes(a column is called "Condition", which shows that each sample is R or NR. I used these commands:

trainset <- sapply(unique(all_C$Condition), function (S) sample(which(all_C$Condition==S), 20))

trainset <- as.numeric(trainset)

table(all_2[trainset, "Condition"])

testset <- setdiff(seq(87),trainset)

any(testset %in% trainset)

library(MASS)

model.lda <- lda(all_C[trainset,-11] , grouping = all_C[trainset,11] )

predict.lda <- predict(model.lda , all_C[testset, 1:10])

But I get this error:

Error in FUN(x, aperm(array(STATS, dims[perm]), order(perm)), ...) : non-numeric argument to binary operator

Would you help me, please?

lda testset trainset MASS • 463 views
ADD COMMENT

Login before adding your answer.

Traffic: 1480 users visited in the last hour
Help About
FAQ
Access RSS
API
Stats

Use of this site constitutes acceptance of our User Agreement and Privacy Policy.

Powered by the version 2.3.6