Join GitHub today
GitHub is home to over 40 million developers working together to host and review code, manage projects, and build software together.Sign up
Document how to read and write to C level stdin and stderr #106
This is something that people working on the command line often want to do, e.g. https://stackoverflow.com/questions/9370609/piping-stdin-to-r
Unfortunately R makes this more difficult than other languages, as the
At a minimum we should document this in the getting started vignette or another vignette.
But potentially we could provide a nicer interface that would make this more automatic.
Some more alternatives
This works, not sure on the potential overhead
cat inst/extdata/mtcars.csv | Rscript -e 'cat(vroom::vroom_format(vroom::vroom(file("stdin"))))
This is likely the most efficient, but it hangs if the output is not redirected, because I think R's REPL uses stdout. just
cat inst/extdata/mtcars.csv | Rscript -e 'vroom::vroom_write(vroom::vroom(file("stdin")), file("/dev/stdout"))' > blah
As of 8077625 we can now use
cat inst/extdata/mtcars.csv | Rscript -e 'vroom::vroom_write(vroom::vroom(file("stdin")), stdout())' > blah
So we should show this and also some discussion of the difference between