readFile               package:RSurvey               R Documentation

_D_a_t_a _I_n_p_u_t

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

     Reads a file in table format.

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

     readFile(file, fields = TRUE, units = TRUE)

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

    file: either a character string naming a file or a connection.

  fields: a logical value indicating whether the file contains the
          names of the variables as its first line.

   units: a logical value indicating whether the file contains the
          units of the variables as its second line.

_F_o_r_m_a_t:

     A tab delineated file, '*.txt', containing the following
     variables:

       '[,1]'   character  date/time (optional)
       '[,2]'   numeric    x values
       '[,3]'   numeric    y values
       '[,4:]'  numeric    z values, state variable(s)

     The first '[1,]' and second '[2,]' rows are reserved for column
     descriptors and units, respectively.  Units associated with
     date/time values are based on format character strings described
     in 'strptime',  for example '"%d/%m/%Y %H:%M:%OS"'. You can embed
     comments in the data file by using the  '#' character. Anything
     after a '#' on a line will be ignored.

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

     A list with the following components: 'cols', a character array of
     column names.  'vars', a character array of column names
     associated with the   date/time '[1]', x '[2]', y '[3]', and z
     '[4]' variables.  'data.raw', a data frame of raw survey data.

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

     Fisher, J. C.

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

     'read.table'

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

     ## A sample file including a header and two rows of data.

     ## Date / Time  Easting Northing        Depth
     ## %d/%m/%Y %H:%M:%OS     m       m       m
     ## 06/01/2001 01:01:59.000      727972.52       4138308.65      3.12
     ## 06/01/2001 01:01:59.200      727972.51       4138308.68      3.12

     f <- system.file("RSurvey-ex/lake.txt", package = "RSurvey")
     con <- file(f, open = "r", encoding = "latin1")
     d <- readFile(con)
     srvy.dat("cols", d$cols)
     srvy.dat("vars", d$vars)
     srvy.dat("data.raw", d$dat)

