gpt4 book ai didi

r - 在哪里可以找到有关ggplot选项的文档?

转载 作者:行者123 更新时间:2023-12-03 13:31:49 24 4
gpt4 key购买 nike

我不时使用..density..,这很棒。 ggplot2以及..count..中有很多示例。通过stat_density documentation,我了解了..scaled..。看到有人在StackOverflow上使用..n..时,我发现了这一点。现在我只是想知道我还缺少什么。

搜索引擎似乎忽略了诸如“ ..n .. ggplot2”之类的搜索字符串中的.,即使我对它们进行了转义。这些变量是否有通用术语?还有更多吗?在哪里可以找到有关它们的文档?

最佳答案

这是ggplot2帮助文件(或至少是通过键入..*..可以打开的帮助文件,其中?"<func>"表示ggplot2导出的功能之一)中提到的所有"<func>"选项。

library(ggplot2)

## Read all of the ggplot2 help files and convert them to character vectors
ex <- unlist(lapply(ls("package:ggplot2"), function(g) {
p = utils:::index.search(g, find.package(), TRUE)
capture.output(tools::Rd2txt(utils:::.getHelpFile(p)))
}))

## Extract all mentions of "..*.." from the character vectors
pat <- "\\.\\.\\w*\\.\\."
m <- gregexpr(pat, ex)
unique(unlist(regmatches(ex,m)))
# [1] "..density.." "..count.." "..level.." "..scaled.." "..quantile.."
# [6] "..n.."


或者,要找出哪些帮助文件记录了哪些 ..*..,请运行以下命令:

library(ggplot2)

ex <- sapply(ls("package:ggplot2"), function(g) {
p = utils:::index.search(g, find.package(), TRUE)
capture.output(tools::Rd2txt(utils:::.getHelpFile(p)))
}, simplify=FALSE, USE.NAMES=TRUE)

res <- lapply(ex, function(X) {
m <- gregexpr("\\.\\.\\w*\\.\\.", X)
unique(unlist(regmatches(X, m)))
})
res[sapply(res, length) > 0]

关于r - 在哪里可以找到有关ggplot选项的文档?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/18621393/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com