Learn R Programming

nat.utils (version 0.6.1)

save_nl_in_parts: 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"),
  ...
)

Value

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

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

See Also

Other extdata: find_extdata(), read_nl_from_parts()

Examples

Run this code
if (FALSE) {
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
}

Run the code above in your browser using DataLab