```
dataa<-data.frame(
aa = c("q","r","y","v","g","y","d","s","n","k","y","d","s","t","n","u","l","h","x","c","q","r","y","v","g","y","d","s","n","k","y","d","s","t","n","u","l","h","x","c"),
col1=c(1,2,3,2,1,2,3,4,4,4,5,3,4,2,1,2,5,3,2,1,2,4,2,1,3,2,1,2,3,1,2,2,4,4,4,1,2,5,3,5),
col2=c(2,1,1,7,4,1,2,7,5,7,2,6,2,2,6,3,4,3,2,5,7,5,6,4,4,6,5,6,4,1,7,3,2,7,7,2,3,7,2,4),
col3= c(2150,3213,2580,4335,2228,3795,2319,2363,2252,3015,2978,2127,3938,3013,3063,4202,4340,4247,3755,4145,3300,3739,3294,2944,4152,2898,2500,3164,2384,2824,3431,2864,3752,2265,3332,3321,3418,3521,2689,2186)
)
```

while creating function , i am getting error (invalid argument type)

```
dataset = dataa
var = "col3"
Name_of_variable = "Average Deductions"
decimal = TRUE
Suff = "%"
numdig <- if (decimal == TRUE) {1} else {0}
var <- rlang::parse_expr(var)
summ_tab1<- dataset %>% filter(!is.na(!!var)) %>% summarise(
q25 = format(round(quantile(!! var, type=6, probs = seq(0, 1, 0.25), na.rm=TRUE)[2],digits = numdig),nsmall = 1),
Median = format(round(quantile(!! var, type=6, probs = seq(0, 1, 0.25), na.rm=TRUE)[3],digits = numdig),nsmall = 1),
Average = format(round( mean(!! var, na.rm=TRUE),digits = numdig),nsmall = 1),
q75 = format(round(quantile(!! var, type=6, probs = seq(0, 1, 0.25), na.rm=TRUE)[4],digits = numdig) ,nsmall = 1),
N = sum(!is.na(!!var)))
I am getting error Here
```

but my whole function is below

```
numdig <- if (decimal == TRUE) {1} else {0}
var <- rlang::parse_expr(var)
summ_tab1<- dataset %>% filter(!is.na(!!var)) %>% summarise(
q25 = format(round(quantile(!! var, type=6, probs = seq(0, 1, 0.25), na.rm=TRUE)[2],digits = numdig),nsmall = 1),
Median = format(round(quantile(!! var, type=6, probs = seq(0, 1, 0.25), na.rm=TRUE)[3],digits = numdig),nsmall = 1),
Average = format(round( mean(!! var, na.rm=TRUE),digits = numdig),nsmall = 1),
q75 = format(round(quantile(!! var, type=6, probs = seq(0, 1, 0.25), na.rm=TRUE)[4],digits = numdig) ,nsmall = 1),
N = sum(!is.na(!!var)))
if(missing(Suff)){
summ_tab<-summ_tab1 %>%
mutate("Level"=!!Name_of_variable,
q25 = mask_p(q25,N),
Median =mask_me(Median,N),
Average =mask_m(Average,N),
q75 = mask_p(q75,N))%>%
dplyr::rename(
`25th percentile` = q25,
`75th percentile` = q75)%>%
select(Level,N,everything())
summ_tab
}
else{
summ_tab<-summ_tab1 %>% mutate("Level"=!!Name_of_variable,
q25 = ifelse(mask_p(q25,N)=="--","--",paste0(mask_p(q25,N),Suff)),
Median =ifelse(mask_me(Median,N)=="--","--",paste0(mask_me(Median,N),Suff)),
Average = ifelse(mask_m(Average,N)=="--","--",paste0(mask_m(Average,N),Suff)),
q75 = ifelse(mask_p(q75,N)=="--","--",paste0(mask_p(q75,N),Suff)))%>%
dplyr::rename(
`25th percentile` = q25,
`75th percentile` = q75)%>% mutate_all(~sub('\\.0*$', '', .)) %>%
select(Level,N,everything())
summ_tab
```