README.md

DomoR

An R package for interacting with Domo data sources

About R

R is a programming language and development environment that is specifically built for statistical computing and graphics. It's one of the fastest growing programming languages in 2014. It has an amazing library of rich, statistics related packages. It is deeply ingrained in academia and generally makes doing hard statistical analysis seem easy.

Prerequisites

In order to work with data sources directly from Domo, you need to setup your R environment.

Installation

As DomoR is not yet published on CRAN, the Comprehensive R Archive Network (and may never be), you need a helper package to install it. Hadley Wickham has built a fantastic library called devtools that allows you to install an R package directly from Github.

To install and load devtools, from an R command prompt, run:

install.packages("devtools")
library("devtools")

You can verify that you have devtools installed correctly by checking has_devel() and verify that the last line is TRUE.

Also, if you wish, you can set your auth_token as an environment variable (especially helpful as you can't see your token after it is generated) and reference that variable with the github_pat() function.

export GITHUB_PAT="<auth_token>"

install_github(repo="domoinc-r/DomoR", auth_token=github_pat())

Installation method from filesystem

The easy way is to manually download and install from your filesystem.

Download the code using git to your local filesystem. Make sure and keep the directory named DomoR.

cd /tmp
git clone https://git.empdev.domo.com/Chad-Maughan/DomoR.git

From R, set your working directory to the parent directory where you cloned the repository, run

setwd('/tmp')

Install the library

install('DomoR')

Load the library

library('DomoR')

Example Usage

When using the DomoR package, the first thing you'll need to do is to initialize the development environment with your Domo customer instance (i.e. CUSTOMER.domo.com for https://CUSTOMER.domo.com) and your API access token. To generate an API access token, log in to your Domo instance as an admin and go to Admin > Security > Access Tokens

Once you have your token generated from the Domo Admin screen, initialize your development environment with:

DomoR::init('customer', 'token')

After you have initialized your development environment, there are essentially three simple things you can do:

The data source ID (third column) can be used to explicitly fetch a data source. For convenience, the index (first column) can also be used to reference a data source to be fetched. Please be careful as using the index (first column) will always fetch the data source from the most recent listing.

You can also provide various arguments that will narrow the results returned. See the function documentation ?list_ds (or ?DomoR::list_ds) for more examples and a better description.

Fetch

Fetch the data source by using the index from the most previous list_ds() results:

df <- DomoR::fetch(1)

Or specify a data source ID directly

df <- DomoR::fetch('48d49aa4-6e03-451a-906b-2aa6610dbd55')

Make sure and assign the fetched data source to a (data frame) variable so you can manipulate the data. If you don't specify a variable to assign it to, the data source is output to the console.

Create

Create a data source by passing in a data frame with a name and description (where df is your data frame variable from which you'll create a data source in Domo).