50% off: Unlimited data and AI learning.
State of Data and AI Literacy Report 2025

r2rtf (version 0.1.1)

rtf_figure: Add Figure Attributes

Description

Add Figure Attributes

Usage

rtf_figure(
  tbl,
  page_width = 8.5,
  page_height = 11,
  orientation = "portrait",
  doctype = "wma",
  fig_width = 5,
  fig_height = 5
)

Arguments

tbl

A data frame

page_width

page width in inches

page_height

page height in inches

orientation

Orientation in 'portrait' or 'landscape'

doctype

doctype in 'csr', 'wma', or 'wmm'

fig_width

the width of figures in inch

fig_height

the height of figures in inch

Value

the same data frame tbl with additional attributes for figure body

Examples

Run this code
# NOT RUN {
  library(dplyr) # required to run examples
  file <- file.path(tempdir(), "figure1.png")
  png(file)
  plot(1:10)
  dev.off()

  # Read in PNG file in binary format
  rtf_read_png(file) %>% rtf_figure() %>%
  attributes()

# }

Run the code above in your browser using DataLab