FullJoinPairs: create command to fully join lines of two files on a common...

Description Usage Arguments Details Value Note Author(s) Examples

Description

Calls the Unix utilitiy join to join lines of two files on a common field

The -a option is set for both files such that also unpairable lines are printed.

Usage

1
2
3
4
FullJoinPairs(f1, f2, j1 = 1, j2 = 1, o1 = 2:4, o2 = 2:4, missingValue = "NA", 


    sep = c(" ", ",", "\t", "|")[1], extraARGS = "")

Arguments

f1

filename of first file

f2

filename of second file

j1

join on this FIELD of file 1

j2

join on this FIELD of file 2

o1

obey this FORMAT while constructing output line from file 1 (NCOL1 would be the number of columns of file 1)

o2

obey this FORMAT while constructing output line from file 2 (NCOL2 would be the number of columns of file 2)

missingValue

replace missing input fields with missingValue

sep

column delimiter; default white space

extraARGS

extra (optional) arguments to be passed to the join function (such as –check-order or –header or –ignore-case)

Details

Each output line is constructed according to the FORMAT in the -o option. Each element in FIELD-LIST is either the single

character 0 or has the form M.N where the file number, M, is 1 or 2 and N is a positive field number.

A field specification of 0 denotes the join field. In most

cases, the functionality of the 0 field spec may be reproduced

using the explicit M.N that corresponds to the join field.

However, when printing unpairable lines (using either of the -a

or -v options), there is no way to specify the join field using

M.N in FIELD-LIST if there are unpairable lines in both files. To

give join that functionality, POSIX invented the 0 field

specification notation.

The elements in FIELD-LIST are separated by commas or blanks.

Blank separators typically need to be quoted for the shell. For

example, the commands join -o 1.2,2.2 and join -o 1.2 2.2

are equivalent.

Value

returns command

Note

Important: FILE1 and FILE2 must be sorted on the join fields. If you are unsure, pass the –check-order flag

Note, comparisons honor the rules specified by LC_COLLATE.

Author(s)

"Markus Loecher, Berlin School of Economics and Law (BSEL)" <[email protected]>

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
if (0){


  ret = ArtificialData(fakeDataDir=tempdir(), numFiles=2,NCOL = rep(4,2))


  FullJoinPairs(ret$fnames[[1]][1], ret$fnames[[2]][1], o1=2:4, o2 = 2:4)


}

MultiJoin documentation built on Nov. 16, 2018, 1:17 a.m.