Skip to contents

Store an object or file into iRODS. iput() should be used to transfer a file from the local storage to iRODS; isaveRDS() saves an R object from the current environment in iRODS in RDS format (see saveRDS()).

Usage

iput(
  local_path,
  logical_path,
  offset = 0,
  count = 2000L,
  truncate = TRUE,
  verbose = FALSE,
  overwrite = FALSE
)

isaveRDS(
  x,
  logical_path,
  offset = 0,
  count = 2000L,
  truncate = TRUE,
  verbose = FALSE,
  overwrite = FALSE
)

Arguments

local_path

Local path of file to be sent to iRODS.

logical_path

Destination path in iRODS.

offset

Offset in bytes into the data object. Defaults to 0.

count

Maximum number of bytes to write. Defaults to 2000.

truncate

Whether to truncate the object when opening it. Defaults to TRUE.

verbose

Whether to print information about the HTTP request and response. Defaults to FALSE.

overwrite

Whether the file in iRODS should be overwritten if it exists. Defaults to FALSE.

x

R object to save in iRODS.

Value

(Invisibly) the HTTP response.

See also

iget() for obtaining files, ireadRDS() for obtaining R objects from iRODS, readRDS() for an R equivalent.

Examples

is_irods_demo_running()
#> [1] TRUE

# \dontshow{
.old_wd <- setwd(tempdir())
# }
# demonstration server (requires Bash, Docker and Docker-compose)
# use_irods_demo()

# connect project to server
create_irods("http://localhost/irods-rest/0.9.3", "/tempZone/home", TRUE)

# authenticate
iauth("rods", "rods")

# save the iris dataset as csv and send the file to iRODS
write.csv(iris, "iris.csv")
iput("iris.csv", "iris.csv")

# save with a different name
iput("iris.csv", "iris_in_irods.csv")
ils()
#> 
#> ==========
#> iRODS Zone
#> ==========
#>                           logical_path        type
#>           /tempZone/home/rods/iris.csv data_object
#>  /tempZone/home/rods/iris_in_irods.csv data_object

# send an R object to iRODS in RDS format
isaveRDS(iris, "iris_in_rds.rds")

# delete objects in iRODS
irm("iris_in_irods.csv", force = TRUE)
irm("iris_in_rds.rds", force = TRUE)
irm("iris.csv", force = TRUE)

# \dontshow{
setwd(.old_wd)
# }