#' subcol_f
#'
#' Subset useful columns from raw df
#' Imports: NA
#' Return df
#' @param raw_df
#' @param subcol_df
#' @param importance
#' @keywords subset useful columns
#' @export
#' @examples
#' subcol_f(raw_df, subcol_df, importance = 1)
subcol_f <- function(raw_df, subcol_df, importance = 1){
if(is.null(raw_df)){
return(NULL)
}
#better to attach subcol_df to the library/package itself
u1 <- subcol_df[,"importance"] >= importance
selected_columns <- subcol_df[u1,"colname"]
all_columns <- colnames(raw_df)
u2 <- all_columns %in% selected_columns
selected_columns_2 <- all_columns[u2]
sub_df <- raw_df[, selected_columns_2]
return(sub_df)
}
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.