to_n: Replicate entries of a vector if required

View source: R/utils.R

to_nR Documentation

Replicate entries of a vector if required

Description

[Stable]

Replicate entries of a vector if required.

Usage

to_n(x, n)

Arguments

x

(numeric)
vector of numbers we want to analyze.

n

(integer(1))
number of entries that are needed.

Value

x if it has the required length already or is NULL, otherwise if it is scalar the replicated version of it with n entries.

Note

This function will fail if x is not of length n and/or is not a scalar.


tern documentation built on Sept. 24, 2024, 9:06 a.m.