Learn R Programming

DIZtools

The R package DIZtools provides utility functions used for the R package development infrastructure inside the data integration centers (‘DIZ’) to standardize and facilitate repetitive tasks such as setting up a database connection or issuing notification messages and to avoid redundancy.

:bulb: DIZtools contains all “lightweighted” functions of DIZutils making it a lot quicker to install, while DIZutils has a lot of dependencies and system requirements.

Installation

You can install DIZtools directly from CRAN:

install.packages("DIZtools")

The development version can be installed using

install.packages("remotes")
remotes::install_github("miracum/misc-diztools", ref = "dev")

Exported functions

  • assign_to_R_env(): Add variable to R environment (in contrast to system environment).
  • check_digit(): Calculate Check Digit Using DIN/ISO 7064, Mod 11,10
  • check_if_unique_rows(): Takes a data.table dataset and checks if for each unique element in a specified column there is exaclty one row.
  • clean_path_name(): Clean paths to surely have a tailing slash or not.
  • clear(): Clean the console and environment-variables.
  • close_all_connections(): Unset/close all open connections.
  • dt_row_to_string(): Get the content of a data.table row in print-ready format.
  • equals2(): Robust compare two elements and return true if both elements are the same. False otherwise. No NA or NULL.
  • feedback(): Function to feedback messages either to the user and/or to the console and to the logfile.
  • file_lines_to_list(): Read in lines from a file and store it in a list.
  • firstup(): Converts the first letter of the input string to uppercase.
  • format_POSIXct(): Formats a given POSIXct timestamp without the need of manually specifing format parameters.
  • get_config(): Reads a config yaml file and return the value for a given key.
  • get_current_timestamp(): Quickly get the current time stamp without the need to handle format-options etc.
  • get_package_names(): Get used package names from R/qmd-files.
  • is_date_format(): Checks if a string matches a given date format.
  • is.empty(): Check for empty/NA/NULL/NaN/etc. values.
  • notin(): notin helper function. Opposite of in function.
  • number_to_position(): Converts an integer number to its “verbal position”. 1 –> “1st”, 2 –> “2nd”, 3 –> “3rd”, 4 –> “4th”, …
  • paste_pct_sum(): Get the percentage of two values pretty formatted.
  • paste2(): Normal paste function with additional collapse_last argument.
  • pretty_timestamp(): Quickly get a pretty timestamp without need to handle format-options etc.
  • rep2(): Repeat something with the ability to also collapse the output.
  • robust_round(): Round numbers without problems.
  • setdiff_all(): Get the difference of two vectors in both directions.
  • setenv_file(): Set all variables of a .env file to the system environment.
  • setenv2(): Assign variables to the system environment.
  • string_replacements(): Clean string with a given set of replacements.
  • time_diff_print(): Calculate time difference of two timestamps, round the value and return a string with suiting unit.
  • trim.space(): Trim Spaces of a string.
  • vgsub(): Vectorised string replacement.

Internal functions

:bulb: Use with care. Can be used by typing DIZtools:::internal_function_name() (<- using three :). Not recommended.

More Infos

Copy Link

Version

Install

install.packages('DIZtools')

Monthly Downloads

629

Version

1.0.3

License

GPL-3

Issues

Pull Requests

Stars

Forks

Maintainer

Jonathan M. Mang

Last Published

September 23rd, 2025

Functions in DIZtools (1.0.3)

%notin%

notin helper function. Opposite of `in` function.
feedback_get_formatted_string

Format the feedback string
paste2

Normal `paste` function with additional `collapse_last` argument.
string_replacements

Clean string with a given set of replacements.
get_package_names

Get used package names from R/qmd-files.
paste_pct_sum

Get the percentage of two values pretty formatted.
get_config

Reads a config yaml file and return the value for a given key.
robust_round

Round numbers without problems.
test_check_digit

Validate an ID Using the Check Digit (DIN ISO 7064, Mod 11,10)
setdiff_all

Get the difference of two vectors in both directions.
get_current_timestamp

Quickly get the current time stamp without the need to handle format-options etc.
vgsub

Vectorised string replacement.
log_remove_options

Remove all log-related options from `options()`.
log_set_defaults

Set default options for all log-functions
is.empty

Check for empty/`NA`/`NULL`/`NaN`/etc. values.
number_to_position

Converts an integer number to its "verbal position". 1 --> "1st", 2 --> "2nd", 3 --> "3rd", 4 --> "4th", ...
log_internal_test

Internal function for debugging only.
log_get_default_options

Get the default settings for the logging function as list.
pretty_timestamp

Quickly get a pretty timestamp without need to handle format-options etc.
time_diff_print

Calculate time difference of two timestamps, round the value and return a string with suiting unit.
rep2

Repeat something with the ability to also collapse the output.
trim.space

Trim Spaces of a string.
log_get_current_options

Get the current settings for the logging function as list.
setenv2

Assign variables to the system environment.
is_date_format

Checks if a string matches a given date format.
setenv_file

Set all variables of a `.env` file to the system environment.
check_if_unique_rows

Takes a data.table dataset and checks if for each unique element in a specified column there is exaclty one row.
calculate_check_digit

Calculate Check Digit Using DIN/ISO 7064, Mod 11,10
clear

Clean the console and environment-variables.
cleanup_old_logfile

Archives the current logfile and creates a new blank one.
dot_helper

Dot Helper
clean_path_name

Clean paths to surely have a tailing slash or not.
assign_to_R_env

Add variable to R environment (in contrast to system environment).
dt_row_to_string

Get the content of a data.table row in print-ready format.
equals2

Robust compare two elements and return true if both elements are the same. False otherwise. No `NA` or `NULL`.
close_all_connections

Unset/close all open connections.
feedback_to_console

Print to the console. Internal use only.
feedback_to_logfile

Add to the logfile. Internal use.
format_posixct

Formats a given POSIXct timestamp without the need of manually specifing format parameters.
file_lines_to_list

Read in lines from a file and store it in a list.
feedback_to_logjs

Feedback to the gui/browser-console with logjs. Internal use.
firstup

Converts the first letter of the input string to uppercase.
feedback_to_ui

Feedback to the user with a modal. Internal use.
feedback

Function to feedback messages either to the user and/or to the console and to the logfile.
log_map_type_to_loggertype

Get the logger type from the type string (the argument of the `feedback()` function)