Reads or writes an R object from/to a file in Debian Control File format.
read.dcf(file, fields = NULL, all = FALSE, keep.white = NULL)<p></p><p>write.dcf(x, file = "", append = FALSE, useBytes = FALSE,
indent = 0.1 * getOption("width"),
width = 0.9 * getOption("width"),
keep.white = NULL)</p>
| Parameter | Description |
|---|---|
file |
either a character string naming a file or a connection. "" indicates output to the console. For read.dcf this can name a compressed file (see gzfile). |
fields |
Fields to read from the DCF file. Default is to read all fields. |
all |
a logical indicating whether in case of multiple occurrences of a field in a record, all these should be gathered. If all is false (default), only the last such occurrence is used. |
keep.white |
a character string with the names of the fields for which whitespace should be kept as is, or 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 |
the object to be written, typically a data frame. If not, it is attempted to coerce x to a data frame. |
append |
logical. If TRUE, the output is appended to the file. If FALSE, any existing file of the name is destroyed. |
useBytes |
logical to be passed to writeLines(), see there: “for expert use”. |
indent |
a positive integer specifying the indentation for continuation lines in output entries. |
width |
a positive integer giving the target column for wrapping lines in the output. |
# NOT RUN {
## Create a reduced version of the DESCRIPTION file in package 'splines'
x <- read.dcf(file = system.file("DESCRIPTION", package = "splines"),
fields = c("Package", "Version", "Title"))
write.dcf(x)
## An online DCF file with multiple records
con <- url("http://cran.r-project.org/src/contrib/PACKAGES")
y <- read.dcf(con, all = TRUE)
close(con)
utils::str(y)
# }