Rev 27625 | Blame | Compare with Previous | Last modification | View Log | Download | RSS feed
\name{dcf}\alias{read.dcf}\alias{write.dcf}\title{Read and Write Data in DCF Format}\description{Reads or writes an \R object from/to a file in Debian Control File format.}\usage{read.dcf(file, fields=NULL)write.dcf(x, file = "", append = FALSE,indent = 0.1 * getOption("width"),width = 0.9 * getOption("width"))}\arguments{\item{file}{either a character string naming a file or a connection.\code{""} indicates output to the console.}\item{fields}{Fields to read from the DCF file. Default is to read allfields.}\item{x}{the object to be written, typically a data frame. If not, itis attempted to coerce \code{x} to a data frame.}\item{append}{logical. If \code{TRUE}, the output is appended to thefile. If \code{FALSE}, any existing file of the name is destroyed.}\item{indent}{a positive integer specifying the indentation forcontinuation lines in output entries.}\item{width}{a positive integer giving the target column for wrappinglines in the output.}}\details{DCF is a simple format for storing databases in plain text files thatcan easily be directly read and written by humans. DCF is used invarious places to store R system information, like descriptions andcontents of packages.The DCF rules as implemented in R are:\enumerate{\item A database consists of one or more records, each with one ormore named fields. Not every record must contain each field, afield may appear only once in a record.\item Regular lines start with a non-whitespace character.\item Regular lines are of form \code{tag:value}, i.e.,have a name tag and a value for the field, separatedby \code{:} (only the first \code{:} counts). The value can beempty (=whitespace only).\item Lines starting with whitespace are continuation lines (to thepreceding field) if at least one characterin the line is non-whitespace.\item Records are separated by one or more empty (=whitespace only)lines.}\code{read.dcf} returns a character matrix with one line per recordand one column per field. Leading and trailing whitespace of fieldvalues is ignored. If a tag name is specified, but the correspondingvalue is empty, then an empty string of length 0 is returned. If thetag name of a fields is never used in a record, then \code{NA} isreturned.}\seealso{\code{\link{write.table}}.}\examples{## Create a reduced version of the 'CONTENTS' file in package 'splines'x <- read.dcf(file = system.file("CONTENTS", package = "splines"),fields = c("Entry", "Description"))write.dcf(x)}\keyword{print}\keyword{file}