Navigation | Overlay |
---|---|
t Navigate files | h Toggle hits |
y Change url to tip of branch | m Toggle misses |
b / v Jump to prev/next hit line | p Toggle partial |
z / x Jump to prev/next missed or partial line | 1..9 Toggle flags |
shift + o Open current page in GitHub | a Toggle all on |
/ or ? Show keyboard shortcuts dialog | c Toggle context lines or commits |
1 |
#' Extract function(s) from a functional sequence.
|
|
2 |
#'
|
|
3 |
#' Functional sequences can be subset using single or double brackets.
|
|
4 |
#' A single-bracket subset results in a new functional sequence, and
|
|
5 |
#' a double-bracket subset results in a single function.
|
|
6 |
#'
|
|
7 |
#' @rdname fseq
|
|
8 |
#' @param x A functional sequence
|
|
9 |
#' @param ... index/indices. For double brackets, the index must be of length 1.
|
|
10 |
#' @return A function or functional sequence.
|
|
11 |
#' @export
|
|
12 |
`[[.fseq` <- function(x, ...) |
|
13 |
{
|
|
14 |
functions(x)[[...]] |
|
15 |
}
|
|
16 |
|
|
17 |
#' @rdname fseq
|
|
18 |
#' @export
|
|
19 |
`[.fseq` <- function(x, ...) |
|
20 |
{
|
|
21 |
y <- x
|
|
22 |
environment(y) <- new.env(parent = parent.env(environment(x))) |
|
23 |
environment(y)[["_function_list"]] <- functions(x)[...] |
|
24 |
y |
|
25 |
}
|
Read our documentation on viewing source code .