I'm trying to create a new table from a previous table, which calculates the differential values from variables inserted in the first table. The first table is in this formula:
gender AgeGroup real_wages.mean real_wages.stand_dev
1 1 A 5.664902 8.140341
2 2 A 5.177728 3.781762
3 1 B 7.191969 17.171500
4 2 B 6.307641 7.659018
...
So the idea for the new table is for it to have a column called "Differential",which, for each "AgeGroup", calculates the following:
("Real_wages.mean" of gender 1" - "Real Wages.mean" of gender 2)) / ("Real_mages.mean of gender 1"))
This means that the table would have one row per GroupAge and the column Differential which would have the result from the equation stated above.
Any idea on how to code this in R? Thank you!