Generic methods to extract and replace elements of greta arrays, or to combine greta arrays.
x
a greta array
i
, j
indices specifying elements to extract or replace
n
a single integer, as in utils::head()
and utils::tail()
value
for
a greta array to replace elements, for [<-
either NULL or a numeric vector of dimensions
dim<-
...
either further indices specifying elements to extract or replace ([
), or multiple greta arrays to combine (cbind()
, rbind()
& c()
), or additional arguments (rep()
, head()
, tail()
)
drop
, recursive
generic arguments that are ignored for greta arrays
# extract x[i] x[i, j, ..., drop = FALSE] head(x, n = 6L, ...) tail(x, n = 6L, ...) # replace x[i] <- value x[i, j, ...] <- value # combine cbind(...) rbind(...) c(..., recursive = FALSE) rep(x, times, ..., recursive = FALSE) # get and set dimensions length(x) dim(x) dim(x) <- value
x <- as_data(matrix(1:12, 3, 4)) # extract/replace x[1:3, ] x[, 2:4] <- 1:9 # combine cbind(x[, 2], x[, 1]) rbind(x[1, ], x[3, ]) c(x[, 1], x) rep(x[, 2], times = 3)