I have a table presenting the correlations between three different variables (Correlation1, Correlation2, Correlation 3) of each source (1,...,n). However, not every source reports every correlation.
Now I want to create a matrix indicating which of these correlations is given in which source. The number of rows of the indicator matrix should be equal to the total number of values given in the corr.table without NA. The indicator is always on the diagonal and set to "1" if the corresponding correlation at this position is given.
I have summarized my problem in a simple example:
Here, source 1 contains the first correlation, therefore the first value of the diagonal is set to "1" and all other elements are "0". The same is given in source 2. Source 3 reports all three correlations, therefore the first value in the third row will be set to "1", the second element in the fourth row is also set to "1" and the third value in fifth row is set to "1". And so on....
Do you have an idea, how to create this indicator matrix given the correlation matrix in R?