View source: R/identical_partition.R
identical_partition | R Documentation |
Checks if two vectors represent the same k-partition.
identical_partition(p1, p2)
p1 |
A vector of integers representing a k-partition (taking values
from 1 to k), of the same length of |
p2 |
A vector of integers representing a k-partition (taking values
from 1 to k), of the same length of |
Parameters p1
and p2
are vectors indicating group membership.
In this package context, these vectors have as many elements as the columns
of a phytosociological table, indicating the group membership of each
relevé to one of k groups (i.e., a k-partition).
This function checks if the two given vectors p1
and p2
correspond, in
practice, to the same k-partition, i.e., if the relevé groups are actually
the same, but the group numbers are somehow swapped.
TRUE
if p1
and p2
represent the same k-partitions; FALSE
otherwise.
Tiago Monteiro-Henriques and Jorge Orestes Cerdeira. E-mail: tmh.dev@icloud.com.
# Creating three 2-partitions
par1 <- c(1, 1, 2, 2, 2)
par2 <- c(2, 2, 1, 1, 1)
par3 <- c(1, 1, 1, 2, 2)
# Is it the same partition?
identical_partition(par1, par2) # TRUE
identical_partition(par1, par3) # FALSE
identical_partition(par2, par3) # FALSE
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.