It's extremely difficult to see your code from a picture. Please share codes in a copy-paste friendly form, by copying the code and pasting within a pair of triple backticks like this:
```
<paste code here>
```
Regarding your question, since you have the form of the function you desire to create, the easiest option will be to write a custom function. This should be easy, you just need to copy paste a single block within function definition with changing dataframe_name[column_name]
or dataframe_name[column_position]
to a placeholder variable name which is the argument. Then just use it on different column using lapply
, or purrr:map
if you are a tidyverse person.
Give it a try and see if it works. If you are getting stuck somewhere, please share your attempt and the issue as a reprex.
Hope this helps.