我在哪里可以找到关于`.. * ..`ggplot选项的文档?

时间:2023-02-11 15:04:29

I use ..density.. from time to time, and it's great. There's lots of examples of it in the ggplot2 book, as well as ..count... Looking through the stat_density documentation, I learned about ..scaled... Seeing someone use ..n.. here on *, I found out about that. Now I just wonder what else I'm missing.

我不时使用..density ..而且很棒。在ggplot2书中有很多例子,以及..count ...通过stat_density文档,我了解了..scaled ...看到有人在*上使用..n ..我发现了关于那个。现在我只是想知道我还缺少什么。

Search engines seem to ignore the .s in search strings like "..n.. ggplot2", even if I escape them. Is there a general term for these variables? Are there more? Where can I find documentation on them?

搜索引擎似乎忽略了搜索字符串中的.s,例如“..n .. ggplot2”,即使我将它们转义。这些变量有一个通用术语吗?还有更多吗?我在哪里可以找到关于它们的文档?

1 个解决方案

#1


18  

Here are all of the ..*.. options mentioned in the ggplot2 help files (or at least those help files that can be brought up by typing ?"<func>", where "<func>" refers to one of the functions exported by ggplot2).

以下是ggplot2帮助文件中提到的所有.. * ..选项(或者至少是那些可以通过键入来启动的帮助文件?“ ”,其中“ ”指的是其中一个函数由ggplot2导出)。

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.."   

Or, to find out which help files document which ..*.., run this:

或者,找出哪个帮助文件记录哪个.. * ..,运行这个:

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]

#1


18  

Here are all of the ..*.. options mentioned in the ggplot2 help files (or at least those help files that can be brought up by typing ?"<func>", where "<func>" refers to one of the functions exported by ggplot2).

以下是ggplot2帮助文件中提到的所有.. * ..选项(或者至少是那些可以通过键入来启动的帮助文件?“ ”,其中“ ”指的是其中一个函数由ggplot2导出)。

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.."   

Or, to find out which help files document which ..*.., run this:

或者,找出哪个帮助文件记录哪个.. * ..,运行这个:

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]