#' Function for creating new rows with potentially missing information
#'
#' This function allows you to merge subsets
#' @param dtfr Total dataframe
#' @param col_names Names of columns that should be extended
#' @keywords merging expansion
#' @export
#' @examples
#' insert_miss_rows()
insert_miss_rows <- function(dtfr, col_names){
# Create subset for identifying unique observations
dtfr_subset <- dtfr[, col_names]
# Create unique combinations
df <- unique_comb(dtfr_subset)
# Merge the total combination and original dataset to create new rows
df_new <- merge(df, dtfr, all.x = T, by = col_names)
# Return the updated data frame with formerly missing rows
return(df_new)
}
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.