ID EN
Miscellaneous

dcf

R Base 3.6.2 🇮🇩 Bahasa Indonesia

Membaca atau menulis objek R dari/ke file dalam format File Kontrol Debian.

Syntax

R
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>

Arguments

Parameter Deskripsi
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.

Return Value

Read.dcf(all = FALSE) default mengembalikan matriks karakter dengan satu baris per catatan dan satu kolom per bidang. Spasi putih di depan dan di belakang nilai bidang diabaikan kecuali bidang tersebut terdaftar di keep.white. Jika nama tag ditentukan dalam file, tetapi nilai terkait kosong, maka string kosong akan dikembalikan. Jika nama tag suatu bidang ditentukan dalam bidang tetapi tidak pernah digunakan dalam catatan, maka nilai yang sesuai adalah NA. Jika field diulangi dalam suatu record, maka field terakhir akan ditemui

Details

DCF adalah format sederhana untuk menyimpan database dalam file teks biasa yang dapat dengan mudah langsung dibaca dan ditulis oleh manusia. DCF digunakan di berbagai tempat untuk menyimpan informasi sistem R, seperti deskripsi dan isi paket. Aturan DCF seperti yang diterapkan di R adalah: Basis data terdiri dari satu atau lebih catatan, masing-masing dengan satu atau lebih bidang bernama. Tidak setiap catatan harus berisi setiap bidang. Bidang mungkin muncul lebih dari sekali dalam satu catatan. Garis reguler dimulai dengan karakter non-spasi. Baris reguler berbentuk tag:nilai, yaitu, memiliki tag nama dan nilai untuk bidang tersebut, dipisahkan oleh : (hanya : pertama yang dihitung). Nilainya boleh kosong (yaitu, spasi saja). Garis yang diawali dengan spasi adalah garis lanjutan (ke kolom sebelumnya) jika setidaknya satu karakter dalam baris tersebut bukan spasi. Bersama

Contoh

Example
R
# 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)
# }

See Also

write.table. available.packages which uses read.dcf to read the indices of package repositories.