r - using paste() in a for loop with glm -
in code below, df.pts dataframe. i'd run dozen glm models using different y variable (only 2 shown in code). i'm using loop paste() function, can't seem paste() function work properly. missing paste()?
spca2 = df.pts[,3] clqu2 = df.pts[,4] df.list = list(spca2, clqu2) (i in df.list) { qp.mod = glm(paste(i,"~ndvi+elev"), family="quasipoisson", data=my.data) print(summary(gp.mod)) }
many thanks! main problem df.list list of vectors, , should have been list of names.
i other words, correct problem...
df.list = ("spca2", "clqu2")
instead of
df.list = list(spca2, clqu2)
however, correctly pointed out dataframe, my.data, not correct dataframe. finally, while worked without it, function as.formula() worked. again, many thanks!