This is a short set of functions that use the httr
package to upload a directory of files as a gist. The post_gist
function uploads an anonymous gist, which can only be deleted within a short time of being uploaded. So be cautious in what you upload using this function.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
####################################################################### | |
# Create social network from NCES 2008 migration data | |
# Helpful resources: | |
# R in a Nutshell -- Adler | |
# R for SAS and SPSS Users | |
# statmethods.net -- Quick R | |
# igraph.sourceforge.net | |
####################################################################### | |
# Load libraries |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
############################################################################### | |
# Date: Feb 13, 2011 | |
# Author: @BrockTibert | |
# Filename: NHL PBP and Tableau.R | |
# R version: 2.12.1 | |
# | |
# Purpose: Grab the Play by Play event data and visualize live using Tableau | |
# | |
# | |
# Copyright (c) 2011, under the Simplified BSD License. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Requirements | |
#sudo apt-get install libcurl4-gnutls-dev # for RCurl on linux | |
#install.packages('RCurl') | |
#install.packages('RJSONIO') | |
library('RCurl') | |
library('RJSONIO') | |
query <- function(querystring) { | |
h = basicTextGatherer() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
% this is a simplified version of | |
% https://github.com/yihui/knitr/blob/master/inst/examples/knitr-beamer.Rnw | |
\documentclass{beamer} | |
\begin{document} | |
<<setup, include=FALSE>>= | |
# smaller font size for chunks | |
opts_chunk$set(size = 'footnotesize') | |
@ | |
\title{A Minimal Demo of knitr} | |
\author{Paul Hiemstra \and Yihui Xie} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
## load the packages | |
require(XML) | |
require(RCurl) | |
require(rjson) | |
require(plyr) | |
## will create a request to the twitter search API - returns JSON | |
## https://dev.twitter.com/docs/api/1/get/search | |
## max combo can be 1500 tweets (100*15 pages) | |
## API limit = 150 requests / hour for requests that are not authenticated |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
library(httr) | |
library(digest) | |
library(XML) | |
s3_request <- function(verb, bucket, path = "/", query = NULL, | |
content = NULL, date = NULL) { | |
list( | |
verb = verb, | |
bucket = bucket, | |
path = path, |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
library(base64enc) | |
library(RJSONIO) | |
library(httr) | |
default_key <- function () { | |
key <- Sys.getenv("POSTMARKAPP_API_KEY") | |
if (key == "") { | |
stop("Either provide key or set envvar POSTMARKAPP_API_KEY", call. = FALSE) | |
} | |
key |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# The MIT License (MIT) | |
# | |
# Copyright (c) 2012 Schaun Jacob Wheeler | |
# | |
# Permission is hereby granted, free of charge, to any person obtaining a copy | |
# of this software and associated documentation files (the "Software"), to deal | |
# in the Software without restriction, including without limitation the rights | |
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell | |
# copies of the Software, and to permit persons to whom the Software is | |
# furnished to do so, subject to the following conditions: |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# you can use something like this if read_html fails to find a table | |
# if you have bs4 >= 4.2.1, you can skip the lxml stuff, the tables | |
# are scraped automatically. 4.2.0 won't work. | |
import pandas as pd | |
from lxml import html | |
url = "http://www.uesp.net/wiki/Skyrim:No_Stone_Unturned" | |
xpath = "//*[@id=\"mw-content-text\"]/table[3]" |
OlderNewer