convert_occupancy: Converting an Occupancy Matrix

View source: R/tools.R

convert_occupancyR Documentation

Converting an Occupancy Matrix

Description

Convert an occupancy matrix to matrix with different symbols.

Usage

convert_occupancy(x, to = c("", "<", ">", "v", "^"))

Arguments

x

an occupancy matrix consisting of the character "" (unoccupied), "l" (left), "r" (right), "d" (down) or "u" (up) as returned by zenplot().

to

a vector of symbols to which "", "l", "r", "d" and "u" should be mapped.

Value

matrix as the occupancy matrix but with entries replaced by those in to.

Author(s)

Marius Hofert

See Also

Other zenplot technical tools: is.standard(), n2dcols_aux(), num_cols(), turn_checker()

Examples

## Generate some data
n <- 1000 # sample size
d <- 20 # dimension
set.seed(271) # set seed (for reproducibility)
x <- matrix(rnorm(n * d), ncol = d) # i.i.d. N(0,1) data

## Extract the occupancy matrix from a zenplot
res <- zenplot(x)
(occ <- res[["path"]][["occupancy"]])

## Convert the occupancy matrix
convert_occupancy(occ)

zenplots documentation built on Nov. 8, 2023, 1:10 a.m.