is there way include call write.csv within string of piped dplyr functions?
library(dplyr) mtcars %>% filter(cyl == 4) %>% write.csv(file = "firststage.csv") %>% group_by(carb) %>% summarise(hp.sum = sum(hp)) %>% write.csv(file = "secondstage.csv") i create own function:
csv2go <- function(x, ...) { write.csv(x, ...) x } but wondering if there in base or dplyr. maybe write_csv() function in library(readr) adopt option?
very simple!!! need add single character "t" convert regular pipe operator %>% tee-pipe operator %t>% this:
library(dplyr) mtcars %>% filter(cyl == 4) %t>% # <== tee-pipe operator write.csv(file = "firststage.csv") %>% group_by(carb) %>% summarise(hp.sum = sum(hp)) %>% write.csv(file = "secondstage.csv") %t>% new friend
Comments
Post a Comment