Skip to content

Instantly share code, notes, and snippets.

View maelle's full-sized avatar
💭
I may be slow to respond.

Maëlle Salmon maelle

💭
I may be slow to respond.
View GitHub Profile
@njahn82
njahn82 / figshare_zenodo.r
Created April 3, 2018 13:03
Compare word usage in Zenodo and Figshare titles
#' libraries needed
library(tidyverse)
library(jsonlite)
library(tidytext)
library(quanteda)
#' import zenodo https://zenodo.org/record/1065507#.WsNkb9NubFw
zenodo <-
readr::read_tsv("data/zenodo-all-metadata-records_2017-01-17.tsv") %>%
dplyr::select(title, doi)
# import figshare https://figshare.com/articles/Figshare_Public_Metadata_until_02_12_2014/1320834
@noamross
noamross / ropensci_editor_workloads.R
Last active April 1, 2018 17:34
Checking editor workloads for rOpenSci onboarding
library(tidyverse)
library(gh)
library(lubridate)
issues <- gh("/repos/ropensci/onboarding/issues?state=all&labels=package", .limit=1000)
edits = map_df(issues,
~data_frame(url = .$html_url,
editor = .$assignee$login %||% NA_character_,
opened = as.Date(.$created_at))) %>%
library(desc)
library(httr)
library(purrr)
library(stringi)
library(methods)
library(dplyr)
library(tidyr)
pkgs <- rownames(available.packages())
if(!dir.exists("DESCRIPTIONS")) dir.create("DESCRIPTIONS")
library(magick)
library(reshape2)
library(dplyr)
library(tidygraph)
library(particles)
library(animation)
plot_fun <- function(sim) {
df <- as_tibble(sim)
plot(df$x, df$y, col = df$color, pch = '.', axes = FALSE, xlim = c(-100, 317), ylim = c(-268, 100), xlab = NA, ylab = NA)
@jflasher
jflasher / details.md
Created February 23, 2018 14:56
Accessing data older than 90 days from OpenAQ

Currently, only data within the last 90 days is available via the OpenAQ API. However, there is much more data available on OpenAQ and a variety of different access mechanisms. Note also that there is work under way to bring back to the API a mechanism to access the data older than 90 days, details here.

If you're looking to query across all the data or even easily export the data (or a subset of it), the easiest way to do that currently is using a service like Amazon Athena. I'll provide some directions on how to do that below, but at a high level, this will let you make any query of the entire dataset that you'd like (written in SQL). I'll also provide some sample queries so you can see what's possible.

On to the directions!

  1. You will need to create an AWS account if you don't currently have one, you can start this process at htt
## GOAL:
## re-create a figure similar to Fig. 2 in Wilson et al. (2018),
## Nature 554: 183-188. Available from:
## https://www.nature.com/articles/nature25479#s1
##
## combines a boxplot (or violin) with the raw data, by splitting each
## category location in two (box on left, raw data on right)
# initial set-up ----------------------------------------------------------
@stephlocke
stephlocke / Checklist.md
Last active May 25, 2018 19:01
Conference good practices according to Steph!
  • Have a Code of Conduct and a demonstrable commitment to diversity
    • The Code of Conduct must be prominently displayed
    • Sponsors and other third parties must adhere to the Code of Conduct
  • Provide a mechanism for low income attendees to get reduced prices and support where the event charges more than a day's income
  • Attendees encounter only non-defaulted opt-ins to marketing and future contact, especially from third parties
  • The data entrusted to the event is handled with due care and consideration
  • Diverse attendees' needs are considered and taken into consideration. Things like (but not limited to) large print agendas, gender neutral bathrooms, quiet rooms, family rooms, and prayer rooms are implemented to ensure a pleasant experience for all attendee
  • Volunteers and organisers should receive reduced or free entry to the event
  • New speakers are encouraged and offered extra support
  • The speaker selection process is performed in a way that reduces possible sources of bias
@njtierney
njtierney / popular-licenses-on-cran.md
Created January 12, 2018 01:02
A snippet of code I found that explores the licenses on CRAN
library(V8)
library(xml2)
library(httr)
library(rvest)
library(stringi)
library(tidyverse)
get_page <- function(num=1, seed=Sys.Date()) {
GET(