This file contains hidden or 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("RCurl") | |
library("XML") | |
library("plyr") | |
library("ggplot2") | |
library("directlabels") | |
######################## | |
# Download PubMed Data # | |
######################## |
This file contains hidden or 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
# | |
install.packages(c("twitteR","wordcloud","tm")) | |
library(twitteR); library(wordcloud); library(tm) | |
# Search for #bes12 tweets | |
bestweets <- searchTwitter("#bes12", n=5000) | |
length(bestweets) # ends up with 1344 as of 21-Dec-12 at 17:00 London time | |
# make into a data.frame | |
bestweets_df <- twListToDF(bestweets) |
This file contains hidden or 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
doInstall <- TRUE | |
toInstall <- c("twitteR", "dismo", "maps", "ggplot2") | |
if(doInstall){install.packages(toInstall, repos = "http://cran.us.r-project.org")} | |
lapply(toInstall, library, character.only = TRUE) | |
searchTerm <- "#rstats" | |
searchResults <- searchTwitter(searchTerm, n = 1000) # Gather Tweets | |
tweetFrame <- twListToDF(searchResults) # Convert to a nice dF | |
userInfo <- lookupUsers(tweetFrame$screenName) # Batch lookup of user info |
This file contains hidden or 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 type="text/javascript"> | |
SyntaxHighlighter.autoloader( | |
"r path/to/your/syntaxhighlighter/scripts/shBrushR.js", | |
"plain path/to/your/syntaxhighlighter/scripts/shBrushPlain.js", | |
"sql path/to/your/syntaxhighlighter/scripts/shBrushSql.js", | |
"js path/to/your/syntaxhighlighter/scripts/shBrushJScript.js", | |
"html xml path/to/your/syntaxhighlighter/scripts/shBrushXml.js" | |
); | |
SyntaxHighlighter.defaults["toolbar"] = false; | |
SyntaxHighlighter.all(); |
This file contains hidden or 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
# dhist. | |
# An another algorithm for computing histogram breaks. Produces irregular bins. | |
# Provided by Lorraine Denby | |
# | |
# | |
# @keyword internal | |
dhist <- function(x, a=5*diff(quantile(x, c(0.25,0.75))), nbins=10, rx = range(x)) { | |
x <- sort(x) | |
if(a == 0) | |
a <- diff(range(x))/100000000 |
NewerOlder