Whats wrong here? I was expecting 11 as the result... Thanks in advance. bench <- function(str,...) { func <- function(x) x+10 expr <- list(...)[1] str <- gsub("XXX",expr,str) x <- as.call(gsub("\"","",str)) eval(x) } bench("func(XXX)", "1")