How do I modify an argument being passed to a function in R? In C++ this would be pass by reference.
g=4 abc <- function(x) {x<-5} abc(g)
There has got to be a better way to do this but...
abc <- function(x){eval(parse(text = paste(substitute(x), "<<- 5")))} g <- 4 abc(g) g
gives the output
[1] 5