i created a GUI for regression analysis.
svalue(tbl[2,1]) : accept a .csv input file
svalue(tbl[4,1]) : provide a dependent variable
enter code here
selected_var=read.csv(svalue(svalue(tbl[2,1]))
sv=selected_var
sv_regression=data.frame(sv)
glm1<<-glm(svalue(tbl[4,1]) ~ . ,data = sv_regression,family = poisson)
reg<<-summary.glm(glm1)$coefficients
reg_result <<-gtable(reg)
add(frame1,reg_result,expand=TRUE)
now run this code, i got an error
Error in terms.formula(formula, data = data) : '.' in formula and no 'data' argument
glm()
and other modelling functions need a formula in this structure:`glm(var1 ~ ., data = sv_regression, family = poisson)
Where
var1
should be the name of the response variable you are trying to predict. Without knowing whattbl
andsvalue
are I can't see exactly what's going wrong (I suspect at least three things), but you need to structure your data in a way that you know in advance the name of the variable to be on the left side of the formula in your statistical model.For example, given you are dependent on the user choosing things in the GUI, you could rename the column in
sv_regression
that is to be the response variable asy
(or something more distinctive that has less chance of causing a conflict with an existing name), before you callglm
. Then when you callglm
you know that it will byglm(y ~ ., ...)