[R] Executable expressions

Charlie Sharpsteen chuck at sharpsteen.net
Wed Jan 18 22:38:20 CET 2012


On Wed, Jan 18, 2012 at 1:18 PM, Ajay Askoolum <aa2e72e at yahoo.co.uk> wrote:
>
> Given
>
> a<-"c(1,2,3,4,5)"
>
> How can  I evaluate the variable a to return a (numeric) vector comprising of 1,2,3,4,5? Thanks.


You can also use an "active binding":

    > makeActiveBinding('a', function(){c(1,2,3,4,5)}, .GlobalEnv)
    > a
    [1] 1 2 3 4 5

However, I agree with the other posters---resorting to these kinds of
tricks is usually a bad sign.

-Charlie



More information about the R-help mailing list