Learn R Programming

wakefield (version 0.3.6)

varname: Add Internal Name to Vector

Description

Adds the class variable and an internal attributes(x)[["varname"]] attribute to a vector.

Usage

varname(x, name)

Arguments

x

A vector to add a varname attribute (i.e., attributes(x)[["varname"]])

name

A name to assign to attributes(x)[["varname"]].

Value

Returns a vector of the class variable with a attributes(x)[["varname"]] assigned.

Examples

Run this code
# NOT RUN {
varname(1:10, "A")
attributes(varname(1:10, "A"))
sum(varname(1:10, "A"))

varname(LETTERS, "Caps")
attributes(varname(LETTERS, "Caps"))
paste(varname(LETTERS, "Caps"), collapse="")
# }

Run the code above in your browser using DataLab