visuals<-,Asset-method {Allspice}R Documentation

Visual attributes

Description

Attach text and color attributes to categories.

Usage

visuals(obj) <- value

Arguments

obj

An object of the class Asset.

value

A character vector or a data frame, see details.

Details

If the input value is a character vector, the elements are stored as the category text and names of the elements are stored as category names.

If the input value is a data frame, the column 'LABEL' is used as the text and the row names as the names of the categories. Additional columns may include 'COLOR', 'COLOR.dark' and 'COLOR.light' that must contain strings of color names or hexadecimal codes as produced by rgb(). In absence of color data, the function assigns automatic colors.

Value

Updates the Asset object.

Examples

# Create a new asset and set nomenclature.
a <- asset()

# Set category labels with automatic colors.
labels <- paste("Category", 1:8)
names(labels) <- paste0("cat", 1:8)
visuals(a) <- labels
print(a@categories)

# Add color information.
info <- data.frame(stringsAsFactors = FALSE,
    LABEL = labels, COLOR = "red")
rownames(info) <- names(labels)
visuals(a) <- info
print(a@categories)

[Package Allspice version 1.0.5 Index]