找出使用某个包中的哪些功能

时间:2016-05-17 07:12:30

标签: r packages

有没有办法找出在当前会话中调用某个包中的哪些函数?

(我正在以不同的顺序采购各种脚本,并且由于加载问题而希望停止使用任何plyr函数 - plyr - 之后 - dplyr - 问题,但它通过所有脚本找出我实际使用的plyr - 函数似乎有点乏味。)

1 个答案:

答案 0 :(得分:3)

来自list.functions.in.file{NCmisc}package函数似乎可以满足您的需求。它返回脚本中使用的所有函数的列表,并返回它们所包含的包。

示例:当您通过此虚拟代码运行该函数(保存为R脚本)时,该代码运行一些包含var permissions = [ 'email', 'user_friends' ].join(','); FB.login(function (response) { // if login was successful, execute the following code if (response.authResponse) { //Perform next set of methods } }, {scope: permissions}); {ggplot2}{dplyr}函数的示例。

{tidyr}

您将以下列表作为输出:

# ggplot2 examples
library(ggplot2) 
ggplot(data = cars, aes(x = speed, y = dist)) + geom_point()
qplot(data = diamonds, x = carat, y = price, color = color)

#dplyr examples
library(dplyr)
filter(mtcars, cyl == 8)
select_(iris, "Petal.Length")

#tidyr examples
library(tidyr)
gather(iris, key = flower_att, value = measurement,
       Sepal.Length, Sepal.Width, Petal.Length, Petal.Width)

df <- data.frame(x = c("a", "b"), y = c(3, 4), z = c(5, 6))
df %>% spread(x, y) %>% gather(x, y, a:b, na.rm = TRUE)
相关问题