Skip to content

Instantly share code, notes, and snippets.

Avatar
🦑
Tappity tap tap

Mark MarkEdmondson1234

🦑
Tappity tap tap
View GitHub Profile
@krlmlr
krlmlr / Rprofile-entrace
Last active Jan 7, 2021
Pretty stack traces in R
View Rprofile-entrace
# Add this to your .Rprofile
options(
error = quote(rlang::entrace()),
rlang__backtrace_on_error = "collapse" # or "branch" or "full"
)
View AWS-furrr.R
# This example demonstrates running furrr code distributed on 2 AWS instances ("nodes").
# The instances have already been created.
library(future)
library(furrr)
# Two t2.micro AWS instances
# Created from http://www.louisaslett.com/RStudio_AMI/
public_ip <- c("34.205.155.182", "34.201.26.217")
@thomasp85
thomasp85 / particles.R
Created Feb 26, 2018
Particles on CRAN
View particles.R
library(tidygraph)
library(particles)
library(jsonlite)
library(magick)
# Prepare text polygons
text <- read_json('text.json')
par_text <- text$layers[[3]]$paths
on_text <- text$layers[[2]]$paths
cran_text <- text$layers[[1]]$paths
@raymondben
raymondben / global.R
Last active Jun 27, 2021
gauth shiny example
View global.R
library(googleAuthR)
library(shiny)
library(shinyjs)
@SiegHartR
SiegHartR / GAviewID_GTM_URL.R
Last active Jul 7, 2017
Find the desired GA view ID for your API call with only the URL of the page going through GTM - the aim is mainly to avoid any search into your accounts especially if you have to many property IDs and all with the same site url
View GAviewID_GTM_URL.R
library(httr)
library(XML)
library(googleAnalyticsR)
library(googleAuthR)
gwt_site_url <- "https://www.example.co.uk/"
html <- GET(gwt_site_url)
doc <- htmlParse(html)
@mwhitaker
mwhitaker / knit_cloudstorage.rmd
Created Jan 13, 2017
Use googleCloudStorageR to automatically upload to Cloud Storage
View knit_cloudstorage.rmd
---
title: "Host image files on Google Cloud storage"
author: "Michael Whitaker"
date: "January 12, 2017"
output:
html_document:
self_contained: false
---
```{r setup, include=FALSE}
@mjul
mjul / Dockerfile
Created Jun 2, 2016
Running R scripts in a Docker container
View Dockerfile
FROM r-base:latest
COPY . /usr/local/src/myscripts
WORKDIR /usr/local/src/myscripts
CMD ["Rscript", "myscript.R"]
@hrbrmstr
hrbrmstr / orig.png
Last active Oct 16, 2019
Supreme Annotations - moar splainin here: http://rud.is/b/2016/03/16/supreme-annotations/ - NOTE: this requires the github version of ggplot2
View visgreatlessfilling.r
# devtools::install_github("hrbrmstr/vegalite")
library(vegalite)
library(htmltools)
dat <- jsonlite::fromJSON('[
{"a": "A","b": 28}, {"a": "B","b": 55}, {"a": "C","b": 43},
{"a": "D","b": 91}, {"a": "E","b": 81}, {"a": "F","b": 53},
{"a": "G","b": 19}, {"a": "H","b": 87}, {"a": "I","b": 52}
]')
View japan_pyramid.R
library(idbr) # devtools::install_github('walkerke/idbr')
library(ggplot2)
library(animation)
library(dplyr)
library(ggthemes)
idb_api_key("Your Census API key goes here")
male <- idb1('JA', 2010:2050, sex = 'male') %>%
mutate(POP = POP * -1,