I make several calls to mtext() using the same args:
mtext(expression(bold("Exome SNP QQ Plots")), col="black", outer=TRUE, cex=1.3)
I want to create an object containing these args, that I can pass to mtext(), rather than recreating it each time. I tried to put the args above in a variable as a list:
PageTitle <- list(expression(bold("Exome SNP QQ Plots")), col="black", outer=TRUE, cex=1.3)
And then pass the variable to mtext():
mtext(PageTitle)
This does not behave the same as calling mtext() with a complete set of args.
I suspect that mtext() is not looking for a list, but a different kind of object?
Function
do.callis what you are looking for:We have the syntax
do.call(what, args, quote = FALSE, envir = parent.frame()), herewhatis a function andargsis a list of arguments to the function call – and that is great that you already have this list.do.callis a very useful function and it might help you in other situations too.