box_write {boxr}R Documentation

Write an R object to a Box file

Description

Use these functions to serialize an R object and write it to a Box file. To write an object using RDS serialization, use box_save_rds(); for other types of serialization, use box_write() and provide a serialization function.

Usage

box_write(
  object,
  file_name,
  dir_id = box_getwd(),
  description = NULL,
  write_fun = rio::export,
  x,
  filename,
  ...
)

box_save_rds(
  object,
  dir_id = box_getwd(),
  file_name = ".RDS",
  description = NULL
)

Arguments

object

Object to be written.

file_name

character, name of the new Box file.

dir_id

numeric or character, folder ID at Box.

description

character, description caption for the file.

write_fun

function, used to write (serialize) the content from R; default function is rio::export().

x

Object to be written, deprecated: use object instead.

filename

character, deprecated: use file_name instead.

...

Other arguments passed to write_fun.

Details

Using box_save_rds() is relatively straightforward, your object will be written to Box as an RDS file.

If you want to specify the serialization, use box_write(). For example, you may wish to write a data.frame to Box as a CSV file. Within box_write(), this is a two-step process:

The default serialization-function is rio::export().

The rio::export() function currently supports only data.frame; to serialize lists, you may wish to use jsonlite::toJSON().

Please note that box_write() is used to write R objects to Box files using standard formats. To write R objects as .RData files, you can use box_save().

Value

Object with S3 class boxr_file_reference.

See Also

saveRDS(), box_save()


[Package boxr version 0.3.6 Index]