Skip to content

Instantly share code, notes, and snippets.

@alexbrey
alexbrey / project.R
Last active August 10, 2016 02:11 — forked from mdlincoln/project.R
Maintain other attributes when making a bipartite projection
library(igraph)
library(dplyr)
# Assume you have a dataframe "objects" with columns "object_id", "artist_id", "date"
# Create an identical table that just gives a new variable name to "artist_id"
flipped_objects <- objects %>% rename(artist2_id = artist_id)
# Join the tables together (essentially joining objects to itself, creating every combination
# of artist that share an object_id and date
edges <- objects %>%
#Networks of Gothic Illuminators Tutorial
## Step 1: Acquire Data
- Scan summary list of manuscripts
- crop scans using briss
- OCR scans using Adobe Acrobat
- manually copy Artist, Region, and MSS data into a google sheet (there must be a better way than this, I do not know what it is)
- download google sheet as a tab-separated value file (.tsv)
estimated time ca. 3-4 hours
@alexbrey
alexbrey / index.html
Last active December 17, 2015 23:29
Mapping Byzantine Mints
<!DOCTYPE html>
<html>
<head>
<meta name='viewport' content='width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no' />
<script src='http://api.tiles.mapbox.com/mapbox.js/v1.0.2/mapbox.js'></script>
<link href='http://api.tiles.mapbox.com/mapbox.js/v1.0.2/mapbox.css' rel='stylesheet' />
<!--[if lte IE 8]>
<link href='http://api.tiles.mapbox.com/mapbox.js/v1.0.2/mapbox.ie.css' rel='stylesheet' >
<![endif]-->
<style>
@alexbrey
alexbrey / index.html
Created February 2, 2013 21:02
Visualizing page data from a book
<!DOCTYPE html>
<meta charset="utf-8">
<style>
body {
font-family: "Helvetica Neue", Helvetica, Arial, sans-serif;
width: 960px;
height: 500px;
position: relative;
}
@alexbrey
alexbrey / BM_UglyQueryForCountries
Last active August 29, 2015 13:55
Retrieves countries
SELECT DISTINCT ?item ?countryLabel ?yearAcquired
WHERE
{
{ SELECT * WHERE {
?item ecrm:P30i_custody_transferred_through ?hasCustody .
?hasCustody ecrm:P4_has_time-span ?hasTime .
?hasTime rdfs:label ?yearAcquired .
?item ecrm:P12i_was_present_at ?placeThing .
?placeThing ecrm:P7_took_place_at ?locality .
?locality skos:prefLabel ?countryLabel .