The code below cannot be reprex()ed (doesn't raise error, but waits forever) on my Windows (using the dev versions of tibble, pillar, locale is Japanese_Japan.932), but I cannot find the cause so far. It's really wierd that if I repeat bundle_column() 3 times or 5 times, it succeeds. But, if 4 times, it won't.
Does this succeeds on other OS?
bundle_column <- function(data, ..., .key = "data") {
key_var <- rlang::as_string(rlang::ensym(.key))
bundle_vars <- unname(tidyselect::vars_select(names(data), ...))
group_vars <- setdiff(names(data), bundle_vars)
out <- dplyr::select(data, !!! rlang::syms(group_vars))
out[[key_var]] <- dplyr::select(data, !!! rlang::syms(bundle_vars))
out
}
library(dplyr, warn.conflicts = FALSE)
iris <- tibble::as_tibble(iris)
# If the repetition is 3 times or 5 times, it succeeds. But, 4 won't...
bundle_column(iris, -Species)
bundle_column(iris, -Species)
bundle_column(iris, -Species)
bundle_column(iris, -Species)
If I use the bare data.frame, this succeeds. So I guess this is basically a problem from somewhere in between tibble and pandoc. Do you know similar kind of issues?
Backtrace:
x
1. \-reprex::reprex()
2. \-rmarkdown::render(...)
3. \-rmarkdown:::convert(output_file, run_citeproc)
4. \-rmarkdown::pandoc_convert(...)