We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
funpaste <- function(invec, sep = ",") { VEC <- as.character(invec) ana <- if (anyNA(VEC)) is.na(VEC) else NULL anb <- !nzchar(VEC) if (is.null(ana) & !any(anb)) { VEC <- if (requireNamespace("stringi", quietly = TRUE)) { stringi::stri_flatten(VEC, collapse = "\n") } else { # nocov start .strflat(VEC) # nocov end } } else { if (!is.null(ana)) VEC[which(ana)] <- sep if (any(anb)) VEC[which(anb)] <- sep VEC <- if (requireNamespace("stringi", quietly = TRUE)) { stringi::stri_flatten(VEC, collapse = "\n") } else { # nocov start .strflat(VEC) # nocov end } } fread(VEC, sep = sep, fill = TRUE, blank.lines.skip = FALSE, header = FALSE, encoding = "UTF-8", logical01 = FALSE) } funtemp <- function(invec) { on.exit(rm(a)) on.exit(gc()) a <- tempfile() fwrite(as.data.table(invec), file = a, quote = FALSE, nThread = 4) fread(a, fill = TRUE, skip = 1, header = FALSE, nThread = 4) } library(microbenchmark) microbenchmark(funpaste(x), funtemp(x)) funpaste(y) funtemp(y)
The text was updated successfully, but these errors were encountered:
No branches or pull requests
The text was updated successfully, but these errors were encountered: