我正在尝试在R中运行以下代码,但是我收到了一个错误.
我不确定公式的哪一部分是不正确的.任何帮助将不胜感激.
> censusdata_20$AGB93 = WD * exp(-1.239 + 1.980 * log (DIAM93) + 0.207 (log(DIAM93))^2
- 0.0281 (log(DIAM93))^3)
Error: attempt to apply non-function
Run Code Online (Sandbox Code Playgroud)
Ben*_*ker 39
您在*表达式的最后两个项中缺少s,因此R将(例如)解释0.207 (log(DIAM93))^2为尝试调用名为的函数0.207...
例如:
> 1 + 2*(3)
[1] 7
> 1 + 2 (3)
Error: attempt to apply non-function
Run Code Online (Sandbox Code Playgroud)
您的(不可复制的)表达式应为:
censusdata_20$AGB93 = WD * exp(-1.239 + 1.980 * log (DIAM93) +
0.207* (log(DIAM93))^2 -
0.0281*(log(DIAM93))^3)
Run Code Online (Sandbox Code Playgroud)
Mathematica是我所知道的唯一一个允许并置用于乘法的计算机系统......