Skip to content

Instantly share code, notes, and snippets.

View Btibert3's full-sized avatar

Brock Tibert Btibert3

View GitHub Profile
@Btibert3
Btibert3 / Kiplingers_2011.R
Created November 13, 2011 19:27
Kiplingers 2011/12 Best Value Rankings
## help
#http://stackoverflow.com/questions/1395528/scraping-html-tables-into-r-data-frames-using-the-xml-package
### load the libraries
library(RCurl)
library(XML)
## URL
URL.1 <- "http://www.kiplinger.com/tools/privatecolleges/index.php?table=prv_univ"
URL.2 <- "http://www.kiplinger.com/tools/privatecolleges/index.php?table=lib_arts"
@Btibert3
Btibert3 / Cluster NHL Players.R
Created November 28, 2011 17:34
Basic Web Mining with R
###############################################################################
# Author: @BrockTibert
#
# Used: R Version 2.12.1, Windows 7 Pro, StatET Plugin for Eclipse
#
#
###############################################################################
#-----------------------------------------------------------------------
# set up script level basics
@Btibert3
Btibert3 / Attempt-2
Created July 20, 2012 22:45
Slidify Attempt
---
# My First Slide
@Btibert3
Btibert3 / user-credentials.R
Created August 14, 2012 12:58
A quick way to grab user credentials at run-time from the console
user_credentials <- function() {
# capture the user name
U <- readline("Account username: ")
# capture the password
P <- readline("Account password: ")
# return the data as a list
return(list(U,P))
}
@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
@Btibert3
Btibert3 / slidify-testing-v1.R
Created November 7, 2012 15:52
Getting Started with Slidify
> require(devtools)
Loading required package: devtools
Warning message:
package ‘devtools’ was built under R version 2.15.2
> install_github("slidify", "ramnathv")
Installing github repo(s) slidify/master from ramnathv
Installing slidify.zip from https://api.github.com/repos/ramnathv/slidify/zipball/master
Installing slidify
Installing dependencies for slidify:
yaml
@Btibert3
Btibert3 / act2sat.R
Last active October 13, 2015 00:28
ACT to SAT Concordance
## act to sat concordance chart
## http://www.act.org/aap/concordance/pdf/reference.pdf
act <- (36:11)
sat <- c(1600, 1560, 1510, 1460, 1420, 1380, 1340, 1300, 1260, 1220, 1190,
1150, 1110, 1070, 1030, 990, 950, 910, 870, 830, 790, 740, 690, 640,
590, 530)
act2sat <- data.frame(act, sat)
@Btibert3
Btibert3 / eval.Rmd
Created November 19, 2012 22:36
Eval Issue with R Markdown
This works as expected
```{r}
library(rjson)
# comment
2+2
```
This doesn't print properly
```{r, eval=FALSE}
@Btibert3
Btibert3 / collect-data-v2.r
Created November 26, 2012 14:46
Twitter Commands
#! /bin/bash
# remove the lines below here before running------
# Example 7: connect into the twitter firehouse - best approach is to use Command Line - run in Ubuntu 11.10
# Attempted to do this within R, but different approaches proved computing resources get consumed at incredible rate
# need to make this file executable from a command line in a linux-type environment (run in Ubuntu) by chmod 755
# saves datafile every hour (closes curl, reopens curl) from the twitter sample firehouse, raw json, should be able to process raw data in R and elsewhere
# If you're already in the directory containing the file you could just type: ./filename.sh and press Enter.
while true; do
curl -s -m 3600 -u twitterusername:twitterpassword https://stream.twitter.com/1/statuses/sample.json -o "twtstream_$(date +%Y%m%d%H).txt"
@Btibert3
Btibert3 / USNEWS-YIELD-LIST.R
Last active December 11, 2015 23:58
US News National Rankings - Yield List
###############################################################################
## Use R to scrape the US News College List and look at yield distribution
## @brocktibert
## jan 2013
###############################################################################
## load the necessary packages
require(XML)
require(RCurl)