I’m happy to announce that the ipfr package is available on CRAN! The goal of this package is to make survey expansion, matrix balancing, and population synthesis easier.
A basic use case is the task of balancing a matrix to row and column targets:
library(ipfr) library(dplyr) mtx <- matrix(data = runif(9), nrow = 3, ncol = 3) row_targets <- c(3, 4, 5) column_targets <- c(5, 4, 3) result <- ipu_matrix(mtx, row_targets, column_targets) rowSums(result) #> [1] 3.