In a square matrix where only the cells above the diagonal is full (including the diagonal) and the rest is NA, I would like to symmetrically fill the NA's below the diagonal with the values above the diagonal.
Edit: The example may have been misleading, so I slightly modified it.
Example:
library(tidyverse)
Tibble <- tibble(A = c(5, NA, NA),
B = c(1, 3, NA),
C = c(6, 2, 4))
Tibble
Result:
# A tibble: 3 × 3
A B C
<dbl> <dbl> <dbl>
1 5 1 6
2 NA 3 2
3 NA NA 4
Desired outcome:
# A tibble: 3 × 3
A B C
<dbl> <dbl> <dbl>
1 5 1 6
2 1 3 2
3 6 2 4