Skip to content
Back to formatted view

Raw Message

Message-ID: <80831da90911012007g6e311428p3eb41643cdc0c64c@mail.gmail.com>
Date: 2009-11-02T04:07:37Z
From: Ning Ma
Subject: How to execute a funcition which name is stored in a string?

Hi, everybody

Is there any way to execute a function, which name is stored in a string.
such as:
a <- "ls()"
foo(a) ## same as ls() itself.

Or, to execute a R command, which is stored in a string
such as:
a <- "m1 <- matrix(1:9,3,3)"
foo(a) ## same as the assignment itself