# load the library and data
library('MASS')
library('sqldf')
data(fgl, package = 'MASS')
df <- data.frame(fgl)
# (a)select chosen glass types
#adf <- sqldf("select * from df where type='WinF' or type='WinNF' or type='Veh' or type='Head'")
adf <- subset(df, type=="WinF"|type=="WinNF"|type=="Veh"|type=="Head")
traindata <- adf[1:128,]
testdata <- adf[129:192,]
#typetesting <- adf$type[129:192,]
# LDA
# fit the qad model based on the training
qdamodel = qda(type~RI+Na+Mg+Al+Si+K+Ca+Ba+Fe, data=traindata)
I have an error
Error in qda.default(x, grouping, ...) :
some group is too small for 'qda'
I use both the sqldf
and subset
function, but they don't work. Thanks.