Modify function to change names of statistics in summary table

I want to modify my function to change the names of labels dynamically but on the other hand i want to display the column accordingly if want to hide one of them.

so there are two requirements.

  1. if i want to display 25th percentile as "25 perc" or "25th P" i can change if i want and by default it should be 25th percentile also for 75 perc or median , mean

  2. if i want to display only mean and median i can just have a parameter to display all or just c(median,mean) , c(25th Percentile,Mean)...etc and this check is working perfectly fine .

but i am unable to combine both checks in one function. please provide some solution of it

df <- data.frame(Name = c("asdf","kjhgf","cvbnm","rtyui","cvbnm","jhfd","cvbnm","sdfghj","cvbnm","dfghj","cvbnm"), 
                 sale=c(27,28,27,16,14,25,14,14,19,18,28), 
                 sale2=c(32,25,29,36,44,24,17,15,11,13,22), 
                 city=c("CA","TX","MN","NY","TX","MT","HU","KL","TX","SA","TX"), 
                 Dept = c("HH","MM","NN","MM","AA","VV","MM","HU","JJ","MM","ZZ")) 
 
#  options(percentile25 = "tt1"), 
#   options(percentile75 = "tt2"), 
#   options(Mean_n = "tt3"), 
#   options(Med_n = "tt4") 
 
 
fun1 <- function(data,var_list,var_name_list,stats="all", 
                         p25=getOption("percentile25" ,default = "25th percentile"), 
                         p75=getOption("percentile75" ,default = "75th percentile"), 
                         meann=getOption("Mean_n" ,default = "Mean"), 
                         med=getOption("Med_n" ,default ="Median"),....) { 
   
    table_list<-list() 
    for (i in 1:length(var_list)) { 
       
      table_list[[i]]<-fun2(data, var_list[i], var_name_list[i],stats,p25,p75,meann,med) 
       
      t1 <- do.call(rbind,table_list) 
       
    } 
    t1 
} 
 
fun2<-function(dataset, var, Name_of_variable,stats,p25,p75,meann,med) { 
  var = rlang::parse_expr(var) 
  if('all' %in% stats & length(stats) == 1){ stats <- c('25th percentile','Median','Mean','75th percentile') 
  }else{stats <- stats} 
  summ_tab1<- dataset %>% filter(!is.na(!!var)) %>% summarise( 
    q25 = round(quantile(!! var,  type=6, probs = seq(0, 1, 0.25), na.rm=TRUE)[2],digits = 1), 
    Median =round(quantile(!! var, type=6, probs = seq(0, 1, 0.25), na.rm=TRUE)[3],digits = 1), 
    Average = round( mean(!! var, na.rm=TRUE),digits = 1), 
    q75 = round(quantile(!! var, type=6, probs = seq(0, 1, 0.25), na.rm=TRUE)[4],digits = 1) , 
    N = sum(!is.na(!!var))) 
 
summ_tab_suff <- summ_tab1 %>% mutate(" "=!!Name_of_variable, 
                                      q25 = q25, 
                                      Median = Median, 
                                      Average = Average, 
                                      q75 = q75) 
summ_tab_suff <- summ_tab_suff %>%  dplyr::rename( 
      !!p25 := q25, 
      !!med := Median, 
      !!meann := Average , 
      !!p75 := q75) 
    summ_tab_suff <- summ_tab_suff %>%  select(" ",N,stats) 
   
} 
 
debugonce(fun1) 
fun1(data = df,var_list = c("sale","sale2"),var_name_list = c("listd","listd2"))