Skip to content

Instantly share code, notes, and snippets.

View wlandau's full-sized avatar

Will Landau wlandau

View GitHub Profile
@benlistyg
benlistyg / fixed_choice_design_sim.R
Last active March 9, 2019 16:42
How does the degree distribution of a FCD network differ from the "true" network of interest?
# Fixed Choice Design Lunchtime Simulation
# 2019-02-06
library(igraph)
library(dplyr)
library(ggplot2)
#Experimental Conditions
conds <- expand.grid(
c(150),
@krlmlr
krlmlr / Rprofile-entrace
Last active January 7, 2021 01:59
Pretty stack traces in R
# Add this to your .Rprofile
options(
error = quote(rlang::entrace()),
rlang__backtrace_on_error = "collapse" # or "branch" or "full"
)
#!/usr/bin/env Rscript
# 2018-06-04 11:26:12
# Automatically generated from R by autoparallel version 0.0.1
library(parallel)
nworkers = 2
timeout = 600
#devtools::install_github("cloudyr/aws.ec2")
# devtools::install_github("cloudyr/aws.ec2", ref = devtools::github_pull(38))
# ^ Must actually install PR 38. Some broken code in the main repo
#devtools::install_github("cloudyr/aws.signature")
library(aws.signature)
library(aws.ec2)
library(furrr)
aws.signature::use_credentials()
# 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")
@hadley
hadley / .gitignore
Last active February 25, 2024 02:10
Benchmark different ways of reading a file
.Rproj.user
.Rhistory
.RData
*.Rproj
*.html
@wch
wch / unlockEnvironment.r
Created August 7, 2012 01:17
Sample code for unlocking environments in R
library(inline)
inc <- '
/* This is taken from envir.c in the R 2.15.1 source
https://github.com/SurajGupta/r-source/blob/master/src/main/envir.c
*/
#define FRAME_LOCK_MASK (1<<14)
#define FRAME_IS_LOCKED(e) (ENVFLAGS(e) & FRAME_LOCK_MASK)
#define UNLOCK_FRAME(e) SET_ENVFLAGS(e, ENVFLAGS(e) & (~ FRAME_LOCK_MASK))
'