Learn R Programming

mudata (version 0.1.1)

write.mudata: Read/Write mudata objects

Description

Read/Write mudata objects

Usage

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

Run this code
# NOT RUN {
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)

# }

Run the code above in your browser using DataLab