refer {exams.forge}R Documentation

Generate Vector Element Names

Description

Creates names for elements of a vector.

Usage

refer(x, fmt = "%s_{%.0f}", to = deparse(substitute(x)), index = 1:length(x))

refer2vector(
  x,
  fmt = "%s_{%.0f}",
  to = deparse(substitute(x)),
  index = 1:length(x)
)

Arguments

x

vector: a vector to create the names for

fmt

character: format string for sprintf (default: "%s_{%.0f}"

to

character: base name of elements

index

numeric: vector with indices (default: 1:length(x))

Value

A character vector

Examples

x <- runif(5)
refer(x)                  # LaTeX default
refer(x, fmt="%s[%.0f]")  # R default

[Package exams.forge version 1.0.10 Index]