Convenient wrapper around the NoviSci web platform APIs.

Authentication

Creating an API key

To authenticate with the web platform you must first create an API key. You can generate an API key by logging into the web platform UI and then visiting your Profile page. Then click on the “Create New Api Key” link.

Authentication via the API key

nswpr expects the API key to be made available through the NS_APIKEY environmental variable. The value of this environmental variable can be set in many ways, but our recommendation is to set it using the ~/.Renviron file. Whatever approach you use, it is important to never include your API key in any project code that might get checked in to the project Git repository.

When the R application starts up it searches for a site and user file to process for setting environment variables, unless the --no-environ command-line argument is provided. These files are collectively called environmental files. One of the files that it searches for is the ~/.Renviron file, unless an alternative location is specified through the R_ENVIRON_USER environmental variable. Since the ~/.Renviron file is typically not checked in to a Git project repository this makes it a convenient mechanism to use to set the NS_APIKEY environmental variable for R sessions.

Environmental variables can be set in the environmental files by including a line in one of the files with a name=value syntax. So in order to set the NS_APIKEY environmental variable in the ~/.Renviron file, you can add a line like the following to the ~/.Renviron file.

Note that the ~/.Renviron file may not already exist, in which case you would want to create one. You can use any text editor (such as RStudio) to create or edit this file.

For more information about the R startup process, see the R Startup documentation (e.g. via a call to help(Startup)).

Interacting with the NoviSci Web Platform report system API

Once your API key has been made available through the NS_APIKEY environmental variable then you can call any of the Report & Causal Studio functions in the Reference section.

Reports

On the NoviSci Web Platform the report system supports two types of reports:

  1. Static HTML Report - output from RMarkdown using the NoviSci Hugo Template uploaded to the platform via nswpr package
  2. Dynamic Report - built via a web based report creation tool with data uploaded via nswpr package.