Save a neuronlist object into separate data and metadata parts

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).

Value

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

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

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
}