Hello, Far from the "absolute fastest" but apparently portable,
big <- function(con, n, pass=5000){ if(file.exists(con)) unlink(con) fc <- file(con, "wb") on.exit(close(fc)) m <- n %/% pass r <- n %% pass replicate(m, writeBin(double(pass), fc)) if(r) writeBin(double(r), fc) invisible(n) } system.time(big("zeros", n=1e7 + 1L)) user system elapsed 0.07 0.06 0.14 Changing the default 'pass' doesn't make it faster. (On my system, Win7, R 14.2.) Rui Barradas -- View this message in context: http://r.789695.n4.nabble.com/Quickest-way-to-make-a-large-empty-file-on-disk-tp4604598p4604690.html Sent from the R help mailing list archive at Nabble.com. ______________________________________________ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.