Click here to Skip to main content
15,882,113 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
I have a data with 2 columns. Var1 - school classes, Var2 - names of students in the class. What command can I use to make a new matrix that will show how many times are repeated unique names in var2 for each unique var1?

Var1 Var2
9 Sarah
9 John
12 Sarah
11 Veronica
10 John
10 John
11 Veronica
12 John
12 Veronica
11 Veronica
10 Sarah
9 Veronica
9 John

What command can I use to make a new matrix that will show how many times are repeated unique names in var2 for each unique var1?

_____Sarah____Veronica__John
9______1_______1___________2
10_____1_______0___________1
11_____0_______3___________0
12_____1_______1___________1

Thank you in advance!

What I have tried:

I don't know which command to use, please help
Posted
Comments
Richard MacCutchan 6-Aug-18 13:10pm    
I don't think you would use a single command. You would need to write the code to sort the data and create the lists you are interested in.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900