I have a very large list that looks like this:
1
2
3
3
and need to create a list that looks like this:
|------|------|------|------|
| 1 | 1 | 0 | 0 |
|------|------|------|------|
| 2 | 0 | 1 | 0 |
|------|------|------|------|
| 3 | 0 | 0 | 1 |
|------|------|------|------|
| 3 | 0 | 0 | 1 |
|------|------|------|------|
I have tried using loops, and the method detailed here:
Create mutually exclusive dummy variables from categorical variable in R
But because the dataset is too large, I run into memory constraints.
Am thinking of using a split, apply, combine technique, but am not able to get the desired result.
Help is much appreciated!