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
source('https://raw.github.com/gist/1606595/269d61dfcc7930f5275a212e11f3c43771ab2591/GoogleReader.R') | |
rbloggers = getRSSFeed(feedURL="http://r-bloggers.com/feed", | |
email="GOOGLE READER EMAIL", | |
passwd="GOOGLE READER PASSWORD", | |
posts=5000) | |
entries = rbloggers[which(names(rbloggers) == "entry")] | |
length(entries) | |
saveXML(rbloggers, file='rbloggers.xml') |
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
# go to 'https://developers.facebook.com/tools/explorer' to get your access token | |
access_token <- "******************* INPUT YOUR ACCESS TOKEN ******************************" | |
require(RCurl) | |
require(rjson) | |
# Facebook json function copied from original (Romain Francois) post | |
facebook <- function( path = "me", access_token, options){ | |
if( !missing(options) ){ | |
options <- sprintf( "?%s", paste( names(options), "=", unlist(options), collapse = "&", sep = "" ) ) |
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
#further explore Japanese trade data by region | |
#website is http://www.customs.go.jp/toukei/suii/html/time_e.htm | |
#format is http://www.customs.go.jp/toukei/suii/html/data/d42ma001.csv | |
#and the filename increments from 001 to 008 for the geographic areas | |
require(quantmod) | |
numgeog <- 8 #there are really 9 but the last is "special area" | |
urls <- paste("http://www.customs.go.jp/toukei/suii/html/data/d42ma00", |
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 post examines the features of [R Markdown](http://www.rstudio.org/docs/authoring/using_markdown) | |
using [knitr](http://yihui.name/knitr/) in Rstudio 0.96. | |
This combination of tools provides an exciting improvement in usability for | |
[reproducible analysis](http://stats.stackexchange.com/a/15006/183). | |
Specifically, this post | |
(1) discusses getting started with R Markdown and `knitr` in Rstudio 0.96; | |
(2) provides a basic example of producing console output and plots using R Markdown; | |
(3) highlights several code chunk options such as caching and controlling how input and output is displayed; | |
(4) demonstrates use of standard Markdown notation as well as the extended features of formulas and tables; and | |
(5) discusses the implications of R Markdown. |
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
`r opts_chunk$set(cache=TRUE)` | |
This is a quick set of analyses of the California Test Score dataset. The post was produced using R Markdown in RStudio 0.96. The main purpose of this post is to provide a case study of using R Markdown to prepare a quick reproducible report. It provides examples of using plots, output, in-line R code, and markdown. The post is designed to be read along side the R Markdown source code, which is available as a gist on github. | |
<!-- more --> | |
### Preliminaries | |
* This post builds on my earlier post which provided a guide for [Getting Started with R Markdown, knitr, and RStudio 0.96](jeromyanglim.blogspot.com/2012/05/getting-started-with-r-markdown-knitr.html) | |
* The dataset analysed comes from the `AER` package which is an accompaniment to the book [Applied Econometrics with R](http://www.amazon.com/Applied-Econometrics-R-Use/dp/0387773169) written by [Christian Kleiber](http://wwz.unibas.ch/personen/profil/person/kleiber/) and [Achim Zeileis](http://eeecon.uibk.ac.at/~zeileis/ |
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
require(quantmod) | |
require(fAssets) | |
#get asian currency data from the FED FRED data series | |
getSymbols("DEXKOUS",src="FRED") #load Korea | |
getSymbols("DEXMAUS",src="FRED") #load Malaysia | |
getSymbols("DEXSIUS",src="FRED") #load Singapore | |
getSymbols("DEXTAUS",src="FRED") #load Taiwan | |
getSymbols("DEXCHUS",src="FRED") #load China | |
getSymbols("DEXJPUS",src="FRED") #load Japan |
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
* Script to record and tag spotify tracks, by Lloyd Moore *) | |
(* Make sure you are already recording in Audio Hijack Pro with a session called 'spotifySession' *) | |
tell application "Spotify" | |
set currentTrack to (current track) | |
set trackName to (name of currentTrack) | |
tell application "Audio Hijack Pro" | |
set theSession to my getSession() | |
end tell | |
repeat |
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
# Letting plyr do the work for us. | |
doInstall <- TRUE # Change to FALSE if you don't want packages installed. | |
toInstall <- c("foreign", "plyr", "Hmisc", "ggplot2") | |
if(doInstall){install.packages(toInstall, repos = "http://cran.r-project.org")} | |
lapply(toInstall, library, character.only = TRUE) | |
# See: http://voteview.org/dwnominate.asp | |
dwNominate <- read.dta("ftp://voteview.com/junkord/HL01111E21_PRES.DTA") | |
# Make a re-coded party variable |
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
# Cross-matrix distances and different measurement options, with "proxy" | |
doInstall <- TRUE # Change to FALSE if you don't want packages installed. | |
toInstall <- c("proxy", "MASS", "Zelig") | |
if(doInstall){install.packages(toInstall, repos = "http://cran.us.r-project.org")} | |
lapply(toInstall, library, character.only = TRUE) | |
# Invent two data frames | |
voterIdealPoints <- data.frame(matrix(rnorm(26*2), ncol = 2)) | |
rownames(voterIdealPoints) <- letters |
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
# Simple ggplot2 heatmap | |
# with colorBrewer "spectral" palette | |
doInstall <- TRUE # Change to FALSE if you don't want packages installed. | |
toInstall <- c("ggplot2", "reshape2", "RColorBrewer") | |
if(doInstall){install.packages(toInstall, repos = "http://cran.us.r-project.org")} | |
lapply(toInstall, library, character.only = TRUE) | |
# Generate a random matrix | |
# This can be any type of numeric matrix, |
OlderNewer