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. ThanksSaba
unbalanced number of rows
2 messages · Saba Sehrish, John Kane
Please have a look at http://stackoverflow.com/questions/5963269/how-to-make-a-great-r-reproducible-example and/or http://adv-r.had.co.nz/Reproducibility.html It looks like you have posted in HTML and the post is close to unreadable. The data is welcome but we really should have in in dput() form. Do ?dput() for more information. John Kane Kingston ON Canada
-----Original Message----- From: r-help at r-project.org Sent: Sun, 10 Apr 2016 10:57:13 +0000 (UTC) To: r-help at r-project.org Subject: [R] unbalanced number of rows 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. ThanksSaba [[alternative HTML version deleted]]
______________________________________________ R-help at r-project.org mailing list -- To UNSUBSCRIBE and more, see https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
____________________________________________________________ Can't remember your password? Do you need a strong and secure password? Use Password manager! It stores your passwords & protects your account.