Is it possible to write stdout using write_csv() from readr?
With write.table
and write.csv
from base R, you can specify the filename as ""
to print to STDOUT:
file: either a character string naming a file or a connection open for writing. ‘""’ indicates output to the console.
Example:
$ Rscript -e 'write.csv(head(mtcars),"",quote=F)',mpg,cyl,disp,hp,drat,wt,qsec,vs,am,gear,carbMazda RX4,21,6,160,110,3.9,2.62,16.46,0,1,4,4Mazda RX4 Wag,21,6,160,110,3.9,2.875,17.02,0,1,4,4Datsun 710,22.8,4,108,93,3.85,2.32,18.61,1,1,4,1Hornet 4 Drive,21.4,6,258,110,3.08,3.215,19.44,1,0,3,1Hornet Sportabout,18.7,8,360,175,3.15,3.44,17.02,0,0,3,2Valiant,18.1,6,225,105,2.76,3.46,20.22,1,0,3,1