readTableIndex            package:R.utils            R Documentation

_R_e_a_d_s _a _s_i_n_g_l_e _c_o_l_u_m_n _f_r_o_m _f_i_l_e _i_n _t_a_b_l_e _f_o_r_m_a_t

_D_e_s_c_r_i_p_t_i_o_n:

     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'().

_U_s_a_g_e:

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

_A_r_g_u_m_e_n_t_s:

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.

_V_a_l_u_e:

     Returns a 'vector'.

_A_u_t_h_o_r(_s):

     Henrik Bengtsson (<URL: http://www.braju.com/R/>)

_S_e_e _A_l_s_o:

     'readTable'().

_E_x_a_m_p_l_e_s:

     ## 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)

