The Domino R package gives you access to the full power of Domino’s cloud compute and version control without leaving your R environment.
The package is hosted on CRAN, like any standard R package.
Install the Domino command line client. You won’t use it directly, but it does have to be installed on your computer.
From R, run the following:
install.packages("domino", repos='http://cran.r-project.org', type="source")
After it’s installed you can import the package as you would any other R package:
library(domino)
You must 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. If you’re running in a private deployment, your host will be the address of your internal Domino server.
Note
| If you already have a copy of your project on your computer, 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.
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 launch several 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.
After 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
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.
To initialize a new project inside an existing directory, go 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:
domino.sync()
You can also run other commands from the CLI with methods named according to their CLI counterparts. For additional details, see the documentation hosted on CRAN.