【发布时间】:2019-01-17 23:35:33
【问题描述】:
我正在尝试绘制许多图表,但在引用 data.frame 的元素时出现错误。
我不想手动更改变量名称,而是要循环并引用特定的变量名称。
当我这样做时,我得到“未定义的列已选择”错误。
当我运行这段代码时,我得到了正确的情节:
xy <- lm(Unfairness_Scale ~ OS_ImpCoreV_A * ImpCoreV_A, data =
branch_annual)
with(branch_annual, interact_plot(xy, pred = OS_ImpCoreV_A, modx =
ImpCoreV_A))
当我运行此代码时,我收到“未定义的列已选择”错误:
xy <- lm(branch_annual$Unfairness_Scale ~ branch_annual$OS_ImpCoreV_A *
branch_annual$ImpCoreV_A, data = branch_annual)
with(branch_annual, interact_plot(xy, pred = branch_annual$OS_ImpCoreV_A,
modx = branch_annual$ImpCoreV_A))
我尝试了几种不同的方法来引用数据框的元素,但我一直收到同样的错误。我没有正确理解什么?
谢谢,
塞巴斯蒂安
【问题讨论】:
-
请提供reproducible example,很难看出您的问题是什么/您想要什么。哪一行给出了错误?
lm还是interact_plot?interact_plot哪里来的?