Description

Generic methods to extract and replace elements of greta arrays, or to combine greta arrays.

Usage

Arguments

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 dim<- either NULL or a numeric vector of dimensions

...

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

Usage

# 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

Examples


 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)