Follow

Domino R Package

Access the full power of Domino's cloud compute and version control without leaving your R environment.

Install

The package is hosted on CRAN, like any standard R package.

Make sure you have the Domino command line client installed (you won't use it directly, but it does need to be installed on your computer).

Then, from inside R run:

install.packages("domino", repos='http://cran.r-project.org', type="source")

Once it's installed you can import the package as you would any other R package:

library(domino)

Logging In

You'll need to login again from R to verify your identity to Domino.

To do that type:

domino.login("yourUsername", host="https://app.dominodatalab.com")

You should get a success message. Note that if you're running in a private deployment, your "host" will be the address of your internal Domino server.

Getting a Project

Note: If you already have a copy of your project on your computer, then you can skip this step. Set your working directory to the root of that project folder and continue to the next section.

To download an existing project, run this command:

domino.get("quick-start")

You should see something like this:

> domino.get("quick-start")
Getting project chris/quick-start...
Project get complete. Make sure to navigate to your new project folder by running:
    cd quick-start
To run a file on Domino, type:
    domino run [command-to-run]
[1] "Changed working directory to new project's director"

This command also changes your working directory to the root of the project folder. In general, these Domino commands will only work if your working directory is set to be inside your project folder.

Running Code

To start the execution of a script on Domino, type:

domino.run("myScript.R")

You should see something like this:

> domino.run("myScript.R")
Determining which files are out of date...

No changes to upload to server, because you're up to date.
Run for project chris/quick-start started. You can view progress here:
  https://app.dominodatalab.com/chris/quick-start/run/53051188e4b0b5aeedd6a73b

You can also pass in arguments into the scripts:

domino.run("myScript.R", 1, "someString")

You can read in those parameters in your script:

> firstParameter  1
> secondParameter  "someString"

You can thus launch many jobs:

for (alpha <- 1:3) {
    for (beta <- 1:3) {
        domino.run("myScript.R", alpha, beta)
    }
}

This will queue 9 jobs, each with a unique setting of the values alpha and beta.

Downloading Results

Once your runs have completed, you get download the results back to your computer by running:

domino.download()

This will download all the new and modified files in your project to your local computer. Once this command completes, these files will be available immediately to be loaded into your R workspace:

> domino.download()
Downloading latest changes to project...

Determining which files are out of date...

Changes from the server:
------------------------

  x Modifying file results/stdout.txt
  x Modifying file someData.RData

Starting download of new files:
-------------------------------
    Downloading "someData.RData" ...
      complete!
    Downloading "results/stdout.txt" ...
      complete!
Download complete.

> load("someData.RData") # --> load the R objects

Two-Way Sync

You can perform a two-way sync with the command:

domino.sync()

This runs a download followed by an upload. If there is a conflict between the local and server versions of a file, you will get both versions so that you can fix the conflict and then re-sync.

Initializing a Project

To initialize a new project inside an existing directory, navigate to the directory and then run:

domino.init("projectName")

This will create a Domino project named "projectName", with its root at the current working directory. You can then sync this project to the server with

domino.sync()

Other Commands

You can also run other commands from the CLI, with methods named according to their CLI counterparts. For additional details, you may reference the documentation hosted on CRAN.

Was this article helpful?
0 out of 0 found this helpful