I have the following RDD of the Type ((UserID, MovieID),1):

```
val data_wo_header=dropheader(data).map(_.split(",")).map(x=>((x(0).toInt,x(1).toInt),1))

```

I want to convert this data structure into a 2D array such that all elements(userID Movie ID) present in the original RDD have a 1 else 0.

I think we have to map the user ID's to 0-N if N is the number of distinct users and map Movie ID's to 0-M if Mis the number of distinct movies.

EDIT: example

```
        Movie ID->

Userid  1 2 3 4 5 6 7 

1       0 1 1 0 0 1 0 
2       0 1 0 1 0 0 0 
3       0 1 1 0 0 0 1 
4       1 1 0 0 1 0 0 
5       0 1 1 0 0 0 1 
6       1 1 1 1 1 0 0 
7       0 1 1 0 0 0 0 
8       0 1 1 1 0 0 1 
9       0 1 1 0 0 1 0 

The RDD will be of the sort
(userID, movID,rating)
101,1002,3.5
101,1003,2.5
101,1006,3
102,1002,3.5
102,1004,4.0
103,1002,1.0
103,1003,1.0
103,1007,5.0
….

```