0

I am using the package meta to do a meta-analysis in R.

The data I am working with is like:

dat1 <- data.frame(E1 = c(1,   1, 34, 24),
                   N1 = c(45, 34, 47, 34),
                   E2 = c(23, 12, 12, 56),
                   N2 = c(34, 45, 36, 40),
                   Group = c('A', 'A', 'B', 'B'))
dat1

 E1       N1      E2       N2    Group
 1        45      23       34     A
 1        34      12       45     A
 34       47      12       36     B
 24       34      56       40     B

The code used is:

library(meta)

metapr <- metaprop(event = E1, n = N1, data = dat1, byvar = Group, comb.fixed = FALSE)
ss <- summary(metapr)

I need to create a table with some data from the summary, but I am not able to retrieve it using the syntax:

ss$...... 

I need the following values:

y <- c('Variable', 'Number studies','Pooled proportion', '95% CI', 'I^2%', 
'p-value') #for the study
x1 <- c('Variable', 'Number studies','Pooled proportion', '95% CI', 'I^2%')  
#for each subgroup
x2 <- c('Variable', 'Number studies','Pooled proportion', '95% CI', 'I^2%')  
#for each subgroup

The result would be:

y <- c('E1', 4, 0.2534, '[0.0501; 0.6861]',91.8, 0.0001)
x1 <- c('E1A', 2,0.0256, '[0.0064; 0.0965]', 0.0)  
x2 <- c('E!B', 2,0.7160, '[0.6086; 0.8034]', 0.0)  

Thank you!!

  • 4
    It's easier to help you if you provide a [reproducible example](https://stackoverflow.com/questions/5963269/how-to-make-a-great-r-reproducible-example) with sample input data and the desired output. That way we can run and test the code. – MrFlick Jan 01 '18 at 19:35
  • 1
    Is E1 = 1ER and N1 = 1N ? – G5W Jan 01 '18 at 22:01
  • Yes, sorry. I have modified that. –  Jan 01 '18 at 22:10
  • 1
    Your code contains one or several errors thus it's impossible to reproduce the example. Still, this code may give you some ideas about the structure of the object you are interested in: `library(meta)`; `m1 <- metaprop(4:1, c(10, 20, 30, 40))`; `str(summary(m1))` – GegznaV Jan 02 '18 at 00:19
  • I have modified the questions and the data, now is working! Thank you!! –  Jan 02 '18 at 19:23

1 Answers1

0

It is hard without a reproducible example, but I would suggest, instead of using $ as your extract operator, try using the double brackets ([[]]) to pull out a specific object and then the single brackets ([]) to pull a specific item out of that object.