Skip to content

Instantly share code, notes, and snippets.

View lebriggs's full-sized avatar

Laura Briggs lebriggs

View GitHub Profile
@bjulius
bjulius / gist:47264e8ba54704d7764ddd0ea3fd4b8f
Last active May 14, 2025 22:23
ggplot2 R code to create Nested Column Charts in Power BI
# This code creates an example Nested Column Chart of the type developed by Brittany Rosenau
# this code will produce the graphic below if you paste it into R Studio and run it
# to run it in a Power BI R visual, just import the csv into Power Query
# and then paste in the code below, changing df <- dataset
# note that "dataset" is the variable name used by convention in Power BI to call the table
# resulting from the previous step
# Load necessary libraries
library(ggplot2)
library(dplyr)
@bradleyboehmke
bradleyboehmke / help_functions.R
Last active July 20, 2025 16:57
Simple application of word embeddings with GloVe algorithm via text2vec
# See http://text2vec.org/glove.html for more details about text2vec
get_embeddings <- function(text) {
# Create iterator over tokens
tokens <- text2vec::space_tokenizer(text)
# Create vocabulary. Terms will be unigrams (simple words).
message("Creating vocabulary...")
it <- text2vec::itoken(tokens, progressbar = FALSE)
vocab <- text2vec::create_vocabulary(it)