IOfunctions              package:FLCore              R Documentation

_I_n_p_u_t/_O_u_t_p_u_t _o_f _F_L_R _o_b_j_e_c_t_s

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

     These functions read and save FLR objects of class 'FLStock',
     'FLIndex' and 'FLQuant' to and from various datafile formats
     commonly used in fisheries work and stock assessment.

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

       readFLStock(file, type = "VPA", name, desc = paste("Imported from a", type, "file. (",
         file, "). ", date()), m = 0.2, quant = "age", quiet = TRUE, no.discards = FALSE)
       readVPAFile(file, sep = "", units = "NA", quiet = TRUE)
       readFLIndex(file, type = "VPA", index.names, descs,
         desc =  paste("Imported from ", type, " file '", file, "'", sep = ""))
       readFLIndices(file, file2, type = "VPA", index.names, descs,
         desc = paste("Imported from ", type, " file '", file, "'", sep = ""), na.strings = "NA")
       writeFLStock(FLStock, output.file=FLStock@name, type = "VPA")

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

file, file2: name of file containing data in correct format.

output.file: directory and base filename where to place 'Lowestoft VPA
          Suite FOrmat' files

    type: this can either be "VPA" or "adapt" for 'Lowestoft' or
          'ICCAT' format

    name: name for object created

index.names: names for individual objects in FLIndices

    desc: description for object created

   descs: descriptions for individual objects in FLIndices

       m: natural mortality, default = 0.2, only used for 'ICCAT Adapt
          Format'

   quant: name for quant dimension default is "age"

   quiet: logical, suppress chit-chat

     sep: character separating columns of data

na.strings: string used to represent NA values in the input files

no.discards: should discards be assumed to be zero?

   units: units of measurement to be stored in the units attribute

 FLStock: FLStock object to be saved

_D_e_t_a_i_l_s:

     These functions are used for reading and writing stock and CPUE
     data used to conduct stock assessment. A number of data input
     formats are currently supported. These include the 'Lowestoft VPA
     Suite file format' which comprises a number of flat ascii data
     files  for catch numbers at age, catch weights at age, maturity,
     etc. and the 'ICCAT Adapt Format'

     For the 'Lowestoft VPA Suite file format' each input file contains
     header information  specifying the dimensions of the data matrix
     which may be comma, space or tab delimited.  Any comments in the
     file must be prefixed with a '#'. An index file gives the names of
      the individual data files to be read in. This is the file that
     should be passed  to 'readFLStock'. A single file can be read by
     'readVPA' into an  'FLQuant'.  Further information on the VPA file
     format can be obtained from <URL: http://my.web.site>.

     The 'Adapt file format' comprises a single file for input
     containing both the biological parameters, catches and catch per
     unit effort data. 

     If information on discards numbers at age and discards weights at
     age are available and these files are specified in the index file
     then they will be read into the 'FLStock' object otherwise the
     discards slots in the 'FLStock' object will remain empty.

     For reading CPUE data into an FLindex the file containing the CPUE
     data should be passed to the 'readFLIndex' function if only one
     CPUE series is given or else to 'readFLIndices' if multiple series
     are given.

     Confusingly, the file giving the names of the individual 'FLStock'
     input files is often called the index file. It is different to the
     file containing the CPUE data used for 'tuning' an assessment
     which is also sometimes called the index file.

     'writeFLStock' creates a set of files in 'Lowestoft File format'.
     This function takes 'output.file' as its argument, which is the
     base filename from which the output files will be named according
     to their content. A directory can be included in this argument
     (e.g.  via 'file.path') to specify where the files should be
     written.

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

     The FLR Team

_R_e_f_e_r_e_n_c_e_s:

     Darby, C.D. and Flatman, F. Virtual Population Analysis: version
     3.1 (Windows/DOS) user guide. Information technology series, No 1.
     CEFAS, Lowestoft, UK

     Porch, C. E. 1997. A user's manual for VPA-2BOX Version 2.0. 
     National Marine Fisheries Service, Miami, USA.

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

     ## Not run: 
     path  <- getwd()

     ## reads a set of 'Lowestoft File Format' for a stock and creates an FLStock object
     ple4        <-readFLStock(paste(path, "pleindex.txt", sep=""))

     ## reads a single file in 'Lowestoft File Format' and creates an FLQuant
     ple4.catch.n<-readVPAFile(paste(path, "plecanum.txt", sep=""))

     ## reads a set of tuning data in 'Lowestoft File Format' and creates an FLIndices object
     ple4.indices<-readFLIndices(paste(path, "plecpue.txt", sep=""))

     ## reads a single index from a tuning file in 'Lowestoft File Format' and creates an FLIndex object
     ple4.index  <-readFLIndex(paste(path, "plecpue1.txt", sep=""))

     ## writes an FLStock to 'Lowestoft File Format' in the current working directory
     writeFLStock(ple4,output.file=file.path(getwd(),"Ple4"))
     ## End(Not run)

