7.4 CSV Data Writing

Writing a dataset to a csv file is straightforward using readr::write_csv():

library(rattle)       # Dataset: weatherAUS.
library(dplyr)        # Wrangling: select().
library(readr)        # Modern and efficient data reader/writer.

ds <- weatherAUS

fname  <- "temperatureAUS.csv"

ds %>%
  select(Date, Location, MinTemp, MaxTemp, Temp9am, Temp3pm) %>%
  write_csv(fname)

To turn off the messaging of the identified columns, set the option for the number of columns to report to 0:

options(readr.num_columns=0)

To turn it back on, set it to NULL.



Your donation will support ongoing availability and give you access to the PDF version of this book. Desktop Survival Guides include Data Science, GNU/Linux, and MLHub. Books available on Amazon include Data Mining with Rattle and Essentials of Data Science. Popular open source software includes rattle, wajig, and mlhub. Hosted by Togaware, a pioneer of free and open source software since 1984. Copyright © 1995-2022 Graham.Williams@togaware.com Creative Commons Attribution-ShareAlike 4.0