错误:在R中找不到功能 [英] Error: could not find function ... in R

查看:209
本文介绍了错误:在R中找不到功能的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用R并尝试 some.function 但我收到此错误消息:

I am using R and tried some.function but I got this error message :

Error: could not find function `some.function`

这个问题出现很经常当您得到错误:在R中找不到函数时,您如何解决?

This question comes up very regularly. When you get the error: could not find function in R, how can you solve it?

谢谢提前为您的帮助。

这是一个常见问题,所以请尽可能完整。答案是一个社区答案,如果你觉得缺少某些东西,请随时编辑。

HREF = https://meta.stackexchange.com/questions/101892/community-wiki-with-common-error-messages-allowed> https://meta.stackexchange.com/questions/101892/community-wiki-允许共同错误消息

推荐答案

有几件事你应该检查:


  1. 您的函数名称是否正确写入?名称区分大小写。

  2. 您是否安装了包含该功能的包? install.packages(thePackage)(这只需要完成一次)

  3. 您是否将该附件附加到工作区?
    require(thePackage)库(thePackage)(每当你启动一个新的R会话)

  1. Did you write the name of your function correctly? Names are case sensitive.
  2. Did you install the package that contains the function? install.packages("thePackage") (this only needs to be done once)
  3. Did you attach that package to the workspace ? require(thePackage) or library(thePackage) (this should be done every time you start a new R session)

如果您不确定该功能所在的包,您可以做一些事情。 >

If you're not sure in which package that function is situated, you can do a few things.


  1. 如果您确定已安装并加载正确的软件包,请键入 help.search(some.function ) ?? some.function 以获取一个信息框,可以告诉您包含哪个包。

  2. find getAnywhere 也可用于查找功能。

  3. 如果你没有关于包的线索,可以在 sos 包中使用 findFn ,如这个答案

  4. RSiteSearch(some.function)或使用 rseek 进行搜索替代方法找到该功能。

  1. If you're sure you installed and attached/loaded the right package, type help.search("some.function") or ??some.function to get an information box that can tell you in which package it is contained.
  2. find and getAnywhere can also be used to locate functions.
  3. If you have no clue about the package, you can use findFn in the sos package as explained in this answer.
  4. RSiteSearch("some.function") or searching with rseek are alternative ways to find the function.

这篇关于错误:在R中找不到功能的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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