Become an expert in R — Interactive courses, Cheat Sheets, certificates and more!
Get Started for Free

apollo_firstRow

Keeps only the first row for each individual


Description

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

Usage

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.

Details

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

Value

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.


apollo

Tools for Choice Model Estimation and Application

v0.2.4
GPL-2
Authors
Stephane Hess [aut], David Palma [aut, cre]
Initial release

We don't support your browser anymore

Please choose more modern alternatives, such as Google Chrome or Mozilla Firefox.