I am dealing with data with information of different candidates, the results of each candidate is distributed by class 1, 2, 3, 4
Candidate A Name | Sex | Votes |Candidate B Name | Sex | Votes | Candidate C Name | Sex | Votes | Candidate D Name | Sex | Votes
Class 1
Class 2
Class 3
Class 4
Firstly, I wish to group the columns of the information of a candidate, such that
Group A [ contains Candidate A Name | Sex | Votes of Candidate A]
Group B [ contains Candidate B Name | Sex | Votes of Candidate B]
Group C [ contains Candidate B Name | Sex | Votes of Candidate C]
After that, I wish to compare the number of votes of each candidate, and to Generate the name of the candidate only with the Highest Result into a new column
For example, if Candidate D obtains highest number of vote, name fo Candaidate D will be generate in a new column
Thank you in advance
Related Posts with How to group several columns?
Using numbers from tabulate var1 var2 into mcciDear Statalists, I need to perform a lot of McNemars using mcc or mcci (with a preference for mcci)…
Instrumental variable with ordinal dependent variable(reject the parallel test)Dear all, I am using the instrumental variable approach. My X variable is a binary variable, and Y …
Synthetic control for MicrodataI am using IPUMS microdata to run a differences-in-differences model and I want to augment it with a…
optimize issue with evaluator in a class Hi, I have the following two functions defined as public in the class nelogit_fp. Code: // ML d2…
Setting up a two-dimensional binary linear programming problemI am trying to solve a tricky (for me) 2D binary LP problem. Suppose I have a rectangular matrix B (…
Subscribe to:
Post Comments (Atom)
0 Response to How to group several columns?
Post a Comment