Data can be written to a CSV file using write.csv():
write.csv(mtcars, "mtcars.csv")
Commonly-specified parameters include row.names = FALSE and na = "".
readr::write_csv is significantly faster than write.csv and does not write row names.
library(readr)
write_csv(mtcars, "mtcars.csv")