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?
I'm not getting any issues when running this multiple times - have you tried using debug() or similar to try and diagnose which part of the function might be causing issues?
I'm on windows 10 also and the reprex renders normally, but lately it has been some issues with pandoc on windows systems with custom input methods, this is probably your case since you are using japanese.
I thought this was a problem of Windows, but your answers indicated it was not. Actually, it seems some Pandoc's bug. I found this because you suggested
have you tried using debug()
and, by debugging rmarkdown::pandoc_convert(), I saw it hanged here, which actually executes pandoc command by system().
Then, I guessed, if this was a pandoc's bug, this would be solved if I updated RStudio. Actually, I could render the reprex on the latest preview version of RStudio (v1.2.1244, pandoc version: 2.5). So, it seems something was wrong with the pandoc I used (pandoc version: 2.1.3, bundled in RStudio v1.2.1114).
If your question's been answered (even by you!), would you mind choosing a solution? It helps other people see which questions still need help, or find solutions if they have similar problems. Here’s how to do it: