This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# libraries you will need | |
library(httr) | |
library(jsonlite) | |
# You will need a token from sciwheel API | |
token = '<<your API token goes here>>' | |
# Get Project Ids for use in sciwheel_bib | |
sciwheel_projects <- function(token){ | |
project = 'https://sciwheel.com/extapi/work/projects' | |
get_meta <- GET(project, add_headers("Authorization"= paste0("Bearer ", token))) | |
status <- httr::status_code(get_meta) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
library(tidyverse) | |
library(extrafont) | |
font_import() | |
theme_MandB <- function (base_size = 11, base_family = "Times New Roman", horizontal = TRUE, dkpanel = FALSE) | |
{ | |
bgcolors <- c("#24292D", "#323E4E", "#BED5E0") | |
ret <- theme_foundation(base_size = base_size, base_family = base_family) + |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
library(tidyverse) | |
library(magick) | |
width = 800 | |
height = 500 | |
img <- image_read("https://i.dlpng.com/static/png/6920336_preview.png") | |
pomo_bg <- magick::image_resize(img, paste0(width, "x", height, "!")) | |
pomo_bg <- magick::image_crop(pomo_bg, paste0(width, "x", height)) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
library(ggmap) | |
library(maps) | |
library(mapdata) | |
library(glue) | |
library(here) | |
library(progress) | |
library(extrafont) | |
font_import() | |
tuesdata <- tidytuesdayR::tt_load(2020, week = 25) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#devtools::install_github("thebioengineer/tidytuesdayR") | |
library(tidyverse) | |
library(ggpomological) | |
tuesdata <- tidytuesdayR::tt_load(2020, week = 25) | |
extrafont::ttf_import(paths = "~/Downloads/bayard-desktop") | |
extrafont::fonts() | |
#tuesdata$census%>%View | |
#tuesdata$slave_routes %>% View |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Provides APA 7th Styling to a table #### | |
# Only works using the global-font-options branch of the gt package | |
#Requires | |
library(gt) | |
library(tidyverse) | |
# APA style #### | |
apa_style <- function(data) { | |
data %>% | |
opt_table_lines(extent = "none") %>% |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
library(tidyverse) | |
# Replication of Simmons #### | |
set.seed(42) | |
reps <- 1500 | |
n <- 40 | |
sim <- matrix(NA, nrow = reps, ncol = 4) | |
colnames(sim) <- c("vanilla_est", "vanilla_p", "covariate_est", "covariate_p") | |
for (i in 1:reps){ | |
d = data_frame( |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Set Globals | |
var ui = DocumentApp.getUi(); | |
/** Demonstrates a simple way to prompt the user for a date. */ | |
function img_workflow() { | |
// Set UI prompt + reminder to use unsecured image | |
var url = ui.prompt('Enter URL of image', 'use http not https', ui.ButtonSet.OK_CANCEL); | |
var line = url.getResponseText(); | |
// If user clicks OK | |
if (url.getSelectedButton() == ui.Button.OK) { | |
// fetch image url |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* Updates images by there URL. Run when image changes | |
* This only works for images that have a link to themselves in a google doc | |
* To link an image right mouse click and select link. Put a link to the image URL there | |
* URLs for images in Drive take the form http://drive.google.com/uc?export=view&id=##IMAGE ID HERE## | |
* Will replace image with same dimensions. Will not match rotation angle. | |
* I think the URLs need to be http rather than https to work consistently. | |
*/ | |
function replace_images_url() { | |
// Open the document by id |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
--- | |
title: "R Notebook" | |
output: html_notebook | |
--- | |
# Overview | |
## | |
![Overview](fig/PISA-Workshop.png) |
NewerOlder