Library: | xclust |
See also: | recode conting measure agglom kmeans |
Quantlet: | pswap | |
Description: | exchanges the category labels of a vector into other ones. Here the old category labels as well as the targed category labels have to be specified. Don't specify categories which should remain unchanged |
Usage: | u = pswap(p, c) | |
Input: | ||
p | n x 1 matrix of categories which have to be recoded into new ones or which should remain unchanged | |
c | l x 2 matrix of the old categories (first column) which have to be replaced by new category labels (second column) | |
Output: | ||
u | n x 1 matrix containing the new categories of p |
; load the library xclust library("xclust") p = #(2,1,3,4,3,2,1,4,5,4,3,2,4,1,1,2,1,4,5) c = #(2,1,3,5)~#(1,2,5,3) p~pswap(p,c)
Content of object _tmp [ 1,] 2 1 [ 2,] 1 2 [ 3,] 3 5 [ 4,] 4 4 [ 5,] 3 5 [ 6,] 2 1 [ 7,] 1 2 [ 8,] 4 4 [ 9,] 5 3 [10,] 4 4 [11,] 3 5 [12,] 2 1 [13,] 4 4 [14,] 1 2 [15,] 1 2 [16,] 2 1 [17,] 1 2 [18,] 4 4 [19,] 5 3