I have a binary matrix with 0 and 1s and I want each non-zero element substituted by a uniform distribution value on [−0.6, −0.3] ∪ [0.3, 0.6] in R.
Can anyone please help how can I achieve this?
I have a binary matrix with 0 and 1s and I want each non-zero element substituted by a uniform distribution value on [−0.6, −0.3] ∪ [0.3, 0.6] in R.
Can anyone please help how can I achieve this?
If your binary matrix looks like this:
Then you can replace its elements like so: