Skip to content

Instantly share code, notes, and snippets.

Install alm package from CRAN

install.packages("alm")
library(alm)

Get metrics on a DOI, specifying info=history gives you the detailed data instead of totals. Note that counter is PLOS's views (includes page views of html, downloads of XML and PDF).

@mbostock
mbostock / .block
Last active February 9, 2016 01:57
Animation Benchmark
license: gpl-3.0
@hrbrmstr
hrbrmstr / aplot.png
Last active March 27, 2016 03:37
Nuclear Explosions
aplot.png
@enjalot
enjalot / index.html
Created December 20, 2011 21:53
masking with external svg elements
<html>
<head>
<script type="text/javascript" src="http://mbostock.github.com/d3/d3.js?2.6.0"></script>
</head>
<body>
<svg>
<defs>
<mask id="rekt">
<g id="rrr">
@roblanf
roblanf / genome_plots.r
Last active September 4, 2016 09:23
Make plots about genome sequencing, size, and gene content
source("http://bioconductor.org/biocLite.R")
biocLite("genomes")
library(genomes)
library(ggplot2)
valid <- c("released", "created", "submitted")
data(proks)
update(proks)

Dijkstra

A graph search algorithm that solves the single-source shortest path problem for a graph with non-negative edge path costs, producing a shortest path tree. This algorithm is often used in routing and as a subroutine in other graph algorithms.

Click to select source and destination.

@Fil
Fil / .block
Last active October 17, 2016 14:11
.call(generalpattern)
license: mit
@jfsiii
jfsiii / .block
Last active March 1, 2017 00:10
responsive bar chart
border: no
height: 333
license: CC0-1.0
@richarddmorey
richarddmorey / likert_check.R
Last active March 4, 2017 14:51
R script to check possible means and standard deviations for likert responses
############
# Option 1: Get all solutions
# using brute force
############
## This function creates every possible distribution of responses for
## a likert scale with nlev responses. This is total brute force. There's
## probably a better way.
## Argument:
## v : initially, the total number of responses
library(tidyverse)
library(ggalt) # devtools::install_github("hrbrmstr/ggalt")
df <- data_frame(
benchmark=c(0.52, 0.57, 0.60, 0.63, 0.64, 0.67),
referrals=c(4.2, 4.5, 4, 4.5, 3.9, 3.6),
year=c(2011, 2012, 2013, 2014, 2015, 2016)
)
# as of 2016-11-07 ggplot2 geom_label() seems to be ignoring the "angle" parameter, hence the non-ideal use of geom_text()