I am attempting to create a function, which would make me easily plot data by a given year from dataframe with data for many years. I have succeeded in doing this. However, I also want the given year to be shown in the title, but can't figure out how to put an argument into the title string.
For simplicity, I will just show a mock function:
my_plot <- function(x){
v1 <- x:10
return(plot(v1, main = "The year of ...y..."))
}
my_plot(x=4)
How do I replace ...y... with an function argument?
Best, Rikki

plot()plots as a side effect, your function is in fact always returningNULLfoo <- my_plot(x=4);foo