Within the vector, select common elements specified in reference file.
See examples in Table 3.36〜3.37.
Table 3.36: Input data in.csv |
||||||||||
no items 1 a b c 2 a d 3 b f e f 4 f c d |
item |
a |
c |
e |
Table 3.37: Basic example vf=items m=ref.csv K=item |
||||||||||
no items 1 a c 2 a 3 e 4 c |
no |
items |
1 |
b |
2 |
d |
3 |
b f f |
4 |
f d |
Since the mvcommon command reads the whole reference file at once into the memory, note that huge reference file may consume massive amount of memory,
mvcommon vf= K= [-r] m=| i= [o=] [delim=] [-nfn] [-nfno] [-x] [--help] [--version]
vf= Specify the field name(s) of vector (from i= input file) for matching. Multiple fields can be specified. Sorting on vectors is not required. Output of vector series can be defined with colon followed after the vector name. m= Reference file. K= Join key of reference file (m=) where corresponding taxonomy elements are joined to the vector. -r Select records where key elements that do no match in vf= and K= .
$ more dat1.csv items1,items2 b a c,b b c c,a d e a a,a a $ more ref1.csv item a c e $ mvcommon vf=items1,items2 K=item m=ref1.csv i=dat1.csv o=rsl1.csv #END# kgvcommon K=item i=dat1.csv m=ref1.csv o=rsl1.csv vf=items1,items2 $ more rsl1.csv items1,items2 a c, c c,a e a a,a a
Define new column name for item2 as new2.
$ mvcommon vf=items1,items2:new2 K=item m=ref1.csv i=dat1.csv o=rsl2.csv #END# kgvcommon K=item i=dat1.csv m=ref1.csv o=rsl2.csv vf=items1,items2:new2 $ more rsl2.csv items1,items2,new2 a c,b b, c c,a d,a e a a,a a,a a
mvjoin : Join reference element to vector instead of select.