add1c_y2: Add PowerPoint slide & 1 chart

View source: R/add1c_y2.R

add1c_y2R Documentation

Add PowerPoint slide & 1 chart

Description

This function adds a new PowerPoint slide and fits 1 chart/table/other object onto it. For this function to work, you need a powerpoint object saved into R called "doc"

Usage

add1c_y2(
  name,
  title = "Title",
  commentary = "Commentary",
  footer = "Footer",
  add_slide = TRUE,
  text_boxes = TRUE,
  slide_name = "Blank",
  master_name = "1_Office Theme",
  title_color = "Black",
  commentary_color = "Black",
  footer_color = "Black",
  font_family = "BentonSans Regular",
  left_start = 0.5,
  top_start = 1.8,
  height = 5.6,
  width = 12.25
)

Arguments

name

The name of the chart/table/other object to be added to a new PowerPoint slide.

title

DEFAULT: "Title"; Add a slide title in quotes, automatically formatted to the Default Qualtrics template

commentary

DEFAULT: "Commentary"; Add commentary/desctiption in quotes, automatically formatted to the Default Qualtrics template

footer

DEFAULT: "Footer"; Add a footer in quotes

add_slide

DEFAULT = TRUE; Automatically adds a blank slide for the chart/table/other object to be added onto. If F, no new slide is added

text_boxes

DEFAULT = FALSE; Automatically adds title, commentary, and footer boxes to the blank slide. Set to F for no text boxes

slide_name

DEFAULT = "Findings / 1 chart"; The name of the type of the PP slide you want added to the PP

master_name

DEFAULT = "Office Theme"; The name of the PP master layout that the slide_name comes from

title_color

DEFAULT: 'Black'; Color or hexcode for slide title

commentary_color

DEFAULT: 'Black'; Color or hexcode for slide commentary

footer_color

DEFAULT: 'Black'; Color or hexcode for slide footer

font_family

DEFAULT: 'BentonSans Regular'; font for slide title, commentary, and footer

left_start

DEFAULT = .5; how far chart will start from left of slide

top_start

DEFAULT = 2; how far chart will start from top of slide

height

DEFAULT = 5; height of chart on slide

width

DEFAULT = 12; width of chart on slide

Examples

## Not run: 
# First create a chart that you can add into a powerpoint object
frequencies <- mtcars %>%
  y2clerk::freqs(carb) %>%
  orderlabel::order_label(inherent_order_label = T)
color_settings <- list('blue')
text_settings<- list('result' = officer::fp_text(font.size = 20))
my_chart <- y2artisan::ms_single_y2()

# Then before adding additional slides, charts, or tables onto a powerpoint,
# you must first read a PowerPoint into R
doc <- read_pptx('~/Y2 Analytics Dropbox/Y2 Analytics Team Folder/Projects/
Qualtrics/2021 Template and Resources/Template for mscharts.pptx')

# Now start adding in your charts
doc <- add1c_y2(my_chart)

print(doc, '~/Desktop/test.pptx')

## End(Not run)

nick-moffitt/y2artisan documentation built on July 30, 2023, 5:40 p.m.