homogenise: Homogenise a list

View source: R/homogenise.R

homogeniseR Documentation

Homogenise a list

Description

Takes each element of a list and repeats each one so they have the same length. This function is designed to be integrated in another function and clean its arguments. IF YOU RECEIVED A WARNING FROM THIS FUNCTION IN ANOTHER FUNCTION: Check that the length of the arguments indicated by the warning are correct.

Usage

homogenise(i = NULL, n = NULL, l = list(), cycle = TRUE)

homogenize(i = NULL, n = NULL, l = list(), cycle = TRUE)

Arguments

i

reference object of length n

n

length to reach (is overriden by i)

l

list for each element to be repeated to have a length n. These elements have to be integers, numerics or characters.

cycle

whether to recycle the elements or to only allow elements of length 1 or n

Value

A list identical to the one initially provided, with elements length homogenized to i

See Also

merge_list

Examples

i     <- rep(1:4, 2)

l <- list(a = c(1,2,3),
          b = "R",
          d = 1:100,
          e = c("a", "b"),
          f = FALSE
          )

homogenise(i = i, l = l)

homogenise(n = 10, l = l)


StratigrapheR documentation built on July 9, 2023, 6:02 p.m.