0

I'm getting the above error when trying to run my R code with metabin, here's my code and error library

aa<-read.csv("C:/Users/Lizzie/Desktop/aa.csv") 
aa1<-metabin(Tevent,Ttotal,Cevent,Ctotal,data=aa,sm="RR", studlab = paste(study,year), label.e = "Intervention",label.c = "Control", subgroup = "Type" )
summary(aa1) 

When I run the second line of my codes, I got this error:

Error: Arguments 'event.e' and 'subgroup' must have the same length.

I really don't understand what's going on, because I'm new in R "event.e" is number like 1, 2, 3, while "subgroup" is text like a, b, c,
Hope you guys could help me with this, thanks a lot!!

lizzie
  • 1
  • 1
  • Welcome to SO, lizzie! Questions on SO (especially in R) do much better if they are reproducible and self-contained. By that I mean including attempted code (please be explicit about non-base packages), sample representative data (perhaps via `dput(head(x))` or building data programmatically (e.g., `data.frame(...)`), possibly stochastically), perhaps actual output (with verbatim errors/warnings) versus intended output. Refs: https://stackoverflow.com/q/5963269, [mcve], and https://stackoverflow.com/tags/r/info. – r2evans Jul 16 '22 at 17:28
  • FYI, I think you're using the [`meta`](https://cran.r-project.org/web/packages/meta/) package for R. However, the [tag:meta] tag is a bit vague (it is intended for HTML/XHTML meta elements). It's not a horrible tag since it adds a little context, but I wouldn't be surprised if it is removed at some point. – r2evans Jul 16 '22 at 17:31

2 Answers2

0

aa1<-metabin(Tevent,Ttotal,Cevent,Ctotal,data=aa,sm="RR", studlab = paste(study,year), label.e = "Intervention",label.c = "Control", subgroup = Type )

lizzie
  • 1
  • 1
  • hi Lizzie, something to think about... without some example data, it's going to be very difficult for anyone to learn from this question and answer. – quickreaction Jul 18 '22 at 18:38
  • As it’s currently written, your answer is unclear. Please [edit] to add additional details that will help others understand how this addresses the question asked. You can find more information on how to write good answers [in the help center](/help/how-to-answer). – Community Jul 18 '22 at 18:38
-1

trying using subgroup = Type without the quote, I do use byvar = though