[R] unbalanced number of rows
sabasehrish at yahoo.com
Sun Apr 10 12:57:13 CEST 2016
HiI have a data frame with rows specifying companies (codes are assigned to companies) and columns specify months (monthly data). The data is based on male (M) and female (F) information for each month. Following is an example of how data looks like:
01 02 03 04001 na M M M001 M M M F002 M F F na003 M na na M003 F M M F003 F F M M
na= no male/female.
Now, I want to firstly add rows with similar codes to see total number of Male and Female in each month. Secondly, I need to calculate fraction of Female in each month (F/ M+F) for these three companies.
Kindly guide me in this regard.
[[alternative HTML version deleted]]
More information about the R-help