dl_dec_char_detect: Decimal character detection

Description Usage Arguments Details Value Algorithm See Also

View source: R/dl_data_loading_functions.R


Decimal character detection to csv files loading with data.table::fread


dl_dec_char_detect(file, n = 1000, parent_logger = "test")



Character vector indicating the name (and route) of the file in which the decimal character must be guessed.


Numeric indicating the sample size of rows to use in the decimal character guessing.


With data coming from any place in the world, data loading functions have to cope with different decimal characters, separator characters... fread can autodetect separator character at loading data, but decimal character must be specified in order to load correct data. This function aims to provide an easy way to autodetect decimal character to automatize data loading proccess.


A character vector containing the decimal character, to use in the fread order to load the data.


The process to determine the decimal character is as follows:

  1. 1000 rows and 4 variables are sampled from the data.

  2. For each variable, number of dots (.) and commas (,) are calculated.

  3. If the number of dots is larger than the commas, dot is selected as decimal character. If the number of commas is larger than the dots, comma is selected as decimal character.

See Also

Other Data Loading Functions: dl_data_col_classes, dl_data, dl_get_si_code, dl_metadata, dl_na_char_generator, qc_as_timestamp, remove_dupcols

sapfluxnet/sapfluxnetQC1 documentation built on April 11, 2018, 4:28 a.m.