Skip to content

Instantly share code, notes, and snippets.

View Btibert3's full-sized avatar

Brock Tibert Btibert3

View GitHub Profile
#######################################################################
# 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
###############################################################################
# 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.
@mhermans
mhermans / neo4R_example.R
Created August 29, 2011 09:50
Neo4j-Cypher-R
# 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()
@yihui
yihui / knitr-beamer2.Rnw
Created February 11, 2012 20:07
Another minimal beamer example for knitr
% 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}
@Btibert3
Btibert3 / Twitter-Mongo.R
Created November 4, 2012 22:49
Collect Twitter and Insert into MongoDB
## 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
@ramnathv
ramnathv / README.md
Last active September 9, 2022 02:41
Upload Directory of Files using Gist API

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.

@hadley
hadley / s3.r
Created May 7, 2013 13:16
Implementation of request signing for Amazon's S3 in R.
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,
@hadley
hadley / postmarkapp.r
Created June 4, 2013 17:16
Send an email from R using postmarkapp
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
@schaunwheeler
schaunwheeler / xlsxToR.r
Last active December 11, 2020 16:41
Import an xlsx file into R by parsing the file's XML structure.
# 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:
@jseabold
jseabold / skyrim_table.py
Last active June 14, 2018 03:02
Read an HTML table using pandas
# 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]"