如题,R语言[size=13.3333px]gam(data[,52]~s(data[,67])+age+gender, data=data, method="REML")错误提示[size=13.3333px]Error in variable.summary(gp$pf, dl, nrow(mf)) :
'list' object cannot be coerced to type 'double'
但是用typeof验证变量就是“double”?typeof(data[,52]) [1] "double"
尝试后发现如果用data$的格式就可以跑,因为希望用for循环跑模型,变量需要用data[,i]的格式写,想知道原因和可行的方法。