Skip to content

Instantly share code, notes, and snippets.

View shannonpileggi's full-sized avatar

Shannon Pileggi shannonpileggi

View GitHub Profile
@shannonpileggi
shannonpileggi / create_pptx.R
Created October 18, 2024 12:33
Create a power point slide deck from ggplot objects in R
#' Convert ggplot object to dml object to create editable powerpoint slides
#'
#' @param plot ggplot object or list of ggplot objects
#'
#' @return a dml object from the ggplot
#' @export
create_dml <- function(plot){
rvg::dml(ggobj = plot)
}
@shannonpileggi
shannonpileggi / demo_DT
Last active March 26, 2021 11:20
Demo of DT::datatable column indexing
# libraries
library(tidyverse)
library(DT)
set.seed(1234)
# generate data
dat <- tibble(
A = runif(5, 0, 1),
B = runif(5, 0, 1),
@shannonpileggi
shannonpileggi / demo_mutate_at
Last active February 18, 2021 17:12
A demonstration of mutate_at
library(tidyverse)
# values to mimic 1 to 7 rating scale with 99 as missing
values <- c(1:7, 99)
# for reproducibility
set.seed(0215)
# example data frame with two variables
dat <- tibble("A_1" = sample(values, 10, replace = T),
@shannonpileggi
shannonpileggi / demo_walrus
Created February 13, 2021 05:20
A demonstration of the walrus operator
library(tidyverse)
library(rlang)
library(glue)
# string to append to variable name
suffix <- "A"
# example data frame
dat <- tibble(x = 1:5) %>%
# create new variable with walrus operator
@shannonpileggi
shannonpileggi / demo_sortable
Last active February 13, 2021 04:53
A demonstration of sortable html widget in shiny apps for R-Ladies
library(shiny)
library(sortable)
rladies_messages <- c(
"R-Ladies creates an inclusive and welcoming environment.",
"R-Ladies hosts workshops that help me advance my R programming skills.",
"R-Ladies provides a safe place for me to ask technical R questions.",
"R-Ladies provides a safe place for me to discuss work-related (but not R) topics.",
"R-Ladies facilitates networking opportunities.",
@shannonpileggi
shannonpileggi / HBCU_tidytuesday
Last active February 4, 2021 11:58
HBCU tidytuesday adapted from Ijeamaka Anyene
---
title: "hbcus"
author: "Shannon Pileggi adapting from Ijeamaka Anyene"
date: "2/4/2021"
output: html_document
---
Conversation on twitter:
https://twitter.com/ijeamaka_a/status/1356809290468626434