简体   繁体   中英

How combine columns on stargazer?

I want to make a table with stargazer. First I assigned the outcome of my formula to rAgg . After this I want to make a stargazer table with the following commands:

a <- rAgg$ors.ctx
b <- rAgg$ors.indiv
c <-rAgg$lik
rbind(a,b,c)  

An example of the outcomes of a are: OR l95 u95 (Intercept) 0.007148468 0.006327645 0.008075768 statusscore14 0.996612498 0.971742666 1.022118825 meanGroente 1.068326524 1.046027113 1.091101319

This gives the outcome:

> rbind(a,b,c)
#                        OR          l95          u95
# (Intercept)   7.148468e-03 6.327645e-03 8.075768e-03
# statusscore14 9.966125e-01 9.717427e-01 1.022119e+00
# meanGroente   1.068327e+00 1.046027e+00 1.091101e+00
# pHerkomst     4.682304e-01 3.552017e-01 6.172260e-01
# pOuderPersoon 2.969725e+00 2.509198e+00 3.514775e+00
# c             4.686703e+03 4.686703e+03 4.686703e+03

However, I would prefer an outcome like this

                        rAgg      
(Intercept)   7.148468e-03 (6.327, 8.075)
statusscore14 9.966125e-01 (9.717, 1.022)
meanGroente   1.068327e+00 (1.046, 1.091)
pHerkomst     4.682304e-01 (3.552, 6.172)
pOuderPersoon 2.969725e+00 (2.509, 3.514)
c             4.686703e+03 (4.6867, 4.686)`

In other words, combine the three columns into one (and make use of brackets). I hope there is a convenient way to do this.

Help is much appreciated!

Basically @rawr gave the answer already. Only a was missing in his comment. So the complete answer would be sprintf("%f (%.3f and %.3f)", a, b, c) . PS: I avoid naming objects like functions (and c is a function).

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM