exporting editable ggplot to excel in R using the office package

Viewed 18

Can someone explain how to export a ggplot into excel in an editable format using the read_xlsx function from the office package? I know how to create editable ggplots in powerpoint but I need to use excel if possible. Below is a simple example of how to export a ggplot to powerpoint.

a <- c(1:10)

b<- gghistogram(a)

#Turn ggplot into the right format for powerpoint 
format_new_b <- rvg::dml(ggobj = b)


# initialize PowerPoint slide ----
officer::read_pptx() %>%
  # add slide ----
officer::add_slide() %>%
  # specify object and location of object ----
officer::ph_with(format_new_b , ph_location()) %>%
  # export slide -----
base::print(
  target = here::here(
    "My.pptx"
  )
)
0 Answers
Related