# Monthly Archives: March 2013

## Easily plotting grouped bars with ggplot #rstats

March 5, 2013
By

Summary This tutorial shows how to create diagrams with grouped bar charts or dot plots with ggplot. The groups can also be displayed as facet grids. Importing the data from SPSS All following examples are based on an imported SPSS … Weiterlesen →

## Load Balanced Parallelization with snowfall

March 5, 2013
By

For some reason, I didn't notice a few months ago the best way to perform a parallelized version of Lapply with package snowfall. We implemented the parallel version of function lapply with the function sfLapply, in the development of our pipeline p...

## Updating R from R (on Windows) – using the {installr} package

March 5, 2013
By

Upgrading R on Windows is not easy. While the R FAQ offer guidelines, some users may prefer to simply run a command in order to upgrade their R to the latest version. That is what the new {installr} package is …Read more »

## Create an R package from a single R file with roxyPackage

March 5, 2013
By

Documenting code can be a bit of a pain. Yet, the older (and wiser?) I get, the more I realise how important it is. When I was younger I said 'documentation is for people without talent'. Well, I am clearly loosing my talent, as I sometimes struggle to understand what I programmed years ago. Thus, anything that soothes the...

## Visualizing neural networks from the nnet package

March 4, 2013
By

Neural networks have received a lot of attention for their abilities to ‘learn’ relationships among variables. They represent an innovative technique for model fitting that doesn’t rely on conventional assumptions necessary for standard models and they can also quite effectively handle multivariate response data. A neural network model is very similar to a non-linear regression

## Cluster Risk Parity back-test

March 4, 2013
By

In the Cluster Portfolio Allocation post, I have outlined the 3 steps to construct Cluster Risk Parity portfolio. At each rebalancing period: Create Clusters Allocate funds within each Cluster using Risk Parity Allocate funds across all Clusters using Risk Parity I created a helper function distribute.weights() function in strategy.r at github to automate these steps.

## 2013 World Universities Ranking

March 4, 2013
By

The Times Higher Education (http://www.timeshighereducation.co.uk) released its World Reputation Ranking. The ranking employs survey consultation among invited-only academics to measure reputation among several universities. It is assumed to be the world’s largest opinion survey of this sort across the globe. Every year, a list of the top 100 most powerful university brands is released. Despite

## Tapping the FourSquare Trending Venues API with R

March 4, 2013
By

I came up with the following function to tap into the FourSquare trending venues API: library("RCurl", "RJSONIO")   foursquare<-function(x,y,z){ w<-paste("https://api.foursquare.com/v2/venues/trending?ll=",x,"&radius=2000&oauth_token=",y,"&v=",z,sep="") u<-getURL(w) test<-fromJSON(u) locationname="" lat="" long="" zip="" herenowcount="" likes="" for(n in 1:length(test$response$venues)) { locationname = test$response$venues]$name lat = test$response$venues]$location$lat long = test$response$venues]$location$lng zip = test$response$venues]$location$postalCode herenowcount<-test$response$venues]$hereNow$count likes<-test$response$venues]$likes$count xb<-as.data.frame(cbind(locationname, lat, long, zip, herenowcount, likes)) } xb$pulled=date() return(xb)

## Track the bookies’ favourites for the next Pope

March 4, 2013
By

Tired of manually running a python script to scrape the latest bookmaker odds on the next Pope, R user AJ (an analytical research manager at a large healthcare company) instead created an R script to track the odds on the Papal successor, and automated it with the Shiny package for R. The screenshot below shows the odds of each...