Description Usage Arguments Value Examples
View source: R/get_date_pathV3.R
This function is used to clean up bad date formats. Many times during the census I tried to automate the picking up and dating of files. There were problems in this that Nathanial or just general humans don't put 0's in front of their single dates. EX: 9102019 as opposed to 09102019. This caused a lot of date format problems when you try to grab everything at the same time. This functions solves it by inserting a 0 lets say at a certain index. So we can use this function with some other logic to clean up the character strings before converting to dates.
1 2 | get_date_pathV3(census_files, after_index, thing_insert,
convert_date = FALSE, date_format = "%m%d%Y")
|
census_files |
Path to the census file. |
after_index |
The index in the character string where you want to add a number. |
thing_insert |
The number you wish to insert into the string. |
convert_date |
Would you like the function to return a date or return a raw character string. Use FALSE for a string and TRUE for a date. |
date_format |
Define the Date format you would like to convert from. |
The census_files
string where the letter from thing_insert
is put after the after_index
.
This is then either converted to a date if convert_date
is TRUE and converts the string using the date_format
.
If convert_date
is FALSE it will just return the raw string instead of converting to a date type.
1 2 3 | get_date_pathV3(census_files = "CNMC ER 8052019",
after_index = 0,
thing_insert = 0, convert_date = TRUE, date_format = "%m%d%Y")
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.