Read SENATE's Grab Sample Data from CSV (type 1)
Source:R/senates_grab_sample_data_1.R
hsGetGsData1.Rd
SENATE's grab sample data is read from a csv file (type 1) and returned in forms of a list (see Value section below). The csv file is expected to contain grab sample data of exactly one monitoring point. For a format description of the csv file see the Details section below.
Usage
hsGetGsData1(
csv,
sep = ";",
dateFormat = "%d.%m.%Y",
dec = ",",
data.block.number = NA,
dbg = FALSE
)
Arguments
- csv
full path to csv file
- sep
separator in csv file, e.g. ";" or ","
- dateFormat
date format specifier describing the format in which dates are represented in the csv file. Use placeholders ,
"%d"
(day),"%m"
(month),"%y"
(2-digit year),"%Y"
(4-digit year) to describe the date format."%d.%m.%Y"
,"%d/%m/%y"
,"%Y-%m-%d"
are examples for valid format specifiers.- dec
decimal character: "." or ","
- data.block.number
if the file contains data for more than one monitoring point, data.block.number needs to be an integer number between one and the number of monitoring points for which data are provided in the file. Only data of monitoring point corresponding to the given number are extracted. If data.block.number is NA (default) it is expected that the file contains data for only one monitoring point. The program will stop if data is provided for more than one monitoring point
- dbg
if
TRUE
(default), debug messages are shown
Value
Grab sample data is returned in forms of a list, e.g.:
$ moniPoint:List of 2
..$ mpID : chr "110"
..$ mpName: chr "M<ue>ggelspree, F<ae>hre Rahnsdorf (0,5 m)"
$ byPar :List of 104
..$ 10001 :List of 7
.. ..$ parID : chr "10001"
.. ..$ parName: chr "Lufttemperatur"
.. ..$ parUnit: chr "<degree>C"
.. ..$ smpDate: Date[1:247], format: "1995-02-06" "1995-03-06" ...
.. ..$ parTxt : chr [1:247] "6,000" "5,000" "12,000" "8,000" ...
.. ..$ parVal : num [1:247] 6 5 12 8 4 5 24 13 16 19 ...
.. ..$ parLim : chr [1:247] "" "" "" "" ...
..$ 10005 :List of 7
.. ..$ parID : chr "10005"
.. ..$ parName: chr "Wassertemperatur"
.. ..$ parUnit: chr "<degree>C"
.. ..$ smpDate: Date[1:247], format: "1995-02-06" "1995-03-06" ...
.. ..$ parTxt : chr [1:247] "3,700" "4,600" "7,100" "7,900" ...
.. ..$ parVal : num [1:247] 3.7 4.6 7.1 7.9 13.5 11.3 21.3 15.6 18.2 23.6 ...
.. ..$ parLim : chr [1:247] "" "" "" "" ...
..$ 10010 :List of 7
.. ..$ parID : chr "10010"
.. ..$ parName: chr "Sichttiefe"
.. ..$ parUnit: chr "cm"
.. ..$ smpDate: Date[1:238], format: "1995-02-06" "1995-03-06" ...
.. ..$ parTxt : chr [1:238] "170,000" "80,000" "50,000" "110,000" ...
.. ..$ parVal : num [1:238] 170 80 50 110 100 190 140 180 200 200 ...
.. ..$ parLim : chr [1:238] "" "" "" "" ...
...
Within the sub-structures representing the parameters, parTxt
contains
the values in text format as they were read from the file, parVal
contains the values as they were converted from text to double and
parLim
contains the characters indicating underrunning or exceedance
of detection limits, as they were extracted from parTxt
.
Details
The csv file is expected to look like the following example. It is structured
into blocks each of which represents a measured parameter. Within each block
grab sample results are organized in three columns: 1. sample date, 2.
measurement value, 3. character indicating if the detection limit was
underrun or exceeded. (see Parameter Sichttiefe
in the example below).
The third column is empty if the detection limit was not underrun or exceeded
(as in almost all data lines of the example below).
Export Parameterwerte;
110 Mueggelspree, Faehre Rahnsdorf (0,5 m);
10001 Lufttemperatur [<degree>C];
;110 - 10001
06.02.1995;6,000
06.03.1995;5,000
...
03.12.2007;7,000
10005 Wassertemperatur [<degree>C];
;110 - 10005
06.02.1995;3,700
06.03.1995;4,600
...
03.12.2007;3,900
10010 Sichttiefe [cm];
;110 - 10010
06.02.1995;170,000
06.03.1995;80,000
...
13.11.1995;260,000;>
...