Say I have the following function in R:
tst <- function(x,y){
  foo <- match.call()
  print(foo)
}
tst(4,5)
This gives tst(x = 4, y = 5). Awesome. Now, I want to add an argument.
tst <- function(x,y){
  foo <- match.call()
  foo[[length(foo)+1]] <- 6
  print(foo)
}
tst(4,5)
This prints tst(x = 4, y = 5, 6), which is great. However, I need to add an argument name so that the function knows what to do with it. For example, I want it to be tst(x = 4, y = 5, z = 6). I tried simply foo[[length(foo)+1]] <- "z = 6", but that clearly doesn't work. I've also toyed with parse and eval without success. Any suggestions?