if (FALSE) {
#Add isSetosa column to iris data frame
iris2 <- iris
iris2$isSetosa <- ifelse(iris2$Species=="setosa", 1, 0)
#Store the iris2 data frame in the IRIS2 table
idf <-as.ida.data.frame(iris2, table="IRIS2", clear.existing=T, rownames="ID")
#Calculate GLM model in-db
glm <- idaGlm(isSetosa~PetalLength+SepalLength*SepalWidth+PetalWidth, idf, id="ID")
#Print the model
print(glm)
#Apply the model to data
idf2 <- predict(glm, idf, "ID")
#Inspect the results
head(idf2)
}
Run the code above in your browser using DataLab