# Visualization associations between the symptoms - categorical data in R

I have a data frame with presence of symptoms which are categorical data (1 = present, 0 = absent). For instance:

abd_pain <- c(0,0,1,1,1)
constipation <- c(1,0,1,1,0)


I wonder what kind of statistical method and graph type use to clearly present the associations between the symptoms? I was considering

• correlation plot (R Spearmann)
• or contingency tabel (Chi-square test)

http://www.sthda.com/english/wiki/chi-square-test-of-independence-in-r

I have ~20 symptoms to visualize

• How about a distance metric, such as Manhattan? You can draw a dendrogram. – user2974951 Aug 9 at 10:28
• Do you mean this: stackoverflow.com/questions/48666059/… ? What kind of information represents the numbers in each box? – Mikołaj Aug 9 at 10:46

Here is an example in R, using the iris data set. I will estimate a distance matrix on the columns using the Manhattan distance, this is your (di)simmilarity matrix, where lower values mean that the variables are more similar, higher values mean they are not very similar.

distances=dist(t(iris[,-5]),method="manhattan")


which looks like this

             Sepal.Length Sepal.Width Petal.Length
Sepal.Width         417.9
Petal.Length        312.8       301.7
Petal.Width         696.6       278.7        383.8


Now I'll use hierarchical clustering to group variables together and get a plot.

plot(hclust(distances,method="ward.D2"))