The last example was used, and now it is not. No string interpolation inside a function? Maybe this has something to do with the variable? Any suggestions?
library(gsubfn)
g <- function() {for (a in 1:2) { print(paste('is a', a)) }}
g()
for (a in 1:2) { fn$print('is a $a') }
rm(a)
h <- function() {for (a in 1:2) { fn$print('is a $a') }}
h()
This last example tells me
Error in eval(expr, envir, enclos) : object 'a' not found
source
share