xl_add_vg: add a plot output as vector graphics into an Excel object

View source: R/xl_add_vg.R

xl_add_vgR Documentation

add a plot output as vector graphics into an Excel object

Description

produces a vector graphics output from R plot instructions and add the result in an Excel sheet. by read_xlsx.

Usage

xl_add_vg(x, sheet, code, left, top, width, height, ...)

Arguments

x

an rxlsx object produced by officer::read_xlsx

sheet

sheet label/name

code

plot instructions

left, top

left and top origin of the plot on the slide in inches.

height, width

Height and width in inches.

...

arguments passed on to dml_xlsx.

Examples


library(officer)
my_ws <- read_xlsx()
my_ws <- xl_add_vg(my_ws,
  sheet = "Feuil1",
  code = barplot(1:5, col = 2:6), width = 6, height = 6, left = 1, top = 2
)
fileout <- tempfile(fileext = ".xlsx")
print(my_ws, target = fileout)


davidgohel/rvg documentation built on May 17, 2023, 12:27 a.m.