r - 试图进行方差分析
问题描述
所以我试图创建一个方差分析来确定人口变量的独立性。我的数据包含来自 4 个不同地区的多个国家。这是我一直在尝试的:
aov(Region ~ 'Population in thousands (2017)',data = anova.data)
我认为我做对了,但是,每次我得到:
Error in terms.formula(formula, "Error", data = data) : invalid term in model formula
任何帮助将不胜感激。
解决方案
aov()
期待一个?formula
. 除了打字和阅读速度更快之外,这也是为什么通常的做法是使变量名称尽可能短和简单,即没有空格或特殊字符的缩写。
aov(Region ~ `Population in thousands (2017)`, data = df)
# easier
aov(Region ~ Population_in_thousands_2017, data = df)
# easiest
aov(Region ~ pop2017, data = df)
推荐阅读
- javascript - swiper 滑块 - 作为一张幻灯片滑动,但包含 CSS
- average - 我计算移动平均线的 DAX 代码没有给出正确的结果
- kubernetes - 即使系统有可用空间,我也总是在 minikube 中出现“设备上没有剩余空间”问题,如何解决?
- android - 为什么我的 appbottombar 占用了我的整个布局高度
- oracle - 为什么sql一旦读超时,后面的查询总是很慢
- stm32 - AC6 eclipse - 使用 libopencm3 运行示例闪烁器的问题
- groovy - 如何在http响应中捕获空值
- java - Java Mocktio 在 eq(object) 验证失败,即使对象看起来相同
- linux - 使用 awk(或熟悉的)将多行合并为 1 行
- mysql - 如何在 mysql docker 映像中重置我的 root 密码