When dealing with mortality data, it is typical to 'square' it into an $n\times m$ matrix, where entries $m(x,t)$ correspond to the mortality rate for a life aged $x$ in cohort/year $t$.
A function like transform() & transform!() could take in mortality date and apply this transformation. Where there are multiple representations of the mortality data (e.g. males, females, total), a Dict could be returned with DataFrame objects as values, so t["Males"] returns a DataFrame of transformed Male rates. Similarly, a custom struct could work.
This will basically be a wrapper for DataFrames.unstack(df, :Year, :Male) but to handle cases where e.g. :Male may be ambiguous and there may be arbitrary columns to handle.
When dealing with mortality data, it is typical to 'square' it into an $n\times m$ matrix, where entries $m(x,t)$ correspond to the mortality rate for a life aged $x$ in cohort/year $t$.
A function like
transform()
&transform!()
could take in mortality date and apply this transformation. Where there are multiple representations of the mortality data (e.g. males, females, total), aDict
could be returned withDataFrame
objects as values, sot["Males"]
returns aDataFrame
of transformed Male rates. Similarly, a customstruct
could work.