write.mudata: Read/Write mudata objects

Description Usage Arguments Examples

View source: R/mudata.io.R

Description

Read/Write mudata objects

Usage

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
write.mudata(md, filename, ...)

read.mudata(filename, ...)

write.mudata.zip(md, filename, overwrite = FALSE, expand.tags = TRUE,
  validate = TRUE, ...)

read.mudata.zip(filename, validate = TRUE, expand.tags = TRUE,
  retype = TRUE, load = c("data", "locations", "params", "datasets",
  "columns"), ...)

write.mudata.json(md, filename, overwrite = FALSE, expand.tags = TRUE,
  validate = TRUE, ...)

read.mudata.json(filename, validate = TRUE, expand.tags = TRUE,
  retype = TRUE, load = c("data", "locations", "params", "datasets",
  "columns"), ...)

Arguments

md

a mudata object

filename

file to read/write (can also be a directory)

...

passed to read/write.csv

overwrite

Pass TRUE to overwrite if zipfile already exists.

expand.tags

flag to expand tags to columns

validate

flag to validate mudata object upon read or before write

retype

Pass TRUE to retype columns based on the 'type' column of the 'columns' table.

load

a list of csv files (without the .csv extension) to load from the source.

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
data(kentvillegreenwood)
# read/write to zip
outfile <- tempfile(fileext=".zip")
write.mudata(kentvillegreenwood, outfile)
md <- read.mudata(outfile)
md <- read.mudata(outfile, retype=TRUE)
plot(subset(md, params=c("meantemp", "maxtemp")))
unlink(outfile)

# read/write to JSON
outfile <- tempfile(fileext=".json")
write.mudata(kentvillegreenwood, outfile)
md <- read.mudata(outfile)
md <- read.mudata(outfile, retype=TRUE)
plot(subset(md, params=c("meantemp", "maxtemp")))
unlink(outfile)

mudata documentation built on Nov. 17, 2017, 7:30 a.m.