Tutorial: Running R in Galileo

Written and developed by

Matthew Gasperetti
matthew@hypernetlabs.io
Alexander Berry
alexander@hypernetlabs.io

Tutorial: Running R in Galileo

Written and developed by

Matthew Gasperetti

matthew@hypernetlabs.io

Alexander Berry

alexander@hypernetlabs.io

Getting started with R in Galileo

Getting started with R in Galileo

To get started with Galileo log into your account using Firefox or Chrome, and download our R example file from GitHub. The downloaded file consists of a .r file, a .csv file, and a Dockerfile.

Let’s have a look at our files

The rMonteCarlo.R script conducts a linear regression, makes a simple plot, and then runs two Monte Carlo simulations.

The first Monte Carlo simulates tossing two dice and calculates the number of rolls that are 7 or less. The second Monte Carlo increases the number of iterations and runs the simulation in parallel.

Understanding the user interface

When you log into Galileo, the first thing you’ll see is your Dashboard:

View of the Galileo Dashboard

To run the rExample, start by navigating to the Missions tab using the side menu.

Drag and drop the entire rExample folder you downloaded from our GitHub to the “Add a mission” staging area. Once the folder has been uploaded, click on the “Run mission” button in the newly-created “Galileo-examples-R” mission below the staging area. You will be asked to select a station on which to run the mission.


Choose the “Linux” station to begin and click “Run mission”. After the mission has been launched, you’ll be able to see the job running in the Jobs tab. The job runs quickly in Galileo – try running it locally and comparing.

When the example job completes, hit the Download button under Action to download the results.

The results folder will be downloaded as a .zip that contains an output.log file returning the results of the analysis and a folder called results where plots and other files that were created by the analysis are stored.

The Downloaded .zip file contains a folder called results and a file called output.log

Let’s take a look at the output.log file first, which returns the results of the regression we ran:

Summary of the results of the simple regression and Monte Carlo simulations

Using the Configuration Wizard to create your own project

When you drag and drop a custom R job’s folder to start a mission on Galileo, the Configuration Wizard will appear to help you create a computing environment that is perfectly-suited for the custom job:

The Configuration Wizard allows your job to run seamlessly in the cloud

Once you have selected the mission type (R), given the job a name, you will also need to provide the wizard with the name of the .R file that initiates the job. Next, specify the dependencies the job requires, either by selecting them from the provided list or by manually entering the names, separated by a single space, and then clicking the “Add Dependencies Manually” button.

Finally, you will be asked to set two advanced settings, though you may leave them as the default settings if you are not relevant to your custom job.

Hit submit, and the job will launch and can be monitored and interacted with just like the example job by navigating to the Jobs panel.

We hope this tutorial was helpful. Please let us know if you have any questions or any problems using Galileo. Your feedback is extremely important to us. Contact us anytime at matthew@hypernetlabs.io or alexander@hypernetlabs.io.