sortVectors: Sort two vectors

View source: R/sortVectors.R

sortVectorsR Documentation

Sort two vectors

Description

Sort two frequency vectors by the values in the first.

Usage

sortVectors(Z,R)

Arguments

Z

Population vector

R

Vector for the representatives

Details

This function takes two vectors of the same length, denoting for example the proportion of different groups in the population and among representatives. The function sorts both vectors by the first one. Put differently, the first vector will be sorted by decreasing value. The second vector will be sorted so that each position of the vector refers to the same group. This is a simple application of the order function in R.

Value

A list with two vectors, Z and R, sorted by Z

Author(s)

Didier Ruedin


polrep documentation built on Jan. 5, 2024, 3:01 a.m.