# NOT RUN {
library(magrittr)
path_mtcars <- tempfile(fileext = ".csv")
path_cats <- tempfile(fileext = ".jpg")
path_scatter <- tempfile(fileext = ".png")
write.csv(mtcars, path_mtcars)
download.file("https://bit.ly/2P4LUO8", path_cats, quiet = TRUE)
png(path_scatter)
plot(1:10)
dev.off()
msg <- envelope() %>%
attachment(path_mtcars) %>%
# This attachment will have file name "cat.jpg".
attachment(path_cats, name = "cat.jpg", type = "image/jpeg") %>%
attachment(path_scatter, cid = "scatter")
file.remove(path_cats, path_scatter, path_mtcars)
# }
Run the code above in your browser using DataLab