This file contains hidden or 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
# Derived from revtools code, copyright Martin J Westgate | |
# Adapted by Lukas Wallrich, still unter GPL-3 licence | |
library(magrittr) | |
manual_dedup <- function( | |
df, cols = names(df), suffixes = c("1", "2"), id = "id" | |
){ | |
input_data <- list( |
This file contains hidden or 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
# Model proposed by Grim et al | |
# with different perspectives added - i.e. shortcuts | |
# Used this to avoid duplicating files | |
import httpimport | |
url = "https://gist.githubusercontent.com/LukasWallrich/05f445821fbae694b37a205dc08b2b4f/raw/" | |
with httpimport.remote_repo(url): | |
from HPmodel import HPProblem, PSAgent |
This file contains hidden or 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
my_data_color <- function (data, SOURCE_columns, TARGET_columns, colors, alpha = NULL, apply_to = c("fill", | |
"text"), autocolor_text = TRUE) | |
{ | |
stop_if_not_gt(data = data) | |
apply_to <- match.arg(apply_to) | |
colors <- rlang::enquo(colors) | |
data_tbl <- dt_data_get(data = data) | |
colors <- rlang::eval_tidy(colors, data_tbl) | |
resolved_source_columns <- resolve_cols_c(expr = { | |
{ |
This file contains hidden or 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
# Used this to avoid duplicating files | |
import httpimport | |
url = "https://gist.githubusercontent.com/LukasWallrich/05f445821fbae694b37a205dc08b2b4f/raw/" | |
with httpimport.remote_repo(url): | |
from HPmodel import HPProblem, PSAgent | |
# Alternative: download file into same folder, then run | |
# from HPmodel import HPProblem, PSAgent | |
This file contains hidden or 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
# ABM as proposed by Hong & Page (2004) | |
from statistics import mean | |
from collections import Counter | |
from itertools import permutations | |
from mesa import Agent, Model, DataCollector | |
from mesa.time import BaseScheduler | |
import copy | |
class PSAgent(Agent): |
This file contains hidden or 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
# Test case for httpimport | |
# https://github.com/operatorequals/httpimport/ | |
def hello(): | |
print("Hello world") | |