0

I'm developing a Jamovi module for Network Meta-analysis (NMA). I'm using netmeta package to coding some functions for my module.

One of the functions that I will use is pairwise. This function converts a database to the proper format in order to perform NMA.

This function get some columns from a database and create a new database with new columns:

Test <- paste("Newbase <- pairwise(treat = list(",varsT,"), n=list(",varsN,"), event=list(",varsE,"), data=data, studlab=",varsS,", sm=c('",SM,"'))", sep="")

varsT, varsN, varsE, varsS are vectors that store the name columns for each information needed to run the command pairwise.

How do I run the function stored inside Test object?

  • 1
    Also a duplicate of [Execute command from a string](https://stackoverflow.com/questions/54427112/execute-command-from-a-string) – Jav Dec 08 '21 at 17:45
  • 2
    `eval(parse(text = Test))` is what you want. But, usually, you want to avoid doing this. – Jav Dec 08 '21 at 17:47
  • I tried to run it but I'm getting the following error message: Error in eval(mf[[match("treat", names(mf))]], data, enclos = sys.frame(sys.parent())) : invalid 'envir' argument of type 'closure' – Marcelo Goulart Dec 09 '21 at 11:43

0 Answers0