Learn R Programming

Claddis (version 0.7.0)

make_labels: Make unique text labels

Description

Given a requisite number, generates that many unique text labels.

Usage

make_labels(N)

Value

A character vector of N unique labels.

Arguments

N

The number of labels required,

Author

Graeme T. Lloyd graemetlloyd@gmail.com

Details

Where a list of unique text labels are required (i.e., where simple numbering will not suffice) it can be useful to have a simple function that generates the required amount.

In practice, this is simple in R when N is 26 or less as the LETTERS object can be used for this purpose. For example, to get ten unique labels:

LETTERS[1:10]

This function works in a similar way but will add a second, third etc. letter where the value of N requires it.

Examples

Run this code

# Make 40 unique text labels:
make_labels(N = 40)

Run the code above in your browser using DataLab