Skip to content

Instantly share code, notes, and snippets.

# mtcars as as service
# Create a JSON API for your data with GitHub + Blockspring
# This script will filter rows of mtcars based on API parameters
# import relevant libraries
suppressMessages(library(dplyr))
suppressMessages(library(RJSONIO))
# Get data from GitHub
# You will need to get your own API key by creating an account at api.blockspring.com
# install.packages(c("httr", "RJSONIO"))
library(httr)
library(RJSONIO)
mtcars_aaS <- function(api_key, mpg_min = "0", mpg_max = "10e6",
cyl_min = "0", cyl_max = "10e6",
disp_min = "0", disp_max = "10e6",
hp_min = "0", hp_max = "10e6",
library(dplyr)
create_tbl_df <- function(...){
tbl_df(as.data.frame(matrix(...)))
}
results <- create_tbl_df(nrow=5, ncol=2)

https://gist.github.com/kirstenfrank/218c36a1938055d0f4e4sample codebook.

It's very similar to a Statistical Analysis Plan, actually.

Setup, there is a dogwalking business. It wants to analyze its work.

Raw data is: name of dog, address of owner, time walked, date walked, size of dog (small, medium, or large), health of dog (well or sick) on that date and time, comments, and pay.

The business wants to assign ID# to the dogs, and codewords to the address to make this data anonymous. There isn't anything to do to the comments--since free text is all over the place.

@seankross
seankross / ssh.md
Last active August 29, 2015 14:10
SSH

However this is done in PuTTY 😕 :

ssh schliepe@opensub00.umiacs.umd.edu

Type in your password, then when you're in try:

cd /nfshomes/kross/fletching
@seankross
seankross / sounds.r
Last active May 1, 2018 01:26 — forked from ncarchedi/sounds.r
# Script to help understanding of S3 object-oriented programming
# in R using classes and methods
# Constructor functions for various classes of animal
pig <- function() structure(list(), class=c("pig", "animal"))
dog <- function() structure(list(), class=c("dog", "animal"))
cat <- function() structure(list(), class=c("cat", "animal"))
makeSound <- function(x) UseMethod("makeSound")
@seankross
seankross / keybase.md
Last active August 29, 2015 14:16
keybase

Keybase proof

I hereby claim:

  • I am seankross on github.
  • I am seankross (https://keybase.io/seankross) on keybase.
  • I have a public key whose fingerprint is 920D 6BAA 1092 52E6 9977 1CE8 B5CD 7B45 761C C977

To claim this, I am signing this object: