Trace:

en:similarity_examples

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

Both sides previous revision Previous revision | |||

en:similarity_examples [2020/03/24 15:34] Lin, Po-Yu |
en:similarity_examples [2020/03/24 15:58] (current) Lin, Po-Yu |
||
---|---|---|---|

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) | ||

</code> | </code> | ||

- | 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: | ||

<code rsplus> | <code rsplus> |

en/similarity_examples.txt · Last modified: 2020/03/24 15:58 by Lin, Po-Yu