ID EN
Vector & List

cat

R Base 3.6.2 🇮🇩 Bahasa Indonesia

Menghasilkan objek, menggabungkan representasi. cat melakukan konversi jauh lebih sedikit daripada mencetak.

Syntax

R
cat(… , file = "", sep = " ", fill = FALSE, labels = NULL,
    append = FALSE)

Arguments

Parameter Deskripsi
… R objects (see ‘Details’ for the types of objects allowed).
file A connection, or a character string naming the file to print to. If "" (the default), cat prints to the standard output connection, the console unless redirected by sink. If it is "|cmd", the output is piped to the command given by cmd, by opening a pipe connection.
sep a character vector of strings to append after each element.
fill a logical or (positive) numeric controlling how the output is broken into successive lines. If FALSE (default), only newlines created explicitly by "\n" are printed. Otherwise, the output is broken into lines with print width equal to the option width if fill is TRUE, or the value of fill if this is numeric. Non-positive fill values are ignored, with a warning.
labels character vector of labels for the lines printed. Ignored if fill is FALSE.
append logical. Only used if the argument file is the name of file (and not a connection or "|cmd"). If TRUE output will be appended to file; otherwise, it will overwrite the contents of file.

Return Value

Tidak ada (NULL tidak terlihat).

Details

cat berguna untuk menghasilkan keluaran dalam fungsi yang ditentukan pengguna. Ini mengubah argumennya menjadi vektor karakter, menggabungkannya menjadi vektor karakter tunggal, menambahkan string sep = yang diberikan ke setiap elemen dan kemudian mengeluarkannya. Tidak ada linefeed yang dihasilkan kecuali diminta secara eksplisit oleh "\n" atau jika dihasilkan dengan pengisian (jika argumen isian TRUE atau numerik). Jika file merupakan koneksi dan terbuka untuk ditulis, maka file tersebut ditulis dari posisinya saat ini. Jika tidak terbuka, dibuka selama panggilan dalam mode "wt" dan kemudian ditutup kembali. Saat ini hanya vektor dan nama atom yang ditangani, bersama dengan NULL dan objek dengan panjang nol lainnya (yang tidak menghasilkan keluaran). String karakter adalah output 'sebagaimana adanya' (tidak seperti print.default yang lolos dari karakter yang tidak dapat dicetak dan garis miring terbalik --- gunakan encodeStrin

Contoh

Example
R
# NOT RUN {
iter <- stats::rpois(1, lambda = 10)
## print an informative message
cat("iteration = ", iter <- iter + 1, "\n")

## 'fill' and label lines:
cat(paste(letters, 100* 1:26), fill = TRUE, labels = paste0("{", 1:10, "}:"))
# }

See Also

print format and paste which concatenates into a string.