I am trying to create a function which dynamically filter

```
Median =round(quantile(!!Text_var, type=6, probs = seq(0, 1, 0.25), na.rm=TRUE)[3],digits = 1),
```

But getting error Error in UseMethod("filter_") : no applicable method for 'filter_' applied to an object of class "c('double', 'numeric')"

after adding mutate

summ_tab1<- mutate(as.numeric(dat1[[Text_var]])) %>% filter(!is.na(!!Text_var)) %>% summarise( q25 = round(quantile(!!Text_var, type=6, probs = seq(0, 1, 0.25), na.rm=TRUE)[2],digits = 1), Median =round(quantile(!!Text_var, type=6, probs = seq(0, 1, 0.25), na.rm=TRUE)[3],digits = 1), Average = round( mean(!!Text_var, na.rm=TRUE),digits = 1), q75 = round(quantile(!!Text_var, type=6, probs = seq(0, 1, 0.25), na.rm=TRUE)[4],digits = 1) , N = sum(!is.na(!!Text_var)))

getting error
Error in UseMethod("mutate_") :
no applicable method for 'mutate_' applied to an object of class "c('double', 'numeric')"

Mutate is a function that takes a dataframe as the first argument, and following arguments should be equations where a value on the right is assigned to a variable name on the left of an equal sign.

then what will be the sollution

system
Closed
August 4, 2020, 4:30pm
5
This topic was automatically closed 21 days after the last reply. New replies are no longer allowed.