创建一个新列等于 R 中另一列的对数
如标题所示。我尝试通过取名为“level”的现有列的对数来创建一个名为 level_log 的新列 我尝试过:
chol$level_log <-chol$log(level)
但它显示:
Warning: Unknown or uninitialised column: `log`.
Error: attempt to apply non-function
这里有什么问题? 提前致谢
As titled.I tried to create a new column called level_log by taking the logarithm of an existing column named "level"
I tried:
chol$level_log <-chol$log(level)
But it shows:
Warning: Unknown or uninitialised column: `log`.
Error: attempt to apply non-function
What's the problem here?
Thanks in advance
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
我相信您需要将整个
chol$level
包装在日志中,而不仅仅是列,即将chol$level_log <-chol$log(level)
更改为
< code>chol$level_log <-log(chol$level)
发生这种情况是因为 R 本身不知道级别是什么。如果您加载了多个数据,并且其中几个数据具有名为 level 的列,该怎么办?为了避免这种混淆,它要求您指定您所指的确切列,包括该列的来源。
I believe you need to wrap your entire
chol$level
in a log rather than only the column, i.e. changechol$level_log <-chol$log(level)
to
chol$level_log <-log(chol$level)
This is happening because R doesn't know what level is on its own. What if you had multiple data loaded and several of them had a column called level? In order to avoid this confusion it requires that you specify the exact column you mean, including where that column comes from.