Learn R Programming

sparta (version 1.0.1)

get_val: Get value or cell name

Description

Find the value or the name of a cell

Usage

get_val(x, y)

# S3 method for sparta get_val(x, y)

get_cell_name(x, y)

# S3 method for sparta get_cell_name(x, y)

Arguments

x

sparta

y

named character vector or vector of cell indices

Examples

Run this code
x <- array(
  c(1,0,0,2,3,4,0,0),
  dim = c(2,2,2),
  dimnames = list(
    a = c("a1", "a2"),
    b = c("b1", "b2"),
    c = c("c1", "c2")
  )
)

sx <- as_sparta(x)
get_val(sx, c(a = "a2", b = "b1", c = "c2"))
get_cell_name(sx, sx[, 4])

Run the code above in your browser using DataLab