CountColumns: count columns of files

Description Usage Arguments Value Author(s) Examples

Description

small helper function that attempts to count how many columns there are in a file

Usage

1
2
3
4
5
6
7
CountColumns(files = c("ftr1.txt", "ftr2.txt"), sep = c(" ", 


    ",", "\t", "|")[1], mycat = c("", "gunzip -cf ", "cat ")[1], 


    filterStr = "", verbose = 0, ...)

Arguments

files

which files to inspect

sep

column delimiter; default white space

mycat

effective cat command, if empty do NOT use FIFos

filterStr

various inline filters that act locally and do not need an input file,

verbose

level of verbosity

...

further arguments to myjoin such as missingValue or extraARGS

Value

returns number of columns of each file

Author(s)

"Markus Loecher, Berlin School of Economics and Law (BSEL)" <markus.loecher@gmail.com>

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
if (0){


  ret = ArtificialData(fakeDataDir="fakeData2", joinKey = 0:9, N = rep(6, 4), verbose=1)


  CountColumns(paste0("fakeData2/file",1:4,".txt"))


  #gzipped data:


  ret = ArtificialData(fakeDataDir="fakeData2", joinKey = 0:9, N = rep(6, 4), GZIP=1, verbose=1)


  CountColumns(paste0("fakeData2/file",1:4,".txt.gz"),mycat ="gunzip -cf ")


  #gzipped and selected columns:  


  ret = ArtificialData(fakeDataDir="fakeData2", joinKey = 0:9, N = rep(6, 4), GZIP=1, verbose=1)


  CountColumns(paste0("fakeData2/file",1:4,".txt.gz"),mycat ="gunzip -cf ", 


               filterStr=" | cut -f1,3 -d\" \" ")


}

MultiJoin documentation built on May 1, 2019, 7:32 p.m.