Title: | Modify Dates to ISO Standard ("International Organization for Standardization") |
---|---|
Description: | Transfer any date type to ISO standard. Package recognizes dates in given data frame and transform to ISO format. Only one date format can be applied within one data frame column. |
Authors: | Lukasz Andrzejewski [aut, cre] |
Maintainer: | Lukasz Andrzejewski <[email protected]> |
License: | MIT + file LICENSE |
Version: | 0.2.0 |
Built: | 2025-01-25 06:22:12 UTC |
Source: | CRAN |
Get TRUE if date format is dmy
choose_dmy_format(df_column)
choose_dmy_format(df_column)
df_column |
data frame date column or vector with dates |
logical vector, TRUE if most probable date format is DMY
Lukasz Andrzejewski
Get TRUE if date format is dym
choose_dym_format(df_column)
choose_dym_format(df_column)
df_column |
data frame date column or vector with dates |
logical vector, TRUE if most probable date format is DYM
Lukasz Andrzejewski
Get TRUE if date format is mdy
choose_mdy_format(df_column)
choose_mdy_format(df_column)
df_column |
data frame date column or vector with dates |
logical vector, TRUE if most probable date format is MDY
Lukasz Andrzejewski
Get TRUE if date format is myd
choose_myd_format(df_column)
choose_myd_format(df_column)
df_column |
data frame date column or vector with dates |
logical vector, TRUE if most probable date format is MYD
Lukasz Andrzejewski
Get TRUE if date format is ydm
choose_ydm_format(df_column)
choose_ydm_format(df_column)
df_column |
data frame date column or vector with dates |
logical vector, TRUE if most probable date format is YDM
Lukasz Andrzejewski
Get TRUE if date format is ymd
choose_ymd_format(df_column)
choose_ymd_format(df_column)
df_column |
data frame date column or vector with dates |
logical vector, TRUE if most probable date format is YMD
Lukasz Andrzejewski
Function recognize date variables and modify them to ISO standard ("International Organization for Standardization")
dfiso(df)
dfiso(df)
df |
data frame or variable/s, for example data.frame(date=c("12-Mar-2021","01-Jan-2023")) |
dates formatted to ISO standard (yyyy-mm-dd)
Lukasz Andrzejewski
# data frame with different formatted dates dfiso(data.frame(date1=c("13-02-2022","13/Feb/2022","13-Feb-2022")))
# data frame with different formatted dates dfiso(data.frame(date1=c("13-02-2022","13/Feb/2022","13-Feb-2022")))
Find DMY dates only
find_dmy_date_format(df_column)
find_dmy_date_format(df_column)
df_column |
data frame date column or vector with dates |
logical vector, TRUE if date format is DMY
Lukasz Andrzejewski
Find DYM dates only
find_dym_date_format(df_column)
find_dym_date_format(df_column)
df_column |
data frame date column or vector with dates |
logical vector, TRUE if date format is DYM
Lukasz Andrzejewski
Find MDY dates only
find_mdy_date_format(df_column)
find_mdy_date_format(df_column)
df_column |
data frame date column or vector with dates |
logical vector, TRUE if date format is MDY
Lukasz Andrzejewski
Find MYD dates only
find_myd_date_format(df_column)
find_myd_date_format(df_column)
df_column |
data frame date column or vector with dates |
logical vector, TRUE if date format is MYD
Lukasz Andrzejewski
Return TRUE if data frame column or vector contains date
find_only_dates(df_column)
find_only_dates(df_column)
df_column |
data frame date column or vector with dates |
logical vector, return TRUE if number of characters is higher than 5, contains digits and special characters or month names
Lukasz Andrzejewski
Find Unknown date, defined as UN or UNK
find_unknow_date(df_column)
find_unknow_date(df_column)
df_column |
data frame date column or vector with dates |
logical vector, TRUE if "un" character is found but not "jun"
Lukasz Andrzejewski
Find YDM dates only
find_ydm_date_format(df_column)
find_ydm_date_format(df_column)
df_column |
data frame date column or vector with dates |
logical vector, TRUE if date format is YDM
Lukasz Andrzejewski
Find YMD dates only
find_ymd_date_format(df_column)
find_ymd_date_format(df_column)
df_column |
data frame date column or vector with dates |
logical vector, TRUE if date format is YMD
Lukasz Andrzejewski
Replace full month name by abbreviated month name
get_abbreviated_month_name(df_column)
get_abbreviated_month_name(df_column)
df_column |
data frame date column or vector with dates |
vector, if any full length month name, then replace by abbreviated month name
Lukasz Andrzejewski
Get vector with full name of months separated by vertical bar
get_full_name_months_sep_by_vertical_bar()
get_full_name_months_sep_by_vertical_bar()
full names and abbreviations of months separated by vertical bar
Lukasz Andrzejewski
Score each of date format ymd, ydm, dmy, dym, mdy, myd and return only the highest score
get_max_score_within_data_formats(df_column)
get_max_score_within_data_formats(df_column)
df_column |
data frame date column or vector with dates |
return score of most probable date format
Lukasz Andrzejewski
List month names: full names and abbreviated names in lower case
get_months()
get_months()
full names and abbreviations of months
Lukasz Andrzejewski
List month names: full names in lower case
get_months_full_names()
get_months_full_names()
full names of months
Lukasz Andrzejewski
Get vector with full and abbreviated name of months separated by vertical bar
get_months_sep_by_vertical_bar()
get_months_sep_by_vertical_bar()
full names and abbreviations of months separated by vertical bar
Lukasz Andrzejewski
Function to find number of symbols in date
get_number_of_symbols_in_string(df_column, symbol = "T")
get_number_of_symbols_in_string(df_column, symbol = "T")
df_column |
data frame date column or vector with dates |
symbol |
symbol that needs to be found, by default "T" |
number of found symbols
Lukasz Andrzejewski
function return observations with up to 12 characters
get_up_to_12_char(df_column)
get_up_to_12_char(df_column)
df_column |
data frame column or vector to extract observarions up to 12 characters |
return up to 12 characters
Lukasz Andrzejewski
Function return special characters and months separated by vertical bars
has_dash_or_slash_or_white_space_characters_or_months_separated_by_vertical_bar( )
has_dash_or_slash_or_white_space_characters_or_months_separated_by_vertical_bar( )
special characters and months: "-|\/|\w+\s+|january|february|march|april|may|june|july|august|september|october|november|december|jan|feb|mar|apr|may|jun|jul|aug|sep|oct|nov|dec"
Lukasz Andrzejewski
Function return special characters separated by vertical bars
has_dash_or_slash_or_white_space_characters_separated_by_vertical_bar( special_characters = c("-", "\\/", "\\w+\\s+") )
has_dash_or_slash_or_white_space_characters_separated_by_vertical_bar( special_characters = c("-", "\\/", "\\w+\\s+") )
special_characters |
by default dash, slash, white space characters |
special characters: "-|\/|\w+\s+"
Lukasz Andrzejewski
Additional step for YMD date type
prepare_date(df_column)
prepare_date(df_column)
df_column |
data frame date column or vector with dates |
output up to 12 characters, remove whitespace from start and end of string, keep characters from the left site of letter "T"
Lukasz Andrzejewski
Function remove symbols
remove_no_date_characters(df_column, symbols = "[;:+]")
remove_no_date_characters(df_column, symbols = "[;:+]")
df_column |
data frame column or vector from which symbols need to be removed |
symbols |
by default ; : + |
by default delete semicolon, colon and plus sign from vector or data frame
Lukasz Andrzejewski
Get substring of date to eliminate unnecessary part
remove_unnecessary_part_of_date(df_column, symbol = "T")
remove_unnecessary_part_of_date(df_column, symbol = "T")
df_column |
date column or vector with dates |
symbol |
symbol that needs to be found, by default "T" |
substring of date from position 1 to position where last "symbol" is located
Lukasz Andrzejewski
transform date vector to date vector in ISO standard ("International Organization for Standardization")
viso(df_column)
viso(df_column)
df_column |
vector or string |
dates formatted to ISO standard (yyyy-mm-dd)
Lukasz Andrzejewski
#day month year vector viso(c("12Mar2022","21Feb2022")) #day month year vector in different formats viso(c("12Mar2022","21-02-2022")) #month year day vector viso(c("Mar-2022-12","Feb-2022-21"))
#day month year vector viso(c("12Mar2022","21Feb2022")) #day month year vector in different formats viso(c("12Mar2022","21-02-2022")) #month year day vector viso(c("Mar-2022-12","Feb-2022-21"))