read.dcf(file, fields = NULL, all = FALSE, keep.white = NULL)
write.dcf(x, file = "", append = FALSE, indent = 0.1 * getOption("width"), width = 0.9 * getOption("width"), keep.white = NULL)
""
indicates output to the console. For read.dcf
this
can name a compressed file (see gzfile
).all
is false (default), only the last such occurrence is
used.NULL
(default)
indicating that there are no such fields. Coerced to character if
possible. For fields where whitespace is not to be kept as is,
read.dcf
removes leading and trailing whitespace, and
write.dcf
folds using strwrap
.
x
to a data frame.TRUE
, the output is appended to the
file. If FALSE
, any existing file of the name is destroyed.read.dcf(all = FALSE)
returns a character matrix
with one row per record and one column per field. Leading and
trailing whitespace of field values is ignored unless a field is
listed in keep.white
. If a tag name is specified in the file,
but the corresponding value is empty, then an empty string is
returned. If the tag name of a field is specified in fields
but never used in a record, then the corresponding value is NA
.
If fields are repeated within a record, the last one encountered is
returned. Malformed lines lead to an error.For read.dcf(all = TRUE)
a data frame is returned, again with
one row per record and one column per field. The columns are lists of
character vectors for fields with multiple occurrences, and character
vectors otherwise.Note that an empty file
is a valid DCF file, and
read.dcf
will return a zero-row matrix or data frame.For write.dcf
, invisible NULL
.
The DCF rules as implemented in R are:
tag:value
, i.e., have a name
tag and a value for the field, separated by :
(only the first
:
counts). The value can be empty (i.e., whitespace only).
Note that read.dcf(all = FALSE)
reads the file byte-by-byte.
This allows a DESCRIPTION file to be read and only its ASCII
fields used, or its Encoding field used to re-encode the
remaining fields.
write.dcf
does not write NA
fields.
write.table
. available.packages
, which uses read.dcf
to read
the indices of package repositories.