Skip to contents

Generates a named element. Can be used in conjunction with c() to create a collection of named elements

Usage

lhs %T% rhs

Arguments

lhs

Name for element in vector. Can be either static string or object that will need to be evaluated.

rhs

Element in vector

Value

A named vector

Examples

# Creating a named vector with a static name
vectorElement <- "value" %T% 5
print(vectorElement)
#> value 
#>     5 

# Creating a combined named vector with both static and dynamic names
nameForElement <- "dynamicName"
combinedVector <- c("staticName" %T% 123, nameForElement %T% 456)
print(combinedVector)
#>  staticName dynamicName 
#>         123         456 

# Note: `%T%` can be especially useful in data manipulation where dynamic
# naming of elements is required. Here's a more complex example:
keyMap <- data.frame(key = "key_01")
dynamicVector <- keyMap$key %T% 10
print(dynamicVector)
#> key_01 
#>     10