Look at the gsubfn package, it has functionality to do this.
Here is an example from the vignette:
fn$cat(pi = $pi, exp = `exp(1)`\n)
pi = 3.14159265358979, exp = 2.71828182845905
The formula syntax to function conversion in the package may help with the
last part.
On Fri, Feb 8, 2013 at
joshua wiley told me how to do this. so, here is something I find quite useful:
estring - function (e2)
{
syntax - regmatches(e2, gregexpr((?=\\{\\{).*?(?=\\}\\}), e2,
perl=TRUE))[[1]]
res - lapply(syntax, function(p) eval(parse(text=p)))
res - lapply(1:length(res), function(i) {
e2
dear R experts---I am trying to replicate a perl feature. I want to be
able to embed R commands inside a character string, and have the
string be printed with the command executed. my perl equivalent is
my $a=10;
my $teststring = the expression, $a+1, is ::$a+1::, but add one
more for
3 matches
Mail list logo