I have a few large data files I'd like to sample when loading into R. I can load the entire data set, but it's really too large to work with. sample
does roughly the right thing, but I'd like to have to take random samples of the input while reading it.
I can imagine how to build that with a loop and readline and what-not but surely this has been done hundreds of times.
Is there something in CRAN or even base that can do this?