Somewhat new to programming and I want to try to make a custom function made in R easier to use, and less redundant.
How do I go from a custom function looking like this when in use:
Function(data=df, x=df$x, y=df$y)
Into:
Function(data=df, x=x, y=y)
As my function definition looks something like this now:
Function <- function(data, x, y){ does whatever… }
Specifically, I don’t want to have to use the $ operator for every variable input. I just want to use the df I have as an argument for ‘data’. How would I set it up differently?
Thanks!

xandyare derived from the samedf, perhaps there is no need to supply all 3 arguments to the function? Just usefunction(data = df), then usedf$xanddf$yinside the function?df[[x]]anddf[[y]]. Or pass the symbols and use non-standard evaluation.