I'm having following problem while doing some analysis with R.
I have a dataframe like this:
Name | Group | Count
Person 1 | A | 3
Person 2 | A | 1
Person 3 | A | 0
Person 1 | B | 5
Person 2 | B | 0
Person 3 | B | 1
Person 1 | C | 1
and I'd need to "expand" it (not sure if the right term) to be like this:
Person 1 | A
Person 1 | A
Person 1 | A
Person 2 | A
Person 1 | B
Person 1 | B
etc.
So it takes value of pair Person 1 and A (in this example, 3) and makes three rows with Person 1 and A and does so for every Person - Group -combination. Can't figure out any good words for searching online.
reshape()
function $\endgroup$reshape2
package in R. It might also help todput
2 example dataframes: one with the input and one with the output. $\endgroup$