最近CRAN上新了一个叫eoffice的package,并且不时被各路大佬提起。这个包的功能刚好也符合我最近的需求,这次带各位先来试试水。包的官方介绍:
1. Introductioncran.r-project.org这次主要试试在word中用该包插入ggplot。既然要试,图就整的复杂一点:
> rm(list = ls())
> gc()
used (Mb) gc trigger (Mb) max used (Mb)
Ncells 2423917 129.5 4543915 242.7 4543915 242.7
Vcells 6168695 47.1 12255594 93.6 10143094 77.4
>
> pacman::p_load(data.table, magrittr, ggplot2, ggthemr, cowplot, stringr, dplyr, patchwork)
>
> library(eoffice)
> library(gridExtra)
>
> ggthemr('fresh')
>
> test<-mtcars %>% mutate(text = rownames(mtcars)) %>% data.table() %$%
+ .[,c('brand', 'model','tag'):=tstrsplit(text,