错误:尝试应用不起作用 [英] Error:attempt to apply non-function

查看:71
本文介绍了错误:尝试应用不起作用的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试在R中运行以下代码,但出现错误.

I'm trying to run the following code in R, but I'm getting an error.

我不确定公式的哪一部分不正确.任何帮助将不胜感激.

I'm not sure what part of the formula is incorrect. Any help would be greatly appreciated.

> 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

推荐答案

表达式的后两项缺少 * ,因此R正在解释(例如) 0.207(log(DIAM93))^ 2 作为调用名为 0.207 ...

You're missing *s in the last two terms of your expression, so R is interpreting (e.g.) 0.207 (log(DIAM93))^2 as an attempt to call a function named 0.207 ...

例如:

> 1 + 2*(3)
[1] 7
> 1 + 2 (3)

错误:尝试应用无效功能

Error: attempt to apply non-function

您的(不可复制的)表达应为:

Your (unreproducible) expression should read:

censusdata_20$AGB93 = WD * exp(-1.239 + 1.980 * log (DIAM93) + 
                              0.207* (log(DIAM93))^2  -
                              0.0281*(log(DIAM93))^3)

Mathematica是我所知道的唯一允许并置用于乘法的计算机系统...

Mathematica is the only computer system I know of that allows juxtaposition to be used for multiplication ...

这篇关于错误:尝试应用不起作用的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆