The input is a table of measured xi's and one y-variable;
Knime is linked to MS R Open 3.4
This is the code:
library(MASS)
library(bootStepAIC)
dat <- knime.in
names(dat)<-make.names(names(dat)) #fix column names so [R] won't bomb out.
trg<-make.names(knime.flow.in[["target"]]) # = 'y'
limit<-knime.flow.in[["steps"]] # = 3, prevent over-fit
cn <- names(dat)
xVars<-cn[cn!=trg] # get list of x-vars, x1,x2,x3...
f1<-as.formula(paste(trg,'~1'))
f2<-as.formula(paste(trg,'~',paste(xVars,collapse="+")))
strt<-do.call("lm",list(f1,data=dat))
# Even in R-studio, this appears to fail
# unless I put strt<-lm(y~1,dat), but I need to be
# able to build this, as won't always be callled 'y'
# the do.call does not help :-(
bst <- boot.stepAIC(strt,dat,B=50,alpha=0.05,direction='forward',steps=limit,
scope=list(lower=f1,upper=f2))
#the model fit failed in 50 bootstrap samples
#Error: non-character argument
b1 <- bst$Covariates
b2 <- bst$Sign
b3 <- bst$Significance
ball <- cbind.data.frame(b1,b2,b3)
knime.out <- ball