R function and tools for working with multistate demographic data