数据表错误找不到函数“."

编程入门 行业动态 更新时间:2024-10-11 15:20:02
本文介绍了数据表错误找不到函数“."的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧! 问题描述

我正在尝试运行以下代码.每当我尝试运行代码时,都会出现以下错误:Error in eval(expr, envir, enclos) : could not find function "."我该如何解决?有人可以帮忙吗?

I am trying to run the following piece of code. Whenever I try to run the code I get the following error: Error in eval(expr, envir, enclos) : could not find function "." How can I fix it? Could someone help?

data(mtcars) library(data.table) mtcarsDT <- data.table(mtcars) mtcarsDT[ mpg > 20, .(AvgHP = mean(hp), "MinWT(kg)" = min(wt * 453.6)), # wt lbs by = .(cyl, under5gears = gear < 5) ]

这是会话信息

> sessionInfo() R version 3.1.2 (2014-10-31) Platform: x86_64-apple-darwin10.8.0 (64-bit) locale: [1] en_US.UTF-8/en_US.UTF-8/en_US.UTF-8/C/en_US.UTF-8/en_US.UTF-8 attached base packages: [1] stats graphics grDevices utils datasets methods base other attached packages: [1] data.table_1.9.2 loaded via a namespace (and not attached): [1] digest_0.6.8 htmltools_0.2.6 plyr_1.8.1 Rcpp_0.11.3 reshape2_1.4.1 rmarkdown_0.3.3 stringr_0.6.2 [8] tools_3.1.2

推荐答案

显然我在 2.5 年前提供的说明仍然适用于使用过时版本的 Mac R 的人.假设你有 Xcode 和命令行工具安装后,您需要首先 a) 重新启动 R(不加载任何版本的 data.table.、reshape2 和 dplyr),或 b) 删除任何可能与测试加载新包的能力冲突的已加载命名空间:

Apparently the instructions I offered 2.5 years ago are still current for people using out-of-date versions of Mac R. Assuming you have Xcode and the Command Line Tools installed, you need to first either a) restart R (without loading any of the versions of data.table., reshape2, and dplyr), or b) remove any loaded Namespaces that might conflict with the ability to test-load the new packages:

unloadNamespace('data.table') unloadNamespace('reshape2') unloadNamespace('plyr')

然后从源代码构建:

install.packages("data.table", type="source", dependencies=TRUE)

在安装二进制包时从源代码构建可能会起作用的原因可能是前一种策略可以让您更好地检查版本依赖关系.

The reason that building from source might work when installing a binary package might not is that the former strategy gets you better checking for version dependencies.

更多推荐

数据表错误找不到函数“."

本文发布于:2023-07-09 21:15:27,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1088235.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:找不到   函数   数据表   错误   quot

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!