| Title: | R Package for Documenting Workflow Used in Project "geosalz" |
|---|---|
| Description: | R Package for Documenting Workflow Used in Project "geosalz". |
| Authors: | Michael Rustler [aut, cre] (ORCID: <https://orcid.org/0000-0003-0647-7726>), Hauke Sonnenberg [ctb] (ORCID: <https://orcid.org/0000-0001-9134-2871>), Christoph Sprenger [ctb] (ORCID: <https://orcid.org/0000-0002-0178-6645>), GeoSalz [fnd], Kompetenzzentrum Wasser Berlin gGmbH (KWB) [cph] |
| Maintainer: | Michael Rustler <[email protected]> |
| License: | MIT + file LICENSE |
| Version: | 0.7.2 |
| Built: | 2026-05-03 16:00:49 UTC |
| Source: | https://github.com/KWB-R/kwb.geosalz |
add_para_metadata
add_para_metadata(df, lookup_para_path, parameters_path)add_para_metadata(df, lookup_para_path, parameters_path)
df |
df |
lookup_para_path |
lookup_para_path |
parameters_path |
parameters_path |
return "df" with added parameter metadata
add_site_metadata
add_site_metadata(df, site_path)add_site_metadata(df, site_path)
df |
df |
site_path |
site_path |
data frame with added site metadata
Check if all strings are not empty
all_defined(x)all_defined(x)
x |
vector of character |
TRUE or FALSE
Helper function: cat_green_bold_0
cat_green_bold_0(...)cat_green_bold_0(...)
... |
text passed to crayon::green() |
formatted text output
Helper function: cat_red_bold_0
cat_red_bold_0(...)cat_red_bold_0(...)
... |
text passed to crayon::red |
formatted text output
Helper function: column_pattern_gather_ignore
column_pattern_gather_ignore( fields = c("Datum", "KN", "[iI]nterne Nr.", "Name der", "Ort", "Probe", "Prü", "Untersuchung", "Labor", "Jahr", "Galer", "Detail", "Meß", "Zeit", "Bezei", "Monat") )column_pattern_gather_ignore( fields = c("Datum", "KN", "[iI]nterne Nr.", "Name der", "Ort", "Probe", "Prü", "Untersuchung", "Labor", "Jahr", "Galer", "Detail", "Meß", "Zeit", "Bezei", "Monat") )
fields |
column names to be ignored for gathering (default: c( "Datum", "KN", "[iI]nterne Nr.", "Name der", "Ort", "Probe", "Pr\u00FC", "Untersuchung", "Labor", "Jahr", "Galer", "Detail", "Me\u00DF", "Zeit", "Bezei", "Monat") |
vector with ignored columns for gathering
Helper function: column_pattern_gather_ignore_clean
column_pattern_gather_ignore_clean( fields = c("LabSampleCode", "Date", "Time", "Waterbody", "ExSiteCode", "Site") )column_pattern_gather_ignore_clean( fields = c("LabSampleCode", "Date", "Time", "Waterbody", "ExSiteCode", "Site") )
fields |
column names to be ignored for gathering (default: c("LabSampleCode", "Date", "Time", "Waterbody", "ExSiteCode", Site") |
vector with ignored columns for gathering
Convert PhreeqC input to "wide" format
convert_phreeqc_input_to_wide(phreeqc_input)convert_phreeqc_input_to_wide(phreeqc_input)
phreeqc_input |
PhreeqC input as retrieved by |
PhreeqC input in "wide" format
Convert to SF
convert_to_sf( df, crs_source = 25833, crs_target = 4326, col_coord_x = "Rechtswert_UTM_33_N", col_cood_y = "Hochwert_UTM_33_N" )convert_to_sf( df, crs_source = 25833, crs_target = 4326, col_coord_x = "Rechtswert_UTM_33_N", col_cood_y = "Hochwert_UTM_33_N" )
df |
data frame or tibble with spatial data |
crs_source |
origingal CRS (default: 25833) |
crs_target |
target CRS (default: 4326) |
col_coord_x |
column name of latitude (default: "Rechtswert_UTM_33_N") |
col_cood_y |
column name of longitude (default: "Hochwert_UTM_33_N") |
data frame or tibble converted to sf
gwl_master <- jsonlite::fromJSON("https://kwb-r.github.io/wasserportal/stations_gwl_master.json") convert_to_sf(gwl_master)gwl_master <- jsonlite::fromJSON("https://kwb-r.github.io/wasserportal/stations_gwl_master.json") convert_to_sf(gwl_master)
Convert xls to xlsx
convert_xls_as_xlsx( input_dir, export_dir = tempdir(), office_folder = safe_office_folder(), dbg = TRUE )convert_xls_as_xlsx( input_dir, export_dir = tempdir(), office_folder = safe_office_folder(), dbg = TRUE )
input_dir |
input directory containing .xls files |
export_dir |
export directory (default: tempdir()) |
office_folder |
office folder path (default: |
dbg |
debug (default: TRUE) |
Helper function: convert_xls_to_xlsx
convert_xls_to_xlsx(exe, xls, xlsx, i, n_files, dbg = TRUE)convert_xls_to_xlsx(exe, xls, xlsx, i, n_files, dbg = TRUE)
exe |
exe |
xls |
xls |
xlsx |
xlsx |
i |
i |
n_files |
n_files |
dbg |
debug (default: TRUE) |
Helper function: copy_lookup_para_file
copy_lookup_para_file( from_dir, to_dir, overwrite = FALSE, recursive = TRUE, file_pattern = "^lookup_para\\.csv$" )copy_lookup_para_file( from_dir, to_dir, overwrite = FALSE, recursive = TRUE, file_pattern = "^lookup_para\\.csv$" )
from_dir |
input directory with xlsx files |
to_dir |
target directory where to copy the xlsx files |
overwrite |
should existing files be overwritten (TRUE) otherwise (FALSE) ? (default: FALSE) |
recursive |
if TRUE recursively find all xlsx files in the directory specified in parameter "from_dir" (default: TRUE) |
file_pattern |
pattern for identifying lookup_para file (default: "^lookup_para\.csv$") |
Helper function: copy_xlsx_files
copy_xlsx_files( from_dir, to_dir, overwrite = FALSE, recursive = TRUE, file_pattern = "[xX][lL][sS][xX]" )copy_xlsx_files( from_dir, to_dir, overwrite = FALSE, recursive = TRUE, file_pattern = "[xX][lL][sS][xX]" )
from_dir |
input directory with xlsx files |
to_dir |
target directory where to copy the xlsx files |
overwrite |
should existing files be overwritten (TRUE) otherwise (FALSE) ? (default: FALSE) |
recursive |
if TRUE recursively find all xlsx files in the directory specified in parameter "from_dir" (default: TRUE) |
file_pattern |
pattern for identifying xlsx fles (default: "[xX][lL][sS][xX]") |
Create EMSHOFF91 Import Data Frame
create_emshoff91_import( ods_dir, files_to_ignore = c("cl25", "clliste", "rupelauf", "salzlast") )create_emshoff91_import( ods_dir, files_to_ignore = c("cl25", "clliste", "rupelauf", "salzlast") )
ods_dir |
directory to ".ods" files created manually by importing original ".wq1" files into LibreOffice 7.0 on Ubuntu with encoding (Western Europe (DOS/OS2-437/US)) and exporting to ".ods" format |
files_to_ignore |
tidied names of files to ignore due to complex data input structure not yet covered by importer (default: c("cl25", "clliste", "gwnguete", "rupelauf", "salzlast")) |
data frame with columns "ods_paths" (full paths to ".ods" files), "ods_files" (their "basenames") and "ods_names_clean" (tidied names used as identifier)
## Not run: ods_dir <- "<replace-with-path-to-files>/emshoff91/converted_ods" emshoff91_import <- create_emshoff91_import(ods_dir) ## End(Not run)## Not run: ods_dir <- "<replace-with-path-to-files>/emshoff91/converted_ods" emshoff91_import <- create_emshoff91_import(ods_dir) ## End(Not run)
Measurement Chains: Create SFTP credentials (curl backend)
create_sftp_connection()create_sftp_connection()
list with server/username/password/port
Helper function: delete_registry
delete_registry(office_folder = safe_office_folder(), dbg = TRUE)delete_registry(office_folder = safe_office_folder(), dbg = TRUE)
office_folder |
office folder path (default: |
dbg |
debug (default: TRUE) |
Measurement Chains: download data (SFTP via curl)
download_measurementchains_data( sftp_paths, target_directory = temp_dir(), run_parallel = TRUE, debug = FALSE )download_measurementchains_data( sftp_paths, target_directory = temp_dir(), run_parallel = TRUE, debug = FALSE )
sftp_paths |
character vector with relative paths to files (under MESSKETTEN_REMOTE_DIR) |
target_directory |
target directory |
run_parallel |
default: TRUE (will create separate curl handles; ok) |
debug |
show debug messages (default: FALSE) |
character vector of local file paths
Emshoff 91: list to data frame
emshoff91_list_to_df(emshoff91_list)emshoff91_list_to_df(emshoff91_list)
emshoff91_list |
list as retrieved by |
tibble
Emshoff 91: remap values from imported tibble
emshoff91_remap_values( emshoff91_df, remap_list = list(fi_mi = "fi_mi_m_nn", ku_sto = "kupp_st", lf = "el_lf", progr = "beprob_progr", strat = "stratigr", uv254 = "uv_ext"), delete_cols = TRUE )emshoff91_remap_values( emshoff91_df, remap_list = list(fi_mi = "fi_mi_m_nn", ku_sto = "kupp_st", lf = "el_lf", progr = "beprob_progr", strat = "stratigr", uv254 = "uv_ext"), delete_cols = TRUE )
emshoff91_df |
tibble as retrieved by |
remap_list |
list with values to be remapped. Names of the list are columns values contained in list values should be mapped to (default: list(fi_mi = "fi_mi_m_nn", ku_sto = "kupp_st", lf = "el_lf", progr = "beprob_progr", strat = "stratigr", uv254 = "uv_ext")) |
delete_cols |
should unneeded columns be deleted, i.e. the ones where data where mapped from (default: TRUE) |
data frame with remapped values and deleted columns were this values were copied from (default: TRUE)
Helper function: gather_and_join_1
gather_and_join_1(tmp_data, columns_keep, metadata, dbg = FALSE)gather_and_join_1(tmp_data, columns_keep, metadata, dbg = FALSE)
tmp_data |
tmp_data |
columns_keep |
columns_keep |
metadata |
metadata |
dbg |
dbg (default: FALSE) |
gathered and joined data frame
Helper function: gather_and_join_2
gather_and_join_2(tmp_content, columns_keep, header)gather_and_join_2(tmp_content, columns_keep, header)
tmp_content |
tmp_content |
columns_keep |
columns_keep |
header |
header |
gathered and joined data frame
Helper function: get_excelcnv_exe
get_excelcnv_exe(office_folder = safe_office_folder())get_excelcnv_exe(office_folder = safe_office_folder())
office_folder |
office folder path (default: |
path containing 'excelcnv.exe'
get_foerdermengen
get_foerdermengen( xlsx_path, sheet_name = "WW Q Rhow ", sheet_range = "A4:S127" )get_foerdermengen( xlsx_path, sheet_name = "WW Q Rhow ", sheet_range = "A4:S127" )
xlsx_path |
path to xlsx file with pumping rates |
sheet_name |
sheet_name (default: "WW Q Rhow ") |
sheet_range |
sheet_range (default: "A4:S127") |
data frame with annual pumping rates per waterworks
Get Abtraction of Friedrichshagen Well Galleries
get_foerdermengen_gal_fri(path)get_foerdermengen_gal_fri(path)
path |
path to "2018-04-27 Rohwasser Bericht - Galeriefördermengen.xlsx" |
tidy data frame with abstraction rates for waterworks Friedrichshagen
Get Measurement Chain Data on KWB Cloud
get_measurement_chain_data_on_cloud(dbg = TRUE)get_measurement_chain_data_on_cloud(dbg = TRUE)
dbg |
logical indicating whether or not to show debug messages |
data frame with the content of "mc_data.zip" in the GeoSalz project
folder on the Nextcloud server. The SFTP paths to the files from which the
data in "mc_data.zip" originate are returned in attribute "sftp_paths".
If either of the files "mc_data.zip" or "mc_files.csv" does not exist,
NULL is returned.
Lists all available measurement chain files on the SFTP server and extracts metadata encoded in the file names. The function recursively scans the remote directory, identifies files belonging to measurement chains and returns a tidy table with parsed metadata.
get_measurementchains_files( sftp_connection = create_sftp_connection(), debug = FALSE )get_measurementchains_files( sftp_connection = create_sftp_connection(), debug = FALSE )
sftp_connection |
connection credentials as returned by
|
debug |
logical. If |
Files that do not match the expected measurement chain naming pattern are automatically ignored and reported in an attribute of the returned object.
Expected filename pattern (without extension):
LF_<sensor_id><sensor_endnummer>-YYYY-MM-DD-HHMM
or
<sensor_id><sensor_endnummer>-YYYY-MM-DD-HHMM
The function performs the following steps:
Recursively lists all files in the configured SFTP directory
Splits paths into folder and filename components
Validates filenames against the measurement chain naming scheme
Parses sensor metadata and timestamps from filenames
Returns a tidy table with extracted metadata
This approach makes the import robust against unrelated files (e.g.
Thumbs.db, desktop.ini, or documentation files) that may be
present on the server.
A tibble with metadata for all detected measurement chain files. The table includes:
sftp_path – full path of the file on the SFTP server
galerie – gallery identifier derived from folder name
brunnen_nummer – well number derived from folder name
prefix – optional file prefix (e.g. LF_)
sensor_id – numeric sensor identifier
sensor_endnummer – sensor end number
datum_uhrzeit – timestamp parsed from the filename
Additionally the returned object contains an attribute:
ignored_files – tibble listing files that were skipped because
their names do not match the expected measurement chain pattern.
## Not run: # connect and list files mc_files <- kwb.geosalz::get_measurementchains_files() # inspect parsed metadata str(mc_files) # inspect ignored files attr(mc_files, "ignored_files") ## End(Not run)## Not run: # connect and list files mc_files <- kwb.geosalz::get_measurementchains_files() # inspect parsed metadata str(mc_files) # inspect ignored files attr(mc_files, "ignored_files") ## End(Not run)
Measurement Chains: Get Metadata
get_measurementchains_metadata(file = extdata_file("metadata_messketten.csv"))get_measurementchains_metadata(file = extdata_file("metadata_messketten.csv"))
file |
path to measurement chains metadata file. Default: kwb.geosalz:::extdata_file("metadata_messketten.csv") |
tibble with measurement chains metadata
mc_metadata <- kwb.geosalz::get_measurementchains_metadata() str(mc_metadata) mc_metadatamc_metadata <- kwb.geosalz::get_measurementchains_metadata() str(mc_metadata) mc_metadata
Measurement Chains: get statistics for data
get_measurmentchains_data_stats(mc_data)get_measurmentchains_data_stats(mc_data)
mc_data |
tibble with measurement chains data as retrieved by
|
tibble with colunns datetime min/max, q10 (10 median, q90 (90
Helper function: get_meta_sheet_or_stop
get_meta_sheet_or_stop(sheets, pattern, file)get_meta_sheet_or_stop(sheets, pattern, file)
sheets |
sheets |
pattern |
pattern |
file |
file |
meta sheet name
Get Information on Pandoc
get_pandoc_info()get_pandoc_info()
data frame with columns pandoc_directory,
pandoc_version if Pandoc is installed, otherwise a message is
printed that pandoc is not installed.
get_parameters_meta
get_parameters_meta(xlsx_path, sheet_name = "nur Parameterliste")get_parameters_meta(xlsx_path, sheet_name = "nur Parameterliste")
xlsx_path |
path to EXCEL spreadsheet with parameter metadata |
sheet_name |
name of sheet containing metadata table (default: "nur Parameterliste") |
imported parameter metadata with cleaned columns names
Get PhreeqC data
get_phreeqc_data(lab_bwb)get_phreeqc_data(lab_bwb)
lab_bwb |
imported BWB lab data as retrieved by |
tibble with columns solution, par_name_phreeqc (which are not empty or NA) and numeric_value
Helper function: get_site_id
get_site_id(string, pattern = "^[0-9]{1,4}")get_site_id(string, pattern = "^[0-9]{1,4}")
string |
vector with character strings |
pattern |
pattern used for identifying site_id (default: "^[0-9]1,4") |
extracted site_id's from input string
import_labor
import_labor(files, export_dir, func = read_bwb_header2)import_labor(files, export_dir, func = read_bwb_header2)
files |
vector with full paths of xlsx input files |
export_dir |
export directory |
func |
function to be used (default: |
list with length equal to number of input files
Order Measurement Chain Data
order_measurement_chain_data(data)order_measurement_chain_data(data)
data |
data frame as retrieved by
|
data, ordered by "parameter", "sensor_id", "datum_uhrzeit"
Plot measurementchain and well operation in combined plot
plot_measurementchain_and_well_operation( mc_dat, well_op_data_meta, brunnen_nr = 9, para = "Leitfaehigkeit", y_label = "elektr. Leitfähigkeit (µS/cm)", date_min = as.Date("2023-05-10"), date_max = Sys.Date() )plot_measurementchain_and_well_operation( mc_dat, well_op_data_meta, brunnen_nr = 9, para = "Leitfaehigkeit", y_label = "elektr. Leitfähigkeit (µS/cm)", date_min = as.Date("2023-05-10"), date_max = Sys.Date() )
mc_dat |
mc_dat |
well_op_data_meta |
well_op_data_meta |
brunnen_nr |
well id (default: 9) |
para |
parameter (either: "Leitfaehigkeit" or "Temperatur") |
y_label |
y label (default: "elektr. Leitfaehigkeit (µS/cm)") |
date_min |
minimum date for plotting (default: as.Date("2023-05-10")) |
date_max |
maximum date for plotting (default: Sys.Date()) |
combined plot
Measurement Chains: plott
plot_measurementchains(mc_data, para = "Leitfaehigkeit")plot_measurementchains(mc_data, para = "Leitfaehigkeit")
mc_data |
as retrieved by |
para |
parameter to plot "Leitfaehigkeit" or "Temperatur" (default: Leitfaehigkeit") |
plot of selected measurement chain parameter
Prepare PhreeqC input
prepare_phreeqc_input(lab_bwb_phreeqc, title = "")prepare_phreeqc_input(lab_bwb_phreeqc, title = "")
lab_bwb_phreeqc |
selected BWB lab data as retrieved by |
title |
user defined title (default: "") |
data frame with input structure for kwb.phreeqc
Helper function: print_datatype_info_if
print_datatype_info_if(dbg, tbl_datatypes, columns_keep)print_datatype_info_if(dbg, tbl_datatypes, columns_keep)
dbg |
dbg |
tbl_datatypes |
tbl_datatypes |
columns_keep |
columns_keep |
wrapper around read_bwb_header2 and
read_bwb_header1_meta
read_bwb_data( files, meta_pattern = "META", keep_pattern = column_pattern_gather_ignore(), site_id_pattern = "^[0-9]{1,4}", dbg = TRUE )read_bwb_data( files, meta_pattern = "META", keep_pattern = column_pattern_gather_ignore(), site_id_pattern = "^[0-9]{1,4}", dbg = TRUE )
files |
file path(s) to EXCEL spreadsheet |
meta_pattern |
(default: "META") |
keep_pattern |
(default: |
site_id_pattern |
(default: "^[0-9]1,4") |
dbg |
debug (default: TRUE) |
data.table with imported xls(x) files
Import: read_bwb_header1_meta
read_bwb_header1_meta( file, meta_pattern = "META", keep_pattern = column_pattern_gather_ignore(), dbg = FALSE )read_bwb_header1_meta( file, meta_pattern = "META", keep_pattern = column_pattern_gather_ignore(), dbg = FALSE )
file |
path(s) to EXCEL spreadsheet |
meta_pattern |
meta_pattern default("META") |
keep_pattern |
keep_pattern (default: |
dbg |
debug (default: FALSE) |
data.table with imported xls(x) files
Import: read_bwb_header2
read_bwb_header2( file, skip = 2, keep_pattern = column_pattern_gather_ignore(), site_id_pattern = "^[0-9]{1,4}", dbg = TRUE )read_bwb_header2( file, skip = 2, keep_pattern = column_pattern_gather_ignore(), site_id_pattern = "^[0-9]{1,4}", dbg = TRUE )
file |
file path(s) to EXCEL spreadsheet |
skip |
number of rows to skip in each sheet (default: 2) |
keep_pattern |
(default: column_pattern_gather_ignore()) |
site_id_pattern |
(default: "^[0-9]1,4") |
dbg |
debug (default: TRUE) |
data.table with imported xls(x) files
Import: read_bwb_header4
read_bwb_header4( file, skip = 4, keep_pattern = column_pattern_gather_ignore(), site_id_pattern = "^[0-9]{1,4}", dbg = TRUE )read_bwb_header4( file, skip = 4, keep_pattern = column_pattern_gather_ignore(), site_id_pattern = "^[0-9]{1,4}", dbg = TRUE )
file |
file path(s) to EXCEL spreadsheet |
skip |
number of rows to skip in each sheet (default: 4) |
keep_pattern |
(default: column_pattern_gather_ignore()) |
site_id_pattern |
(default: "^[0-9]1,4") |
dbg |
debug (default: TRUE) |
data.table with imported xls(x) files
Reads a Single EMSHOFF 91 ODS File into Tibble
read_emshoff91_ods(emshoff91_import_selected)read_emshoff91_ods(emshoff91_import_selected)
emshoff91_import_selected |
a row as retrieved by |
imports ods file into tibble
Read Isotopes
read_isotopes(path)read_isotopes(path)
path |
path to Isotopes delim (field separator ";") |
imported isotopes data
Read Lab BWB
read_lab_bwb(path, sheet = "Analysen")read_lab_bwb(path, sheet = "Analysen")
path |
path to file with lab BWB data |
sheet |
name of sheet containing analysis data. Default: "Analysen" |
cleaned data frame with master data and lab values for all samples but only for selected parameters (columns A-BA and HB-HC)
Read Master Data
read_master_data(path)read_master_data(path)
path |
path to file with master data (currently in file: lab BWB data) |
imported master data contained in sheet "Stammdaten"
Measurement Chains: read csv data from multiple files
read_measurementchains_data( csv_files, datetime_installation = as_gmt_plus_one("2022-09-27 11:00:00"), run_parallel = TRUE, debug = FALSE )read_measurementchains_data( csv_files, datetime_installation = as_gmt_plus_one("2022-09-27 11:00:00"), run_parallel = TRUE, debug = FALSE )
csv_files |
vector of paths as retrieved by
|
datetime_installation |
datetime of first logger installation in well K10. Used to filter out older measurement data! Default: kwb.geosalz:::as_gmt_plus_one("2022-09-27 11:00:00") |
run_parallel |
default: TRUE |
debug |
show debug messages (default: FALSE) |
data frame with imported data from csv files
## Not run: mc_files <- kwb.geosalz::get_measurementchains_files() target_directory <- tempdir() csv_files <- kwb.geosalz::download_measurementchains_data( sftp_paths = mc_files$sftp_path, target_directory ) mc_data <- kwb.geosalz::read_measurementchains_data(csv_files) ## End(Not run)## Not run: mc_files <- kwb.geosalz::get_measurementchains_files() target_directory <- tempdir() csv_files <- kwb.geosalz::download_measurementchains_data( sftp_paths = mc_files$sftp_path, target_directory ) mc_data <- kwb.geosalz::read_measurementchains_data(csv_files) ## End(Not run)
Reads Multiple EMSHOFF 91 ODS Files into List
read_multiple_emshoff91_ods(emshoff91_import)read_multiple_emshoff91_ods(emshoff91_import)
emshoff91_import |
a tibble as retrieved by |
imports mulitple ods files into a list of tibbles
## Not run: ods_dir <- "<replace-with-path-to-files>/emshoff91/emshoff91/converted_ods" ods_dir <- "C:/users/mrustl/Downloads/emshoff91/emshoff91/converted_ods" emshoff91_import <- create_emshoff91_import(ods_dir) read_multiple_emshoff91_ods(emshoff91_import) ## End(Not run)## Not run: ods_dir <- "<replace-with-path-to-files>/emshoff91/emshoff91/converted_ods" ods_dir <- "C:/users/mrustl/Downloads/emshoff91/emshoff91/converted_ods" emshoff91_import <- create_emshoff91_import(ods_dir) read_multiple_emshoff91_ods(emshoff91_import) ## End(Not run)
Replace n.a. (not available) and n.b. (not determined) from lab data with NA
replace_nanb_with_na(string)replace_nanb_with_na(string)
string |
string |
string with NA instead of "n.a." or "n.b." (including 0-10 spaces between "n" and "a"/"b"
string <- c("19.2", "n.b.", "n. b.", "n. b.", "n.a.", "n. a.", "n. a.") replace_nanb_with_na(string)string <- c("19.2", "n.b.", "n. b.", "n. b.", "n.a.", "n. a.", "n. a.") replace_nanb_with_na(string)
Helper function: safe_office_folder
safe_office_folder(office_path = "C:/Program Files (x86)/Microsoft Office")safe_office_folder(office_path = "C:/Program Files (x86)/Microsoft Office")
office_path |
office folder path (default: "C:/Program Files (x86)/Microsoft Office") |
path of office folder (if existing)
Helper function: stop if duplicated sample ids are found
stop_if_duplicated_samples_found(df, col_sampleid, path, sheet = "")stop_if_duplicated_samples_found(df, col_sampleid, path, sheet = "")
df |
data frame with samples in wide format |
col_sampleid |
column name of sample id |
path |
path to file from which |
sheet |
optional in case EXCEL is used (default: "") |
error in case duplicated samples were found
Helper function: stop_on_missing_or_inform_on_extra_sheets
stop_on_missing_or_inform_on_extra_sheets(has_site_id, file, sheets)stop_on_missing_or_inform_on_extra_sheets(has_site_id, file, sheets)
has_site_id |
has_site_id |
file |
file |
sheets |
sheets |
Helper function: to_full_metadata2
to_full_metadata_2(header, file, sheet)to_full_metadata_2(header, file, sheet)
header |
header |
file |
file |
sheet |
sheet |
data frame with metadata for header2 (EXCEL) files
Helper function: to_full_metadata_4
to_full_metadata_4(header, file, sheet)to_full_metadata_4(header, file, sheet)
header |
header |
file |
file |
sheet |
sheet |
data frame with metadata for header4 (EXCEL) files
Measurement Chains: write csv data
write_measurementchains_data( mc_data, target_directory, to_zip = FALSE, debug = FALSE )write_measurementchains_data( mc_data, target_directory, to_zip = FALSE, debug = FALSE )
mc_data |
measurement chains data as retrieved by
|
target_directory |
target directory |
to_zip |
should data be zipped? (default: FALSE), if TRUE only a temporary csv file is created which will be subsequently zipped and deleted |
debug |
print debug messages (default: FALSE) |
writes csv data to path