Factor-mapping protocol
# version information: v0.3 # date of update: 4/Apr/2018 library(wordcloud) # "wordcloud" is the name of an R package. data_pre <- read.csv("filename.csv") # "filename" is the name of the csv file # An example of auto-scaled data prepared for Factor-mapping approach # Sample No. |Variable 1 |Variable 2 |Variable 3 | ... # 1 |0.7 |-0.9 |0.3 | ... # 2 |0.9 |-0.8 |-0.5 | ... # 3 |0.2 |-0.6 |0.2 | ... # ... |... |... |... | ... # In this case, you need to delete the first column (Sample No.) using the next command # data_pre <- data_pre[,-1] # Gain a Spearman's correlation-coefficient matrix data_pair <- cor(data_pre, method = "s") # Convert the correlation matrix to a distant matrix dis_pair_mat <- matrix(1, nrow = nrow(data_pair), ncol = ncol(data_pair)) - data_pair dis_pair <- dist(dis_pair_mat, method ="euclidean") # Map the distant matrix using multidimensional scaling (MDS) data_map <- cmdscale(dis_pair) plot(data_map , type = "n" , xlab = "Dimension 1" , ylab = "Dimension 2" ) textplot(x = data_map[,1] , y = data_map[,2] , new = F , words = rownames(data_map) , col = c("color name for variable 1", ...) )