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
| # .Rprofile -- commands in this file will be executed at the beginning of | |
| # each R session. On Windows, the R_PROFILE environment variable must have value | |
| # with the full path to this file. On Linux (or other Unix like systems) this file | |
| # must be in the user's home directory. | |
| # Set the default repository to the main CRAN site | |
| options(repos=c(CRAN='http://cran.r-project.org')) | |
| # Set the oDrive varaible and library path | |
| if(Sys.info()['sysname'] == 'Windows') { |
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
| #List of most used R packages that we wish to install. | |
| libraries = c('cacheSweave', 'Deducer', 'devtools', 'doBy', 'foreign', 'gdata', | |
| 'ggplot2', 'Hmisc', 'JGR', 'lubridate', 'maps', 'mapdata', 'mapproj', | |
| 'maptools', 'proto', 'psych', 'R2wd', 'RCurl', 'reshape', | |
| 'RODBC', 'roxygen2', 'seqinr', 'sm', 'sp', 'sqldf', 'survey', | |
| 'WriteXLS', 'XML', 'xtable') | |
| #We will install packages from the main CRAN site | |
| repos = 'http://cran.r-project.org' | |
| #Site provides some prebuilt binaries for Windows |
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
| ## See http://en.wikipedia.org/wiki/Birthday_problem for an explanation of the problem | |
| require(ggplot2) | |
| require(reshape) | |
| theme_update(panel.background=theme_blank(), | |
| panel.grid.major=theme_blank(), | |
| panel.border=theme_blank()) | |
| birthday <- function(n) { | |
| 1 - exp( - n^2 / (2 * 365) ) |
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
| #' Constructor | |
| EmailClass <- function(name, email) { | |
| nc = list( | |
| name = name, | |
| email = email, | |
| get = function(x) nc[[x]], | |
| set = function(x, value) nc[[x]] <<- value, | |
| props = list(), | |
| history = list(), | |
| getHistory = function() return(nc$history), |
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
| 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 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
| require(XML) | |
| require(RCurl) | |
| #' This function ruturns an XML tree of the RSS feed from the given URL. | |
| #' | |
| #' This function utilizes the (unofficial) Google Reader API to retrieve RSS | |
| #' feeds. The advantage of access RSS feeds through the Google Reader API is that | |
| #' you are not limited by the number of entries a website may included in their | |
| #' feed. That is, Google maintains generally maintains a complete history of | |
| #' entries from the RSS feed. |
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
| .libPaths() #By default, R will install packages to the first element | |
| #This script will install some very common R packages. | |
| repos = 'http://cran.r-project.org' #Main CRAN | |
| repos.win = 'http://www.stats.ox.ac.uk/pub/RWin' #Site provides some prebuilt binaries for Windows | |
| repos.rforge = 'http://r-forge.r-project.org' | |
| libraries = c('Deducer', 'devtools', 'doBy', 'foreign', 'gdata', 'ggplot2', 'gmaps', | |
| 'Hmisc', 'JGR', 'maps', 'mapdata', 'mapproj', 'maptools', 'proto', 'psych', 'R2wd', | |
| 'Rcmdr', 'RCurl', 'reshape', 'RODBC', 'roxygen2', 'seqinr', 'sm', 'sp', |
NewerOlder