| pgrid_help | R Documentation |
expand.grid for paste and paste0Generate all combinations of the values of 2 or more vectors and glue the combinations into a single character vector.
pgrid_help()
pgrid(.p, ..., .ch = F, .crossed = F, .na = F)
pgrid0(..., .ch = F, .crossed = F, .na = FALSE)
pgrid1(..., .ch = F, .crossed = F, .na = FALSE)
pgridN(.p, ..., .ch = F, .na = FALSE)
pgridX(.p, ..., .ch = F, .na = FALSE)
.p |
A complete character scalar to use as the 'paste'. |
... |
Non-empty atomic objects. |
.ch, .na |
Non- |
.crossed |
|
A character vector.
pgrid(): Converts the N ... arguments to character (with additional optional pre-processing) and create a character vector with each element consisting of sub-strings from across ... arguments pasted together using the 'paste' .p. See the the .crossed argument section for how the value of .crossed affects the return value.
pgrid0(): Calls pgrid with .p = "" (blank).
pgrid1(): Calls pgrid with .p = " " (space).
pgridN(): Calls pgrid with .crossed = FALSE (see the .crossed argument).
pgridX(): Calls pgrid with .crossed = TRUE (see the .crossed argument).
.crossed ArgumentThe following console excerpt shows the effect of the value of .crossed:
> x <- c("A", "B", "C")
> y <- c(1, 2)
> z <- c("a", "b")
> p <- "."
> list(n = sort(pgrid(p, x, y, z, .crossed = FALSE)),
y = sort(pgrid(p, x, y, z, .crossed = TRUE )))
$n
[1] "A.1.a" "A.1.b" "A.2.a" "A.2.b" "B.1.a" "B.1.b"
[7] "B.2.a" "B.2.b" "C.1.a" "C.1.b" "C.2.a" "C.2.b"
$y
[1] "1" "1.a" "1.b" "2" "2.a" "2.b"
[7] "a" "A" "A.1" "A.1.a" "A.1.b" "A.2"
[13] "A.2.a" "A.2.b" "A.a" "A.b" "b" "B"
[19] "B.1" "B.1.a" "B.1.b" "B.2" "B.2.a" "B.2.b"
[25] "B.a" "B.b" "C" "C.1" "C.1.a" "C.1.b"
[31] "C.2" "C.2.a" "C.2.b" "C.a" "C.b"
Other strings:
blank(),
chn(),
delim(),
fsub(),
gr,
ipat(),
makestr(),
markdown_help(),
maxnch(),
ox(),
ox_vals(),
revstr(),
spaces(),
ss_help(),
tocase(),
weave()
x <- c("A", "B", "C")
y <- c(1, 2)
z <- c("a", "b")
pgrid(".", x, y, z, .crossed = F)
pgrid(".", x, y, z, .crossed = T)
pgridN(".", x, y, y)
pgridX(".", x, y, z)
pgrid0(x, y, z)
pgrid1(x, y, z)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.