Skip to content

Instantly share code, notes, and snippets.

View gluc's full-sized avatar

Christoph Glur gluc

View GitHub Profile
@gluc
gluc / DiagrammeR new version
Created December 18, 2016 10:53
DiagrammeR
graph <- structure(list(graph_info = structure(list(graph_id = "i4wrALpq",
graph_name = "graph_i4wrALpq", graph_time = structure(1482058166.83195, class = c("POSIXct",
"POSIXt")), graph_tz = NA_character_, write_backups = FALSE), .Names = c("graph_id",
"graph_name", "graph_time", "graph_tz", "write_backups"), row.names = c(NA,
-1L), class = "data.frame"), nodes_df = structure(list(
Fun:
preferences:
Dad:
pairwise
- [Cargo Capacity, Passenger Capacity, 1/5]
Mom:
pairwise
- [Cargo Capacity, Passenger Capacity, 1/5]
Kid:
pairwise
Version: 2.0
#####################################
# Alternatives Section
#
Alternatives: &alternatives
# Here, we list all the alternatives, together with their attributes.
# We can use these attributes later in the file when defining
# preferenceFunctions. The attributes can be quantitative or
library(data.tree)
data(acme)
acme$Set(len = runif(acme$totalCount))
# see ?as.data.frame.Node for more details
ToDataFrameTree(acme,
parent = function(node) node$parent$name,
child = "name",
len.parent = function(node) node$parent$len,
len.child = "len",
@gluc
gluc / port_risk.yaml
Last active May 18, 2017 02:24 — forked from mayt1992/R code
port_risk.ahp for R
Version: 2.0
Alternatives: &alternatives
Port 1:
shortname: p1
Port 2:
shortname: p2
Goal:
name: Port Risk
description: >
Evaluate Port Risk in the perspective of the Belt and Road Initiative.
@gluc
gluc / script.R
Last active November 20, 2017 03:23
Manipulate ahp problem by code
library(ahp)
library(data.tree)
vacation <- Load("vacation.ahp")
# look at the structure
vacation
# look at some preference dfs
title: monorepo