boxr: A high-level R interface for the box.com API

2019-11-16

Authentication

To use boxr, you will need to use a Box-app. You can think of a Box-app as the door through which the boxr functions will access Box.

tl;dr

If you have access to client_id and client_secret for a Box-app, you can use box_auth() to authenticate:

This will kick off a process that, all being well, will keep you authenticated for the rest of the R session. By saving this information to your .Renviron file, at your next R session you can use:

If you don’t have access to client_id and client_secret for a Box-app, read on.

More information

There are two different types of apps, as described in this overview article:

Basic operations

Functions that operate on Box files or folders have arguments: file_id or dir_id. You can use the box.com web interface to find these values. Although they look like numbers, it is perhaps simpler to think of them as character strings:

Files

Folders

Here are a few of this package’s functions:

Directory-wide operations

Cloud storage services can complement version control systems for code, which aren’t well suited to large binary files (e.g. databases, .RData, or heaps of pdfs). box explicitly versions binary files, keeping old ones, and making it easy fall back to an older copy.

boxr provides git style facilities to upload, download, and synchronize the contents of entire local and remote directories. At the time of writing, the box.com API does not support this directly, and so boxr recursively loops through directory structures.

These functions all have overwrite and delete parameters, which are set to FALSE by default.

Disclaimer: box.com is no replacement for a VCS/remote-database, and familiar verbs are no guarantee of expected behavior! Do check the function documentation before jumping in.

Piping

boxr’s functions have been designed to be ‘pipeable’. Here’s a little example:

Reporting Bugs

If you find anything that looks like a bug while using it, please report it using a GitHub issue: https://github.com/r-box/boxr/issues.