Posts tagged “programming”

Shiny Server on WebFaction

Update: WebFaction released today a one-click installed for node.js, obviating Step 2 below. Leaving it in here for posterity.

Shiny “makes it super simple for R users like you to turn analyses into interactive web applications that anyone can use.” It’s a powerful tool with a relatively simple syntax. It’s great for local apps — but I wanted to set up a web-based app that others could access and that wasn’t beholden to Shiny and RStudio’s excellent beta server platform.

I host this site and a few others at WebFaction — an awesome service with little to no downtime, fast servers, and relatively flexible restrictions. Getting Shiny up and running on WebFaction required a little work.

Step 1: SSH into WebFaction. Follow the instructions on their website for your specific server(s).

Step 2: Make a source directory. Download and install node.js.

mkdir src
cd src
wget ''
tar -xzf node-v0.10.20.tar.gz
cd node-v0.10.20
python2.7 configure --prefix=$HOME
make PYTHON=python2.7
make PYTHON=python2.7 install

export NODE_PATH="$HOME/lib/node_modules:$NODE_PATH"
echo 'export NODE_PATH="$HOME/lib/node_modules:$NODE_PATH"' >> $HOME/.bashrc 

Step 3: Download and install R.

#install R
wget ''
tar -xzf R-3.0.2.tar.gz
cd R-3.0.2
./configure --prefix $HOME
make install

Step 4: Make a temp/tmp/temporary director.

cd $HOME
mkdir tmp
chmod 777 tmp
export TMPDIR

Step 5: Download Shiny from source and install using NPM.

git clone
npm install -g shiny-server/

installing from NPM directly did not work — Shiny would not launch. I believe this is because you’re not allowed root access on WebFaction shared accounts.

Step 6: Launch R and install whatever packages you need.

devtools::install_github("ShinyDash", "trestletech")
devtools::install_github("shiny-incubator", "rstudio")

Step 7: Want plots to work? In your Shiny app’s global.R file, set

options(bitmapType = 'cairo')

Next up: a cron job to keep a Shiny instance running or to restart it if it goes down… and putting Shiny behind some light authentication to prevent pre-release apps from general consumption.

Beautiful new service from the creators of Dark Sky. A number of cool things about it, including its beautiful visualizations and use of data from around the globe. Particularly, the developers note:

We’ve gathered hour-by-hour observations from tens of thousands of ground stations world-wide, in some places going back a hundred years. We expose it as a sort of “time machine” that lets you explore the past weather at any given location. We’ve also used the data to develop statistical forecasts for any day in the future. For example, say you have an outdoor family reunion in 6 months: with the time machine, you can see what the likely temperature and precipitation will be at the exact day and hour.

Their API sounds good, too, though I haven’t taken the plunge on that yet.

Now that we’ve developed a general-purpose weather API, we’re trying to compete with the other weather APIs available around the Internet. We’ve found those APIs to be difficult and clunky to use, so we’ve tried to make our API as streamlined as possible: you can sign up for a developer account without needing a credit card, and start making requests right away—you can worry about payment information when your app is ready. Additionally, we’ve lowered our prices so that we’re competitive with the other data providers out there.

Via DF

all rights reserved
snarglr is written & maintained by ajay pillarisetti

click here to turn on all posts