change name of input in a function


I have made a function and I would like the input name to be changed in my output.
So, this is my function:

And when I run the code I get output looking like this:

However, I would like to add something to my function such that I can make the correct name of the predictor. I am going to make the function go into a for loop such that I can loop though different predictors, and thus I would like to keep track of the predictors in the output.

Thank you in advance!


As a note, it is extremely hard to help debug code and/or error messages when screenshots are posted. Posting screenshots, instead of actual code/error messages, is likely to decrease your chances of getting the help you are looking for in general. Instead of posting a screenshot, please copy and paste the code and error message and format the pasted code/error messages as shown below.

Put code that is inline (such as a function name, like mutate or filter ) inside of backticks ( mutate ) and chunks of code (including error messages and code copied from the console) can be put between sets of three backticks:

example <- foo %>%
  filter(a == 1)

This process can be done automatically by highlighting your code, either inline or in a chunk, and clicking the </> button on the toolbar of the reply window!

This will help keep our community tidy and help you get the help you are looking for!

For more information, please take a look at the community's FAQ on formating code

To further boost your likelihood of receiving support; its recommended to provide a reprex.

Thank you for the comment. I have changed this in a new post.

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.

If you have a query related to it or one of the replies, start a new topic and refer back with a link.