Skip to contents

Generate a logical structure codifies active areas.

Usage

highlight_data(x, rows = NULL, columns = NULL, locations = NULL, ...)

# S3 method for class 'numeric'
highlight_data(x, rows = NULL, columns = NULL, locations = NULL, ...)

# S3 method for class 'integer'
highlight_data(x, rows = NULL, columns = NULL, locations = NULL, ...)

# S3 method for class 'vector'
highlight_data(x, rows = NULL, columns = NULL, locations = NULL, ...)

# S3 method for class 'matrix'
highlight_data(x, rows = NULL, columns = NULL, locations = NULL, ...)

# Default S3 method
highlight_data(x, rows = NULL, columns = NULL, locations = NULL, ...)

highlight_rows(x, rows = NULL)

highlight_columns(x, columns = NULL)

highlight_locations(x, locations = NULL)

Arguments

x

A matrix.

rows

An interger vector with valid row index locations.

columns

An integer vector containing valid column indexlocations.

locations

An m by 2 matrix with points listed in x, y format for a 2D object or a vector of integer indices in a 1D format.

...

Additional values (not used)

Value

A logical matrix or vector with the required rows and/or columns or points set to TRUE. All other values are given as FALSE.

Examples

## 2D Highlighting for Matrices ----
# Example data
x <- matrix(1:12, nrow = 4)

# Highlight points using an x, y pairing
locations <- rbind( 
  c(1, 3), 
  c(2, 2),
  c(4, 1)
)
highlight_locations(x, locations)
#>       [,1]  [,2]  [,3]
#> [1,] FALSE FALSE  TRUE
#> [2,] FALSE  TRUE FALSE
#> [3,] FALSE FALSE FALSE
#> [4,]  TRUE FALSE FALSE

# Highlight entries only in the 1st and 3rd rows.
highlight_rows(x, rows = c(1, 3))
#>       [,1]  [,2]  [,3]
#> [1,]  TRUE  TRUE  TRUE
#> [2,] FALSE FALSE FALSE
#> [3,]  TRUE  TRUE  TRUE
#> [4,] FALSE FALSE FALSE

# Highlight entries only in the first two rows:
highlight_rows(x, rows = 1:2)
#>       [,1]  [,2]  [,3]
#> [1,]  TRUE  TRUE  TRUE
#> [2,]  TRUE  TRUE  TRUE
#> [3,] FALSE FALSE FALSE
#> [4,] FALSE FALSE FALSE

# Highlight entries in the last column
highlight_columns(x, columns = ncol(x))
#>       [,1]  [,2] [,3]
#> [1,] FALSE FALSE TRUE
#> [2,] FALSE FALSE TRUE
#> [3,] FALSE FALSE TRUE
#> [4,] FALSE FALSE TRUE

# Highlight entries in the first column
highlight_columns(x, columns = 1)
#>      [,1]  [,2]  [,3]
#> [1,] TRUE FALSE FALSE
#> [2,] TRUE FALSE FALSE
#> [3,] TRUE FALSE FALSE
#> [4,] TRUE FALSE FALSE

# Highlight entries in the first column or first row.
highlight_data(x, rows = 1, columns = 1)
#>      [,1]  [,2]  [,3]
#> [1,] TRUE  TRUE  TRUE
#> [2,] TRUE FALSE FALSE
#> [3,] TRUE FALSE FALSE
#> [4,] TRUE FALSE FALSE

## 1D Highlighting for Vectors ----
vec <- c(3, NA, -1, 2, NaN, Inf, 42)
highlight_data(vec, locations = c(2, 4, 6))
#> [1] FALSE  TRUE FALSE  TRUE FALSE  TRUE FALSE