I've come across this problem before, but just wrote the export function outside of the chain. Is there a way to include a write.csv
statement within a dplyr
chain?
library(dplyr)
data_set %>%
filter(Date == Sys.Date() - 1 | Date == Sys.Date()) %>%
write.csv('data_set_twodays.csv', row.names = F) %>%
filter(Date = Sys.Date()) %>%
write.csv('data_set_today.csv', row.names = F)
NULL
This appeared to work for me in version 0.2:
mtcars %>% filter(cyl == 4) %>% write.csv(.,file = "~/Desktop/piping.csv")
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With