在 R 中以交互方式获取库的内容

发布于 2024-08-12 21:39:34 字数 275 浏览 11 评论 0原文

R 中是否有相当于 dir 函数(python)的函数?

当我在 R 中加载库时,例如 -

库(vrtest)

我想知道该库中的所有函数。

在Python中,dir(vrtest)将是vrtest的所有属性的列表。

我想总的来说,我正在寻找在 Linux 上的 ESS 中运行 R 时获得 R 帮助的最佳方法。我看到了我已安装的软件包的所有这些手册页,但我不确定如何访问它们。

谢谢

Is there an equivalent of dir function (python) in R?

When I load a library in R like -

library(vrtest)

I want to know all the functions that are in that library.

In Python, dir(vrtest) would be a list of all attributes of vrtest.

I guess in general, I am looking for the best way to get help on R while running it in ESS on linux. I see all these man pages for the packages I have installed, but I am not sure how I can access them.

Thanks

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(3

情愿 2024-08-19 21:39:34

help(package = packagename) 将列出包中的所有非内部函数。

help(package = packagename) will list all non-internal functions in a package.

请止步禁区 2024-08-19 21:39:34

是的,使用ls()

您可以使用 search() 查看搜索路径中的内容:

> search() 
[1] ".GlobalEnv"        "package:stats"     "package:graphics"
[4] "package:grDevices" "package:utils"     "package:datasets"
[7] "package:methods"   "Autoloads"         "package:base"

您可以使用全名搜索特定包:

 > ls("package:graphics")
 [1] "abline"          "arrows"          "assocplot"       "axis"
 ....

我还建议 您在 stackoverflow 上查看此相关问题,其中包括一些更有创意的浏览环境的方法。如果您使用 ESS,则可以使用 Ess-rdired。

要获取特定主题的帮助页面,您可以使用 help(function.name)?function.name。如果您不知道确切的函数名称或包,您还会发现 help.search() 函数很有用。最后,看看 sos 包。

Yes, use ls().

You can use search() to see what's in the search path:

> search() 
[1] ".GlobalEnv"        "package:stats"     "package:graphics"
[4] "package:grDevices" "package:utils"     "package:datasets"
[7] "package:methods"   "Autoloads"         "package:base"

You can search a particular package with the full name:

 > ls("package:graphics")
 [1] "abline"          "arrows"          "assocplot"       "axis"
 ....

I also suggest that you look at this related question on stackoverflow which includes some more creative approaching to browsing the environment. If you're using ESS, then you can use Ess-rdired.

To get the help pages on a particular topic, you can either use help(function.name) or ?function.name. You will also find the help.search() function useful if you don't know the exact function name or package. And lastly, have a look at the sos package.

我们的影子 2024-08-19 21:39:34
help(topic) #for documentation on a topic
?topic

summary(mydata) #an overview of data objects try

ls() # lists all objects in the local namespace

str(object) # structure of an object
ls.str() # structure of each object returned by ls()

apropos("mytopic") # string search of the documentation

全部来自 R 参考卡

help(topic) #for documentation on a topic
?topic

summary(mydata) #an overview of data objects try

ls() # lists all objects in the local namespace

str(object) # structure of an object
ls.str() # structure of each object returned by ls()

apropos("mytopic") # string search of the documentation

All from the R reference card

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文