How to write the item name in a function (instead of the item's numeric value) ?

You are welcome. For the second question, you need to provide a bit more information about your data. Even better, try to set up a reprex using one of the built-in data sets such as mtcars. See below for information about how to write a good reprex.