I want to calculate the irr for differents columns of a dataframe called tir. So if I do irr(tir$20180201) I get the value.
But i want replace 20180201 with the return of: last(fecha$fecha), that will give me 20180201 or another value. 
I do:  z <- paste("tir$", last(fecha$fecha), sep="") and I try to do irr(formula(z))  and I get:
Error in parse(text = x, keep.source = FALSE) : 
  <text>:1:5: unexpected numeric constant
1: tir$20181201
How can I solve my problem? Thanks!
 
    