Navigation Menu

Skip to content

Instantly share code, notes, and snippets.

## Load libraries
library(XML)
library(dplyr)
library(RCurl)
## Get the results for a specific term
scrape_term = function(search_term,npages){
base_url = "http://scholar.google.com/scholar?"
search_string = paste0("q=",paste0(strsplit(search_term," ")[[1]],collapse="+"))
dat = data.frame(NA,nrow=10*npages,ncol=3)
#get very helpful Ken French data
#for this project we will look at Industry Portfolios
#http://mba.tuck.dartmouth.edu/pages/faculty/ken.french/ftp/48_Industry_Portfolios_daily.zip
require(latticeExtra)
require(PerformanceAnalytics)
require(quantmod)
#my.url will be the location of the zip file with the data
my.url="http://mba.tuck.dartmouth.edu/pages/faculty/ken.french/ftp/48_Industry_Portfolios_daily.zip"
@jedifran
jedifran / ai-class.py
Created January 27, 2012 19:18 — forked from deepakdodo/ai-class.py
Download lecture videos of ai-class (with Subtitles) (Stanford)
#!/usr/bin/env python
# -*- coding: utf-8 -*-
__author__ = "Deepak.G.R."
__license__ = 'Public Domain'
"""
usage:
Go to command line and type
python ai-class.py "topic-name"
@entaroadun
entaroadun / gist:1653794
Created January 21, 2012 20:10
Recommendation and Ratings Public Data Sets For Machine Learning

Movies Recommendation:

Music Recommendation:

@mbostock
mbostock / .block
Last active November 22, 2022 23:32
Line Transition
license: gpl-3.0
@cboettig
cboettig / lsos.R
Created September 1, 2011 20:21
List data size of objects in R
## Credit: Taken from: http://stackoverflow.com/questions/1358003/tricks-to-manage-the-available-memory-in-an-r-session
# improved list of objects
.ls.objects <- function (pos = 1, pattern, order.by,
decreasing=FALSE, head=FALSE, n=5) {
napply <- function(names, fn) sapply(names, function(x)
fn(get(x, pos = pos)))
names <- ls(pos = pos, pattern = pattern)
obj.class <- napply(names, function(x) as.character(class(x))[1])
obj.mode <- napply(names, mode)
obj.type <- ifelse(is.na(obj.class), obj.mode, obj.class)