R routines for processing output from popco2 (initially copied from R directory of popco)