apollo_firstRow function

Keeps only the first row for each individual

Keeps only the first row for each individual

Given a multi-row input, keeps only the first row for each individual.

apollo_firstRow(P, apollo_inputs)

Arguments

  • P: List of vectors, matrices or 3-dim arrays. Likelihood of the model components (or other object).
  • apollo_inputs: List grouping most common inputs. Created by function apollo_validateInputs .

Returns

If P is a list, then it returns a list where each element has only the first row of each individual. If P is a single element, then it returns a single element with only the first row of each individual. The size of the element is changed only in the first dimension. If input is a scalar, then it returns a vector with the element repeated as many times as individuals in database. If the element is a vector, its length will be changed to the number of individuals. If the element is a matrix, then its first dimension will be changed to the number of individuals, while keeping the size of the second dimension. If the element is a cube, then only the first dimension's length is changed, preserving the others.

Details

This a function to keep only the first row of an object per indidividual. It can handle multiple types of components, including scalars, vectors and three-dimensional arrays (cubes). The argument database MUST contain a column called 'apollo_sequence', which is created by apollo_validateData .

  • Maintainer: Stephane Hess
  • License: GPL-2
  • Last published: 2025-03-12