invalid subscript type 'list'

Hi. I'm new to R and I'm trying to run an LDA model but I get the error "Error in xj[i]: invalid subscript type 'list'". Can anyone help me, please?

The code I'm using is:

head(insurance_classification)
View(insurance_classification)
#######

train=insurance_classification[1:1000,]
test=insurance_classification[1001:1338,]

lda.fit=lda(category~.,data=insurance_classification,subset=train)
lad.fit

train is a data frame, so setting subset=train causes the error. Since you already made a subset of the data, try this

lda.fit=lda(category~., data=train)

it works now! Thank you FJCC!

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.

If you have a query related to it or one of the replies, start a new topic and refer back with a link.