Learn R Programming

assertive (version 0.2-6)

use_first: Only use the first element of a vector.

Description

If the input is not scalar, then only the first element is returned, with a warning.

Usage

use_first(x, indexer = c("[[", "["))

Arguments

x
Input that should be scalar.
indexer
Either double indexing, "[[" (the default) or single indexing "[".

Value

  • If x is scalar, it is returned unchanged, otherwise only the first element is returned, with a warning.