nMarkers: The number of markers attached to a pedigree

View source: R/marker_utils.R

nMarkersR Documentation

The number of markers attached to a pedigree

Description

The number of markers attached to a pedigree

Usage

nMarkers(x, compwise = FALSE)

hasMarkers(x, compwise = FALSE)

Arguments

x

A ped object or a list of such.

compwise

A logical, only relevant if x is a ped list. Default FALSE.

Value

nMarkers() by default returns a single number; the number of marker objects attached to x. If x is a ped list, an error is raised if the components have different numbers of markers. This check can be skipped by setting compwise = TRUE, in which case the function returns a vector of the component-wise marker numbers.

The function hasMarkers(x) returns TRUE if (at least component of) x has attached markers, otherwise FALSE. If compwise = TRUE, a logical vector of the same length as x.

Examples

x = nuclearPed() |> addMarker()
nMarkers(x) # = 1

y = list(x, singleton(1))
nMarkers(y, compwise = TRUE) # c(1,0)

hasMarkers(y) # TRUE
hasMarkers(y, compwise = TRUE) # c(TRUE, FALSE)


magnusdv/pedtools documentation built on April 9, 2024, 7:35 a.m.