Installing the R SDK
Intro
The R SDK is an R package that allows you to transfer data between Domo and R easily, simplifying the process of moving DataSets between the two. You can access the SDK and installation information in the Data Center.
Times when the R SDK may be the best solution are these:
-
If your data science team is using R for most transformations and needs to get that data into Domo.
-
When you need to do any sort of statistical analysis or data exploration that’s outside of the scope of SQL.
-
If you are already using R scripts for data processing.
-
When you need capabilities beyond SQL for forecasting, text analysis, or other data science tasks.
-
If you require Rapid App prototyping or are creating dynamic reproducible documents/reports.
This topic takes you through the entire installation and initialization process for the R SDK.
More information can be found at: https://github.com/domoinc/rdomo.
Video - Domo's R SDK Overview
Prerequisites
To install and initialize the R SDK you will need two pieces of information:
-
Your customer instance name, denoted as customer in this documentation. This is the part of your login URL before domo.com. For example, if your Domo login URL was https://modocorp.domo.com, the customer instance name would be modocorp.
-
A Domo Access Token, denoted as domo_access_token in this documentation. This is required to access your Domo instance via the Domo API. A user at your company with an "Admin" security role (or a custom role with "Manage All Company Settings" or "Manage All Access Tokens" enabled) will need to generate this token by going to Admin > Security > Access Tokens in your account and clicking Generate Access Token in the upper right corner.
Installing R
Domo has provided a process to install R from Domo’s private GitHub repository. To install it you need a helper package. Hadley Wickham has built a library called "devtools" that allows you to install an R package directly from GitHub.
Installing the Devtools Package
-
Install devtools by running
-
install.packages("devtools")
-
library("devtools")
-
Installing the R SDK
- Install R directly from Domo’s private GitHub repository:
install_github(repo="domoinc-r/R")
Initializing the R Environment
Now that that SDK is installed, you need to initialize it in your instance of R with your Domo customer instance (https://customer.domo.com) and your domo_access_token.
Generating a Domo Access Token
To generate a domo_access_token, log in to your Domo instance as an "Admin"-level user (or a user with a custom role with "Manage All Company Settings" or "Manage All Access Tokens" enabled) and go to Admin > Security > Access Tokens. For more information about security roles, see Security Role Reference.
Initializing R
Once you have generated a token from your Domo instance, initialize your R development environment using the following command:
R::init('customer', 'domo_access_token')
Here, customer is the portion of your Domo URL before domo.com (e.g. modocorp for modocorp.domo.com) and domo_access_token is the access token you generated in your Domo instance.
After you have initialized your development environment, R will allow you to do the following:
-
List your DataSets
-
Fetch a DataSet and convert it to a data frame
-
Create a DataSet by uploading your data frame
-
Replace a DataSet by uploading your data frame