如何判断您在R中使用了哪些软件包

编程入门 行业动态 更新时间:2024-10-26 12:31:43
本文介绍了如何判断您在R中使用了哪些软件包的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧! 问题描述

我有一个很长的R脚本,其中包含许多if语句和异常情况.正如我一直在走的,如果我一直在导入和测试库,并且还没有对它们做过很好的记录.问题是,如果我从全新安装运行此脚本,则不确定脚本将运行哪些语句,以及需要哪些库.

I have a very long R script with many if statements and exception cases. As i've been going, if been importing and testing libraries as I've gone and haven't really documented them very well. The problem is that if I run this from a clean installation, i'm not sure which statements the script will run, and so which libraries will be needed.

我的问题是:是否有R函数可以测试脚本中正在使用哪些库?

My question is: Is there any R function to test which libraries are being used in a script?

我还没有使用所有已安装的库,所以print(sessionInfo())不会有用,但是我只想使用install.packages函数启动脚本

I have not used all of the libraries that have been installed so print(sessionInfo()) won't be useful but and I just want to start the script with an install.packages function

推荐答案

我发现NCmisc(install.packages("NCmisc"))的list.functions.in.file()函数对此很有帮助:

I found the list.functions.in.file() function from NCmisc (install.packages("NCmisc")) quite helpful for this:

list.functions.in.file(filename, alphabetic = TRUE)

有关更多信息,请参见以下链接: rdrr .io/cran/NCmisc/man/list.functions.in.file.html

For more info see this link: rdrr.io/cran/NCmisc/man/list.functions.in.file.html

更多推荐

如何判断您在R中使用了哪些软件包

本文发布于:2023-10-23 00:20:42,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1519182.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:软件包   您在   如何判断   使用了

发布评论

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

>www.elefans.com

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