Learn R Programming

poputils

Manipulate and analyse demographic data.

Installation

install.packages("poputils")

For end users

Data manipulation

  • logit(), invlogit() Logistic transformation
  • trim_01() Trim values to interval (0, 1)
  • rr3() Randomly round to base 3

Life expectancy, life tables

  • ex_to_lifetab_brass() Use the Brass logit model to derive life tables with specified life expectancies
  • lifeexp() Calculate life expectancy from mortality rates
  • lifetab() Calculate life tables from mortality rates
  • q0_to_m0() Infant mortality

Fertility

  • tfr() Calculate total fertility rates

Labels

  • age_labels() Create age labels
  • age_lower(), age_mid(), age_upper() Limits and midpoints of age groups
  • combine_age() Merge age group labels
  • reformat_age() Reformat age group labels
  • reformat_sex() Reformat sex labels
  • set_age_open() Specify oldest age group

For developers

Checking arguments

  • check_n() Check an integer scalar.

Data manipulation

  • check_no_overlap_colnums() Check for argument clashes
  • groups_colnums() Get column numbers for grouping variables
  • matrix_to_list_of_cols(), matrix_to_list_of_rows() Split matrix
  • to_matrix() Convert data frame to matrix

Labels

  • age_group_type() Infer type of age group label
  • check_age() Validity checks for age group labels
  • find_label_female(), find_label_male() Identify sex or gender labels
  • find_var_age(), find_var_sexgender(), find_var_time() Identify age, sex/gender, time variables

Copy Link

Version

Install

install.packages('poputils')

Monthly Downloads

231

Version

0.4.1

License

MIT + file LICENSE

Issues

Pull Requests

Stars

Forks

Maintainer

John Bryant

Last Published

March 27th, 2025

Functions in poputils (0.4.1)

find_label_male

Identify Sex or Gender Labels Referring to Males
find_label_female

Identify Sex or Gender Labels Referring to Females
age_lower

Lower Limits, Midpoints, and Upper Limits of Age Groups
check_age

Validity Checks for Age Labels
check_no_overlap_colnums

Check that Colnum Vectors do not Overlap
find_var_age

Identify an Age Variable
find_var_sexgender

Identify a Sex or Gender Variable
check_equal_length

Check that Arguments have Same Length
q0_to_m0

Convert q0 to m0
check_n

Check Whole Number
groups_colnums

Get a named vector of column indices for the grouping variables in a grouped data frame
reformat_age

Reformat Age Group Labels
find_var_time

Identify a Time Variable
iran_fertility

Age-Specific Fertility Rates in Iran
west_lifetab

Coale-Demeny West Model Life Tables
nzmort_rvec

Mortality Data and Probabilistic Rates for New Zealand
combine_age

Aggregate Age Group Labels
age_labels

Create Age Labels
matrix_to_list_of_cols

Turn a Matrix Into a List of Columns or Rows
nzmort

Mortality Data for New Zealand
reformat_sex

Reformat a Binary Sex Variable
lifetab

Calculate Life Tables or Life Expectancies
logit

Logit and Inverse-Logit Functions
set_age_open

Specify Open Age Group
tfr

Calculate Total Fertility Rates
rr3

Randomly Round A Vector of Integers to Base 3
poputils-package

Functions for working with demographic data
to_matrix

Build a Matrix from Measure and ID Variables
trim_01

Trim Values So They Are Between 0 and 1
ex_to_lifetab_brass

Derive Life Tables that Match Life Expectancies, using a Brass Logit Model
age_group_type

Infer Age Label Type