You did not put the altered columns back into the data.frame,
so glm() never saw them. Does the following work?
func <- function(x,y,z) {
#x is a data frame
#y is a formula for the regression
#z vector of names of columns of x to convert to factors
for (name in z) {
x[[name]] <- facto
Hello,
I am passing a df to a function and then want to declare factors (based on
a vector of column names in the df) for a logistic regression. I am having
trouble - R doesn't seem to recognize the factors as declared in the
function? Below is my code. Does anyone have any ideas?
MyFunction <-
2 matches
Mail list logo