This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Homebrew build logs for python@3.11 on macOS 13 | |
Build date: 2023-04-02 14:50:46 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Homebrew build logs for python@3.11 on macOS 13 | |
Build date: 2023-04-02 14:50:46 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Prototype of `source()` as currently implemented | |
source2 <- function(file, env = parent.frame()) { | |
exprs <- parse(file) | |
for (expr in exprs) { | |
eval(expr, env) | |
} | |
} | |
# Prototype of `source()` using an evaluation strategy where the | |
# unwinding scope is the whole file rather than each line |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
makeDelayedBinding <- function(sym, | |
expr, | |
eval.env = parent.frame(1), | |
assign.env = parent.frame(1)) { | |
expr <- substitute(expr) | |
value <- NULL | |
forced <- FALSE | |
forceDelayed <- function() { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# The general idea is to supply a recoding specification through a | |
# data frame of keys and values. They keys are a generalisation of | |
# names, they can be any type. | |
keys <- function(key, value) { | |
tibble::tibble(.key = key, .value = value) | |
} | |
dribbleys <- function(...) { | |
tibble::tribble(~ .key, ~ .value, ...) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Simple DT wrapper | |
summarise <- function(data, j, by) { | |
data <- data.table::as.data.table(data) | |
data[ | |
i = , | |
j = eval(substitute(j)), | |
by = eval(substitute(by)) | |
] | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
truncate_len <- function(x, n) { | |
if (length(x) < n) { | |
stop("Can't truncate vector to the given length because it is already shorter") | |
} | |
x[seq_len(n)] | |
} | |
truncate_along <- function(x, y) { | |
truncate_len(x, length(y)) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Actually does not work because quosured magrittr pronouns are not | |
# evaluated in the right environment | |
library("magrittr") | |
library("rlang") | |
# Anticipate renaming of `quo_is_lang()` in rlang | |
quo_is_call <- quo_is_lang |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
depend <- function(..., character.only = FALSE) { | |
# Mimic library()'s UI | |
if (character.only) { | |
packages <- c(...) | |
} else { | |
packages <- substitute(c(...))[-1] | |
if (!all(vapply(packages, is.symbol, logical(1)))) { | |
stop("Can't supply expressions if `character.only` is FALSE") | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
library("rlang") | |
#' @import rlang | |
`%>%` <- function(x, y) { | |
lhs <- rlang:::captureArg(x) | |
lhs_value <- eval_bare(lhs$expr, lhs$env) | |
NewerOlder