Skip to contents

Overview

Certara.IntegralR allows users to interact with a remote Integral repository directly from their R console. Folders can be created, files can be uploaded or downloaded, and various helper functions can retrieve information about the repository and the contents within it.

Installation

install.packages(
  "Certara.IntegralR",
  repos = c("https://certara.jfrog.io/artifactory/certara-cran-release-public/", 
  "https://cloud.r-project.org"), method = "libcurl"
)

Before using the package, you will need to generate a CAD API key and set some variables in your .Renviron and .Rprofile. Click here to review authentication and configuration steps.

Usage

Create Folder

Add folders to an Integral repository with the create_root_folder() and create_subfolder() functions.

create_root_folder(
 name = "Root folder", 
 type = "Study"
)

create_subfolder(
 path = "Root Folder/Documents", 
 name = "new_folder"
)

Import File

Use the integral_download() and integral_read() functions to import a file from Integral. integral_download() will download the file to a location on your local machine, while integral_read() will import the file directly into your R environment.

# Download a file before reading it into R
integral_download(
  file = "Root Folder/Data/my_data.csv",
  path = getwd()
)

my_data <- read.csv(paste0(getwd(), "/my_data.csv"))


# Alternatively, read the file directly into your environment
my_data <- integral_read(FUN = read.csv,
                         file = "Root Folder/Data/my_data.csv")

Export File

Inversely, the integral_upload() and integral_write() functions to can be used to export files and R objects back to Integral.

# Upload a file from your local file system
write.csv(mtcars, "mtcars.csv")

integral_upload(file = "mtcars.csv",
                path = "Root Folder/Data/mtcars.csv")


# Write an R object directly to Integral
data <- mtcars

integral_write(x = data,
               FUN = write.csv,
               path = "Root Folder/Data/mtcars.csv",
               reason = "add more data")