add_unequal_vectors: Add vectors of unequal length

View source: R/add_unequal_vectors.R

add_unequal_vectorsR Documentation

Add vectors of unequal length

Description

Function used to add aligned vectors of unequal length without recycling elements of the shorter vector. Used to combine male and female cohorts when max_age is not equal in the max_ages dataset.

Usage

add_unequal_vectors(x, y)

Arguments

x, y

Paired numeric vectors of same or different length.

Value

A vector of length one containing pre-spawn survival.

References

https://stackoverflow.com/questions/2307443/how-to-add-two-vectors-without-repeating-in-r

Examples

x <- c(1, 2)
y <- c(1, 2, 3)
add_unequal_vectors(x, y)


danStich/anadrofish documentation built on Jan. 17, 2025, 9:46 a.m.