box_read: Read files from box.com into memory as R objects

Description Usage Arguments Author(s) See Also

View source: R/boxr_read.R

Description

box_read will download a file specified by file_id, and attempt to read it into memory as an R object. This can be useful, for example, to read in a .csv file as a data.frame.

Converting a file to an R object is by default handled by rio's import function. The only modification of it's behavior is that json files are not neccesarily coerced to data.frames, but can used to store list data, too. In addtion, more specific read functions are provided:

box_read_csv

Reads remote .csv files as data.frames (via read.csv)

box_read_tsv

Reads remote .tsv files as data.frames (via read.delim)

box_read_json

Reads remote .json files as lists (via toJSON)

box_read_excel

Reads remote Microsoft Excel files as data.frames (via read_excel)

Usage

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
box_read(file_id, type = NULL, version_id = NULL, version_no = NULL,
  read_fun = rio::import, fread = FALSE, ...)

box_read_csv(file_id, ...)

box_read_tsv(file_id, ...)

box_read_json(file_id, ...)

box_read_excel(file_id, ...)

Arguments

file_id

The box.com id for the file that you'd like to download

type

MIME type (aka internet media type) used to override the content type returned by the server. See http://en.wikipedia.org/wiki/Internet_media_type for a list of common types

version_id

If downloading an older version, the version_id of the desired file

version_no

The version of the file you'd like to download (starting at 1)

read_fun

The function used to read the data into R. Defaults to rio::import

fread

Should the function data.table::fread be used to read .csv files? Passed to rio::import (if used).

...

Passed to as additional parameters to read_fun

Author(s)

Brendan Rocks [email protected]

See Also

box_dl for saving files to disk, box_save for working with R workspaces, and box_source for working with R code.


boxr documentation built on May 29, 2017, 9:36 a.m.