Package 'kwb.odmx'

Title: Extended functions to access the data in an ODM database
Description: Extended functions to access the data in an ODM database.
Authors: Hauke Sonnenberg [aut, cre] (ORCID: <https://orcid.org/0000-0001-9134-2871>), Michael Rustler [ctb] (ORCID: <https://orcid.org/0000-0003-0647-7726>), Kompetenzzentrum Wasser Berlin gGmbH (KWB) [cph]
Maintainer: Hauke Sonnenberg <[email protected]>
License: MIT + file LICENSE
Version: 0.2.0
Built: 2026-04-18 08:32:00 UTC
Source: https://github.com/KWB-R/kwb.odmx

Help Index


Get lab results from database

Description

Get lab results from database

Usage

getLabValuesGreaterOrEqualZero(
  db,
  stringsAsFactors = FALSE,
  keep.only.best.quality = TRUE
)

Arguments

db

name of ODBC database or full path to database file

stringsAsFactors

Passed to hsSqlQuery. Default: FALSE#'

keep.only.best.quality

if TRUE (default) data values in raw data quality are removed if they occur in different quality levels


Remove raw data values if data values of better quality exist

Description

Remove raw data values if data values of better quality exist

Usage

keepOnlyBestQualityControlLevel(x, dbg = TRUE)

Arguments

x

data frame with columns ValueID, LabSampleCode, VariableCode, QualityControlLevelID

dbg

if TRUE (default) debug messages are shown else not


read main ODM objects from Excel files

Description

read main ODM objects from Excel files (ID and Code or corresponding column)

Usage

readMainOdmObjects(folder)

Arguments

folder

folder containing the files variables.xls, sources.xls, sites.xls, methods.xls. In each Excel file the cell range making up the actual table must be named "tabledata"

Value

list with elements variables, sources, sites, methods each of which is a data frame with two columns (ID and code or a similar column identifying the object).


merge VariableCode and Unit, use '<', '>' or '=' as CensorCode

Description

merge VariableCode and Unit, use '<', '>' or '=' as CensorCode

Usage

simplifyColumns(x, short.codes = TRUE)

Arguments

x

data frame with columns VariableCode, UnitsAbbreviation, CensorCode

short.codes

if TRUE (default) the censor codes are renamed: "lt" -> "<"; "gt" -> ">"; "nc" -> ""

Examples

x <- data.frame(VariableCode = c("A", "B"),
                UnitsAbbreviation = c("mg/l", "ug/l"),
                CensorCode = c("lt", "nc"))

simplifyColumns(x)