Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

Two alternatives for installing the library are described below.


Alternative 1: Installing from CRAN through RStudio

1. The ONC R Client Library 'onc.api' can be installed from CRAN repository.

Inside RStudio enter the following line in the command line

Code Block
languagetext
themeEmacs
install.packages("onc.api")

or, from the tab bar: Tools – Install packages ()

The installation will take some time as some additional packages will be installed as well.


2. Then load the onc.api package by typing:

Code Block
languagetext
themeEmacs
library(onc.api)


3. OPTIONAL: If ERROR messages occur when loading the onc.api package it is likely due to broken dependencies.

You can try loading the missing dependencies manually by carefully looking through the error and adding them e.g. :

Code Block
languagetext
themeEmacs
library(stringi)
library(tictoc)

Sometimes restarting your RStudio session is a good option as well.

3. Create an Onc object to access this library's functionalities.

Code Block
languagetext
themeEmacs
# To create an ONC object we need to access the class methods using the ":::" operator
# OPTIONAL: The differences between "::" and ":::" is explained in the RStudio help enter the following in the 
# RStuio command line to read it: ?":::"

onc <- onc.api:::Onc('YOUR_TOKEN_HERE')
 
# Create an ONC object with custom configuration parameters
onc = onc.api:::Onc('YOUR_TOKEN_HERE', showInfo=True, outPath='onc-files')

It will be ready for use.


Alternative 2: Installing from Archive Package

1. The ONC R Client Library can be installed as a package for RStudio.


Download the latest version here:

Download

2. After you obtain the package, in RStudio, access the menu: "Tools" → "Install Packages..."

3. The "Install Packages" dialog will appear.

4. In "Install from:" select "Package Archive File (.zip; tar.gz)"

5. In "Package Archive" click "Browse..." and select the package file downloaded.

6. Click the "Install" button.

Alternative

...

3: Installing from GitHub

1. The ONC R Client Library can also be installed from the ONC Github repository.

To access some useful functions install the devtools package from the R command line:

Code Block
languagetext
themeEmacs
install.packages("devtools")

or, from the tab bar: Tools – Install packages ()

Then load it:

Code Block
languagetext
themeEmacs
library(devtools)


2. Install the ONC R Client Library using devtools’ “install_github funtion” in the R command line:

Code Block
languagetext
themeEmacs
install_github("OceanNetworksCanada/api-r-client")
  • Selecting “Option: 1 (All)” will download missing dependencies such as “tictoc”, “lubridate” etc. or update existing dependencies.
  • The installation process will take several minutes to complete depending on how many dependencies are missing or need to be updated.
  • After the installation process completes (command line returns: “* DONE (onc.api)”) you can load the ONC R Client Library via the command:
Code Block
languagetext
themeEmacs
library(onc.api)

It will be ready for use.

...