# Analysis of community ecology data in R

David Zelený

### Site Tools

en:similarity_examples

# Differences

This shows you the differences between two versions of the page.

 en:similarity_examples [2020/03/24 15:34]Lin, Po-Yu en:similarity_examples [2020/03/24 15:58] (current)Lin, Po-Yu Both sides previous revision Previous revision 2020/03/24 15:58 Lin, Po-Yu 2020/03/24 15:34 Lin, Po-Yu 2020/03/24 15:01 Lin, Po-Yu 2020/03/13 22:37 David Zelený 2020/03/13 22:34 David Zelený 2020/03/13 22:34 David Zelený [Examples] 2018/03/22 08:52 David Zelený [Examples] 2017/10/11 20:36 external edit2017/03/10 14:44 David Zelený [Example] 2017/02/22 22:09 David Zelený [Example] 2017/02/22 22:08 David Zelený [Example] 2017/02/22 22:06 David Zelený created 2020/03/24 15:58 Lin, Po-Yu 2020/03/24 15:34 Lin, Po-Yu 2020/03/24 15:01 Lin, Po-Yu 2020/03/13 22:37 David Zelený 2020/03/13 22:34 David Zelený 2020/03/13 22:34 David Zelený [Examples] 2018/03/22 08:52 David Zelený [Examples] 2017/10/11 20:36 external edit2017/03/10 14:44 David Zelený [Example] 2017/02/22 22:09 David Zelený [Example] 2017/02/22 22:08 David Zelený [Example] 2017/02/22 22:06 David Zelený created Line 34: Line 34: which (as.matrix (vltava.bray) == min (vltava.bray),​ arr.ind = TRUE) which (as.matrix (vltava.bray) == min (vltava.bray),​ arr.ind = TRUE) ​ - The function ''​which''​ will return the position of TRUE value in the argument – here, after setting argument ''​arr.ind = TRUE''​ (return array index) it will return the row and column of the shorted ​Bray-Curtis distance. Note that the function ''​min''​ needs to be applied on the original ''​vltava.bray''​ object, which is of the class ''​dist''​ – in fact, this is a vector, which is wrapped into the triangular “distance matrix”. This triangle does not contain the diagonal values, which are all zeros here (we are calculating distances) – otherwise, the ''​min''​ function would always return zero. + The function ''​which''​ will return the position of TRUE value in the argument – here, after setting argument ''​arr.ind = TRUE''​ (return array index) it will return the row and column of the shortest ​Bray-Curtis distance. Note that the function ''​min''​ needs to be applied on the original ''​vltava.bray''​ object, which is of the class ''​dist''​ – in fact, this is a vector, which is wrapped into the triangular “distance matrix”. This triangle does not contain the diagonal values, which are all zeros here (we are calculating distances) – otherwise, the ''​min''​ function would always return zero. Plots 2 and 4 are the most similar – no wonder, since if we print and compare their species composition,​ most of the species occur in both of them: Plots 2 and 4 are the most similar – no wonder, since if we print and compare their species composition,​ most of the species occur in both of them: