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

remove_rows_n

Removes rows that contain 'NA' and/or 'Inf' entries


Description

This function removes any rows in which an 'NA' or an 'Inf' entry is found. The function is also able to remove records with 'Inf' entries, distinguishing it from the popular 'na.omit()' function in R.

Usage

remove_rows_n(traj, id_field=TRUE, remove=1)

Arguments

traj

[data.frame (numeric)]: longitudinal data. Each row represents an individual trajectory (of observations). The columns show the observations at consecutive time points.

id_field

[numeric or character] Whether the first column of the traj is a unique (id) field. Default: FALSE. If TRUE the function recognises the second column as the first time step.

remove

[integer] Type of missing entries to remove. 1 for 'NA', 2 for 'Inf', and 3 for both. Default:1.

Details

Given a matrix (or a dataframe) containing an 'NA' or an 'Inf' entry, the function returns only rows with complete observations.

Value

A matrix with complete observations

Examples

data(traj)

remove_rows_n(traj, id_field=TRUE, remove=3)

akmedoids

Anchored Kmedoids for Longitudinal Data Clustering

v1.3.0
GPL-3
Authors
Monsuru Adepeju [cre, aut], Samuel Langton [aut], Jon Bannister [aut]
Initial release

We don't support your browser anymore

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