The D Format
The "D"
format is equivalent to using R's base
functions
dput
and dget
, which support all R objects.
The P Format
The "P"
format only supports a list that may contain lists,
vectors, matrices, arrays, and data frames. Scalars are treated
like vectors. It writes each list element using the following
conventions:
$
denotes the start of a list element, and the element's
name follows this character; for nested lists, $
separates
each nesting level;
$$
, on the next line, denotes a line used to describe
the element's structure, which includes object type, mode(s), names
(if vector), rownames (if matrix or data), and colnames (if matrix
or data); and
subsequent lines contain data (one line for a vector and
multiple lines for a matrix or other data).
If a list's elements are unnamed, have the name NA, or have the
empty string as a name, this function generates names ("P"
format only). If two list elements share the same name, the list
will export correctly, but it will import incorrectly.Arrays with three or more dimensions have dim
and
dimnames
arguments. dim
describes the dimension of the
data (a vector as returned by dim(some_array)
) and
dimnames
is a vector of length sum(dim(some_array)+1)
and is constructed as follows:
foreach dimension d,
first append the name of the dimension d and
then append all labels within that dimension
Multiple rows of data for matrices or data frames must have equal
numbers of entries (separated by whitespace).
Note that array data are written the same format as they are
displayed in the R console:
nrow=dim()[1]
, ncol=dim()[2]
repeated by scrolling through successively higher dimensions, increasing the
index from left to right within each dimension. The flattened table will have
dim()[2]
columns.
For complete details, see “PBSmodelling-UG.pdf” at the location
described when loading this package.