R/alignped2.R

Defines functions alignped2

# Automatically generated from all.nw using noweb

## Documentation with comments in align_code_details vignette: alignped2 section

alignped2 <- function(x, dad, mom, level, horder, packed,
                      spouselist) {
    x <- x[order(horder[x])]  # Use the hints to order the sibs
    rval <- alignped1(x[1],  dad, mom, level, horder, packed, 
                      spouselist)
    spouselist <- rval$spouselist

    if (length(x) >1) {
        mylev <- level[x[1]]
        for (i in 2:length(x)) {
            rval2 <-  alignped1(x[i], dad, mom, level,
                                horder, packed, spouselist)
            spouselist <- rval2$spouselist
            
            # Deal with the unusual special case:
            if ((rval2$n[mylev] > 1) || 
                          (is.na(match(x[i], floor(rval$nid[mylev,])))))
                rval <- alignped3(rval, rval2, packed)
            }
        rval$spouselist <- spouselist
        }
    rval
    }

Try the kinship2 package in your browser

Any scripts or data that you put into this service are public.

kinship2 documentation built on May 29, 2024, 11:14 a.m.