readTableIndex: Reads a single column from file in table format

Description Usage Arguments Value Author(s) See Also Examples

Description

Reads a single column from file in table format, which can then be used as a index-to-row (look-up) map for fast access to a subset of rows using readTable().

Usage

1
2
## Default S3 method:
readTableIndex(..., indexColumn=1, colClass="character", verbose=FALSE)

Arguments

indexColumn

An single integer of the index column.

colClass

A single character specifying the class of the index column.

...

Arguments passed to readTable() used internally.

verbose

A logical or a Verbose object.

Value

Returns a vector.

Author(s)

Henrik Bengtsson

See Also

readTable().

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
## Not run: 
   # File containing data table to be access many times
   filename <- "somefile.txt"

   # Create a look-up index
   index <- readTableIndex(filename)

   # Keys of interest
   keys <- c("foo", "bar", "wah")

   # Read only those keys and do it fast
   df <- readTable(filename, rows=match(keys, index))

## End(Not run)

R.utils documentation built on Sept. 26, 2021, 9:07 a.m.