Monday, September 16, 2013

Shiny R with Ubuntu

The first hearing of an application is not shiny like it as a song lyric I have ever heard. Shiny introduced by a professor, he was a friend of mine who is an expert in the field of statistics in particular R.

Shiny makes it super simple for R users like you to turn analyses into interactive web applications that anyone can use. Let your users choose input parameters using friendly controls like sliders, drop-downs, and text fields.

Easily incorporate any number of outputs like plots, tables, and summaries. No HTML or JavaScript knowledge is necessary. If you have some experience with R, you’re just minutes away from combining the statistical power of R with the simplicity of a web page. Next is complete list of instructions for installing Shiny Server and its prerequisites on Ubuntu
# Install Node.js
sudo apt-get update
sudo apt-get install software-properties-common python-software-properties python g++ make
sudo add-apt-repository ppa:chris-lea/node.js
sudo apt-get update
sudo apt-get install nodejs

# Install R
sudo add-apt-repository 'deb raring/'
sudo apt-key adv --keyserver --recv-keys E084DAB9
sudo apt-get update
sudo apt-get install r-base r-base-dev

The same as above, except when installing R this line:
sudo add-apt-repository 'deb raring/'
must be replaced with this line for Ubuntu 12.10:
sudo add-apt-repository 'deb quantal/'
or with this line for Ubuntu 12.04:
sudo add-apt-repository 'deb precise/'

# Install Shiny in system-wide library
sudo su - -c "R -e \"install.packages('shiny', repos='')\""
sudo npm install -g shiny-server

# Install Upstart script
sudo wget\\ -O /etc/init/shiny-server.conf
# Create a system account to run Shiny apps
sudo useradd -r shiny

# Create a root directory for your website
sudo mkdir -p /var/shiny-server/www

# Create a directory for application logs
sudo mkdir -p /var/shiny-server/log
# Start Shiny
sudo start shiny-server

# Optional: Install examples to test
sudo cp -R /usr/local/lib/R/site-library/shiny/examples /var/shiny-server/www/
Now open a browser to http://localhost:3838/examples/ and see if they work.

No comments:

Post a Comment