Learn R Programming

nnspat (version 0.1.2)

pairwise.lab: Keeping the pair of the specified labels in the data

Description

Keeps only the specified labels \(i\) and \(j\) and returns the data from classes with these labels and also the corresponding label vector having class labels \(i\) and \(j\) only.

See also (ceyhan:jkss-posthoc-2017;textualnnspat).

Usage

pairwise.lab(dat, lab, i, j)

Value

A list with two elements

data.pair

The type of the pattern from which points are to be generated

lab.pair

The "main" title for the plot of the point pattern

Arguments

dat

The data set in one or higher dimensions, each row corresponds to a data point.

lab

The vector of class labels (numerical or categorical)

i, j

Label of the classes that are to be retained in the post-hoc comparison.

Author

Elvan Ceyhan

References

See Also

lab.onevsrest and classirest

Examples

Run this code
n<-20  #or try sample(1:20,1)
Y<-matrix(runif(3*n),ncol=3)
cls<-sample(1:2,n,replace = TRUE)  #or try cls<-rep(1:2,c(10,10))
pairwise.lab(Y,cls,1,2)

#############
n<-40
Y<-matrix(runif(3*n),ncol=3)
cls<-sample(1:4,n,replace = TRUE)  #or try cls<-rep(1:2,c(10,10))
pairwise.lab(Y,cls,2,3)

#cls as a factor
fcls<-rep(letters[1:4],rep(10,4))
pairwise.lab(Y,fcls,"b","c")

Run the code above in your browser using DataLab