Skip to content

Instantly share code, notes, and snippets.

@mdsumner
mdsumner / wkt.R
Last active November 2, 2019 00:08
base R formatting sf to WKT (WIP)
``` r
library(silicate) ## just for data examples
#>
#> Attaching package: 'silicate'
#> The following object is masked from 'package:stats':
#>
#> filter
library(sf) ## just to verify the formatting
#> Linking to GEOS 3.7.1, GDAL 2.4.2, PROJ 5.2.0
## wicket:::sp_convert_ takes a list of coordinates and gives WKT
@mrecos
mrecos / precip_deviation_by_year.R
Created December 17, 2018 00:58
Code for downloading and plotting deviation in average precipitation for a given weather station. Using R and ggplot
library('rnoaa')
library("tidyverse")
library("lubridate")
library("ggrepel")
token = 'GET YOUR API KEY at: http://www.ncdc.noaa.gov/cdo-web/token'
locs <- ncdc_locs(locationcategoryid='CITY', sortfield='name', sortorder='desc', token = token, limit = 800)
loc_data <- locs$data
dplyr::filter(loc_data, grepl(", PA",loc_data$name))
@timchurches
timchurches / ORCID-second-order-coauthors.Rmd
Created October 23, 2017 04:06
Demo of second-order co-authship graphs using the rOpenSci Rorcid interface to ORCiD
---
title: "Visualising co-authorship networks using ORCID"
author: "Tim Churches"
date: "Mon 23rd October, 2017"
output: html_notebook
---
## Pre-amble
This R notebook re-uses code by Simon Goring described in [this blog entry](https://downwithtime.wordpress.com/2015/02/12/building-your-network-using-orcid-and-ropensci/) and published [here](https://github.com/SimonGoring/ORCiD_Network/blob/master/rorcid_network.R), and combines it with the [visNetwork package](http://datastorm-open.github.io/visNetwork/).
@patperu
patperu / setup_docker_couchdb.R
Last active February 24, 2016 07:55
Setup CouchDB at DigitalOcean via R
# DigitalOcean Token 'DO_PAT' set in '.Renviron'
library('analogsea')
(dr <- droplets())
# $`Old`
# <droplet>Old (12344556)
# IP: 46.AAA.BBB.CC
@spalladino
spalladino / mysql-docker.sh
Created December 22, 2015 13:47
Backup and restore a mysql database from a running Docker mysql container
# Backup
docker exec CONTAINER /usr/bin/mysqldump -u root --password=root DATABASE > backup.sql
# Restore
cat backup.sql | docker exec -i CONTAINER /usr/bin/mysql -u root --password=root DATABASE
@zkamvar
zkamvar / 2015_05_19_git2r.md
Last active December 5, 2015 01:32
Updating forks with git2r

Motivation

I am a contributor to NESCent's Population Genetics in R repository. The idea behind this repository is that people would be able to construct short vignettes for genetic analysis in R that can be displayed on the Population Genetics Info Website. Of course, the submissions would need to be pull requests from other users that would have forked the repository. For beginners, updating a fork is not a simple task. It requires that you fetch the upstream branch and then merge that branch into your head.

One problem: neither the OSX nor Windows GUIs have the ability to synch a fork from upstream, meaning that the contributors would have to know some command line options. This isn't a terrible thing all in all, because OSX has a Terminal app and users can access the shell from the Windows GUI. I recently attempted to test things on a w

@max-mapper
max-mapper / readme.md
Last active May 14, 2022 09:12
list of interdisciplinary open source conferences

Interdisciplinary Open Source Community Conferences

Criteria

  • Must be an event that someone involved in open source would be interested in attending
  • Must be a community oriented event (no corporate owned for-profit events here please)
  • Can't be about a specific language/framework.

Leave suggestions in the comments below

#### Putting rphylopics into a waffle type chart
### WARNING - I know this code is a bit 'hacky' - I was just trying to make it work.
### There are likely better ways to do it, but this is how I got it up and running.
library(rphylopic)
#get phylopics
bird1<-get_image("23c63b97-e0ab-4b43-89a4-e2358f4f09ec", size="64")[[1]]
bird2<-get_image("abab8520-b72b-4ecb-97fd-945f8675fe61", size="64")[[1]]
@jhollist
jhollist / buff_prob.R
Last active August 29, 2015 14:16
R script showing problem with turf.js buffers at smaller distances
#load libraries
library(jsonlite)
library(geojsonio)
library(sp)
library(lawn)
library(rgeos)
#create pt
pt<-minify('{
"type": "Feature",
@max-mapper
max-mapper / bikethefts.topojson
Last active August 29, 2015 14:16
portland bike theft data, 2007-2014 (from https://github.com/oregonian/bikethefts)
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.