# Example with dissimilarity data in table format
dissim_table <- matrix(c(1.2, 2.1, 3.4, 1.8, 2.9, 4.1),
nrow = 2, ncol = 3,
dimnames = list(c("Obj1", "Obj2"),
c("Ref1", "Ref2", "Ref3")))
mat_dissim <- table_to_matrix(dissim_table, is_similarity = FALSE)
# Example with similarity data (will be converted to dissimilarity)
sim_table <- matrix(c(8.8, 7.9, 6.6, 8.2, 7.1, 5.9),
nrow = 2, ncol = 3,
dimnames = list(c("Obj1", "Obj2"),
c("Ref1", "Ref2", "Ref3")))
mat_from_sim <- table_to_matrix(sim_table, is_similarity = TRUE)
Run the code above in your browser using DataLab