the function pivot_wider()

It's difficult to know how to solve your issues without access to your data I'm afraid.

FAQ: What's a reproducible example (reprex) and how do I create one?

An easy way of providing your data is by providing the output of dput(life_table) if the data isn't too big.