dot-getParam: Extract parameter value(s) from a parameter file

Description Usage Arguments Value Author(s) Examples

Description

This function extracts from a text file the value(s) of a given parameter.

Usage

1
.getParam(params.lines, flag, flag.split, is.num = TRUE)

Arguments

params.lines

a string corresponding to the name of the file from which to extract the parameter value

flag

a string corresponding to the parameter name to be extracted and that must be present into the param.lines file

flag.split

a string to choose the concerned type of parameter (either "" or "^--.*--$"), depending on the type of parameter file (containing values or filenames)

is.num

default TRUE.
If TRUE, the extracted parameter is considered to be numeric and will be processed as such

Value

A vector containing one or more values of type string (if is.num = FALSE) or numeric (if is.num = TRUE).

Author(s)

Maya Guéguen

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
## Create a skeleton folder with the default name ('FATE_simulation')
if (dir.exists("FATE_simulation")) unlink("FATE_simulation", recursive = TRUE)
PRE_FATE.skeletonDirectory()

## Create a Global_parameters file
PRE_FATE.params_globalParameters(name.simulation = "FATE_simulation"
                                 , required.no_PFG = 6
                                 , required.no_strata = 5
                                 , required.simul_duration = 100
                                 , required.seeding_duration = c(10,50)
                                 , required.seeding_timestep = 1
                                 , required.seeding_input = 100
                                 , required.max_abund_low = 30000
                                 , required.max_abund_medium = 50000
                                 , required.max_abund_high = 90000)
                                 
## Extract number of PFG
.getParam(params.lines = "FATE_simulation/DATA/GLOBAL_PARAMETERS/Global_parameters_V1.txt"
          , flag = "NO_PFG"
          , flag.split = " "
          , is.num = TRUE)


## ----------------------------------------------------------------------------------------- ##
                                
## Load example data
          

MayaGueguen/RFate documentation built on Oct. 17, 2020, 8:06 a.m.