how do i build a function in R with a single vector that ranks the vector where and returns a n x n matrix where it returns 1 if i is preferred over j otherwise it returns 0.
I so far have this..
preferences <- matrix(nrow = n,ncol = n)
convert <- function(n){
for (i in 1:length(n)){
for (j in 1:length(n)){
## If ith element < jth element then TRUE
if (preferences[i,j] <- preferences[i] < preferences[j]){
1
}else if (preferences[i]==preferences[j]){
0
} else{
0}
}
}
print(preferences[i,j])
}
convert(c(8,1,3))