Error: Alphanumeric argument 'formula' must be of length 1.

Hello,

I am trying to run meta-regression using 'metareg' function from 'meta' package. I keep getting the error that says "Error: Alphanumeric argument 'formula' must be of length 1." Does anyone know what it means and how to solve it?

Thanks.

What are you using for the formula argument ?

I'm using a character string.

ok, rather than playing a form of 20 questions, perhaps make a reprex
FAQ: How to do a minimal reproducible example ( reprex ) for beginners

Thanks for the link. Here's the reprex:

library(meta)
#> Loading 'meta' package (version 4.18-0).
#> Type 'help(meta)' for a brief overview.
  
  MA<- data.frame(Number = c(1, 6, 8, 10, 11),
                  r = c(0.72, 0.0055, 0.11, 0.07, 0.155),
                  `Sample size(s)` = c(39, 162, 18, 74, 37),
                  Method = c("Lab", "Field", "Lab", "Field", "Field")
  )
  
  #object of class meta

  m.cor <- metacor(r, 
                   MA$Sample.size.s., 
                   data = MA,
                   studlab = MA$Number,
                   sm = "ZCOR",
                   method.tau = "SJ")
  
  Method<- MA$Method
  
  #Performing meta-regression
  
  metareg(m.cor, Method)
  
  # Error: Alphanumeric argument 'formula' must be of length 1.

Created on 2021-03-11 by the reprex package (v1.0.0)

ok thanks.
well MA$method, isnt a character representation of a formula.
Its a 4 part character vector, basically the contents of the method column in MA.
I'm thinking perhaps you mean to do

metareg(m.cor,~Method)

but I don't know the meta package.

Thanks, it did work!

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.

If you have a query related to it or one of the replies, start a new topic and refer back with a link.