Ini adalah fungsi umum yang menggabungkan argumennya. Metode default menggabungkan argumennya untuk membentuk vektor. Semua argumen dipaksa ke tipe umum yang merupakan tipe nilai yang dikembalikan, dan semua atribut kecuali nama akan dihapus.
## S3 Generic function
c(…)<p></p><p># S3 method for default
c(…, recursive = FALSE, use.names = TRUE)</p>
| Parameter | Deskripsi |
|---|---|
… |
objects to be concatenated. |
recursive |
logical. If recursive = TRUE, the function recursively descends through lists (and pairlists) combining all their elements into a vector. |
use.names |
logical indicating if names should be preserved. |
# NOT RUN {
c(1,7:9)
c(1:5, 10.5, "next")
## uses with a single argument to drop attributes
x <- 1:4
names(x) <- letters[1:4]
x
c(x) # has names
as.vector(x) # no names
dim(x) <- c(2,2)
x
c(x)
as.vector(x)
## append to a list:
ll <- list(A = 1, c = "C")
## do *not* use
c(ll, d = 1:3) # which is == c(ll, as.list(c(d = 1:3)))
## but rather
c(ll, d = list(1:3)) # c() combining two lists
c(list(A = c(B = 1)), recursive = TRUE)
c(options(), recursive = TRUE)
c(list(A = c(B = 1, C = 2), B = c(E = 7)), recursive = TRUE)
# }