Check whether the field(s) specified in the f= parameter contains NULL value. Fields with non-NULL values are connected as one item and saved as a new vector.
mtraflg a= f= [delim=] [-r] [i=] [o=] [-nfn] [-nfno] [-x] [--help] [--version]
a= Specify the transaction field name. f= Check the values in the specified field name(s) (multiple fields can be specified) to create transaction data. (-r option is specified, extract list of values as the field name of the transaction data) delim= Specify the character to separate each transaction field item (Default character is space if this parameter is omitted). Character string should not be used. 1 byte character can be specified. -r Reverse conversion Convert transaction based data to vertically structured data.
Create a string of vector from the list of non-null values in column egg and milk.
$ more dat1.csv customer,egg,milk A,1,1 B,,1 C,1, D,1,1 $ mtraflg f=egg,milk a=transaction i=dat1.csv o=rsl1.csv #END# kgtraflg a=transaction f=egg,milk i=dat1.csv o=rsl1.csv $ more rsl1.csv customer,transaction A,egg milk B,milk C,egg D,egg milk
Use -r option to revert the output results back to the original data.
$ mtraflg -r f=egg,milk a=transaction i=rsl1.csv o=rsl2.csv #END# kgtraflg -r a=transaction f=egg,milk i=rsl1.csv o=rsl2.csv $ more rsl2.csv customer,egg,milk A,1,1 B,,1 C,1, D,1,1
Combine items using the “-” (hyphen) as delimiter. Save output in column named transaction.
$ mtraflg f=egg,milk a=transaction delim=- i=dat1.csv o=rsl3.csv #END# kgtraflg a=transaction delim=- f=egg,milk i=dat1.csv o=rsl3.csv $ more rsl3.csv customer,transaction A,egg-milk B,milk C,egg D,egg-milk
mvsort : Vector based transaction data can be processed by a set of commands (with mv as prefix) which handles vector data.
mcross : Rather than converting as transaction data, every item is saved separately as individual field in the output.
mtra : Create transaction data using values in the field.
mtrafld : Create transaction data with the format “field name=value”.