#' @title Complete computation of loading template
#'
#' @description This function will perform the complete analysis of the loading template table in order to generate a .R file.
#'
#' @author Briac LE RAY (briac.leray@partnre.com)
#'
#' @return Does not return anything.
#' @param input_sources_table The table with the databases sources. Type = dataframe
#' @param input_load_table The table with the loading template format. Type = dataframe
#' @param input_merge_table The table with the merging template format. Type = dataframe
#' @param file_path The file to the path to write the code in. Type = character
#' @examples generate_r_code_load(input_sources_table = my_template_filled, input_table = my_template_filled, input_merge_table = my_template_filled, file_path = "path/to/the/file/file_name.extension")
generate_r_code_load <- function(input_sources_table, input_load_table, input_merge_table, file_path) {
# Step 0 : prepare the logs
# Step 1 : extract the list of the tables that will be loaded and their sources.
go_through_loading(sources_table = input_sources_table, file_path = file_path)
# Step 2 : extract the list of the attributes that will be kept.
list_attributes = select_columns(template_load_data = input_load_table, template_merge = input_merge_table)
for (i in 1:nrow(list_attributes)) {
row = list_attributes[i,]
add_to_file(text = paste(row$table_source, " = ", row$table_source, " %>% distinct(", row$attributes, ")", collapse = "", sep = ""), file_path = file_path, append = TRUE)
}
}
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.