Obtain the intersection of a list of vectors. Function "intersect" in the base package can only intersect two vectors. The function "intersect2" is designed to obtain the intersection and the difference for more than two vectors. The input should be a list whose elements are the vectors, and the outputs include the intersection of all vectors and a list whose elements are the input vectors substracting the intersection. Besides, intersect2 allows the labels of the vectors. If a list of labels is given in the input, then the outputs will also include a matrix of labels which match the intersection for the vectors, and a list of labels which match the left part of the vectors.
intersect2(vname, simplifiedname = vname)
A list of labels.
A list of vectors to make the intersection. Each element in the list has the same length as the corresponding element in vname. Default to be vname. If simplifiedname is not vname, then it works as the real vectors to match, and vname is like the labels of simplifiedname. If simplifiedname is the same as vname, then the returned value simpleuniq=uniq.
The outputs are 'public', 'individual', 'uniq', and 'simpleuniq'. 'public' is a vector of the intersection of 'simplifiedname'. 'individual' is a matrix with the original colnames matched to 'public' in all files. 'simpleuniq' is a list of the left part of 'simplifiedname' if we pick 'public' out. 'uniq' is a list of the left part of 'vname' if we pick 'individual' out.
Xiaoyue Cheng <[email protected]>
1 2 3 4
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.