save_nl_in_parts: Save a neuronlist object into separate data and metadata...

View source: R/extdata.R

save_nl_in_partsR Documentation

Save a neuronlist object into separate data and metadata parts

Description

Save a neuronlist object into separate data and metadata parts

Usage

save_nl_in_parts(
  x,
  datapath = NULL,
  dfpath = NULL,
  extdata = TRUE,
  format = c("rds", "rda"),
  ...
)

Arguments

x

A neuronlist object to save in separate parts

datapath

Optional path to new data file (constructed from name of x argument when missing)

dfpath

Optional path to new metadata file (constructed from datapath when missing)

extdata

Logical indicating whether the files should be saved into extdata folder (default TRUE, when FALSE the paths are untouched)

format

Either 'rds' (default) or 'rda'.

...

Additional arguments passed to saveRDS or save (based on the value of format).

Details

Saves a neuronlist into separate data and metadata parts. This can significantly mitigate git repository bloat since only the metadata object will change when any metadata is updated. By default the objects will be saved into the package inst/extdata folder with sensible names based on the incoming object. E.g. if x=mypns the files will be

  • mypns.rds

  • mypns.df.rds

Value

character vector with path to the saved files (returned invisibly)

See Also

Other extdata: find_extdata(), read_nl_from_parts()

Examples

## Not run: 
save_nl_in_parts(pns)
# which would make:
# - inst/extdata/pns.rds
# - inst/extdata/pns.df.rds

save_nl_in_parts(pns, format='rda')
# which would make:
# - inst/extdata/pns.rda
# - inst/extdata/pns.df.rda

save_nl_in_parts(pns, 'mypns.rda')
# which would make (NB format argument wins):
# - inst/extdata/mypns.rds
# - inst/extdata/mypns.df.rds

## End(Not run)

jefferis/nat.utils documentation built on July 6, 2023, 4:42 p.m.