get_estimates(mod, test = c("pd", "rope"))
-#> term estimate mad conf.level conf.low conf.high
-#> 1 (Intercept) -2.2386755829 0.577397121 0.95 -3.371992258 -1.03919442
-#> 2 hp 0.0006911648 0.001067133 0.95 -0.001490074 0.00284835
-#> 3 drat 0.7062289285 0.134735553 0.95 0.424172795 0.97769625
-#> pd rope.percentage prior.distribution prior.location prior.scale group
-#> 1 0.99975 0 normal 0.40625 1.24747729
-#> 2 0.73800 1 normal 0.00000 0.01819465
-#> 3 1.00000 0 normal 0.00000 2.33313429
+#> term estimate mad conf.level conf.low conf.high
+#> 1 (Intercept) -2.223229224 0.586274128 0.95 -3.396758381 -1.037911267
+#> 2 hp 0.000693693 0.001026168 0.95 -0.001395935 0.002758334
+#> 3 drat 0.704419925 0.137470457 0.95 0.418757325 0.973648848
+#> pd rope.percentage prior.distribution prior.location prior.scale group
+#> 1 0.9995 0 normal 0.40625 1.24747729
+#> 2 0.7460 1 normal 0.00000 0.01819465
+#> 3 1.0000 0 normal 0.00000 2.33313429
#> std.error statistic p.value
#> 1 NA NA NA
#> 2 NA NA NA
diff --git a/dev/pkgdown.yml b/dev/pkgdown.yml
index 9fb29a0ae..eee7cf3b1 100644
--- a/dev/pkgdown.yml
+++ b/dev/pkgdown.yml
@@ -7,7 +7,7 @@ articles:
documentation: documentation.html
modelplot: modelplot.html
modelsummary: modelsummary.html
-last_built: 2023-08-15T11:32Z
+last_built: 2023-08-15T11:51Z
urls:
reference: https://vincentarelbundock.github.io/modelsummary/reference
article: https://vincentarelbundock.github.io/modelsummary/articles
diff --git a/dev/search.json b/dev/search.json
index bfe8d4f4d..677aa5c8d 100644
--- a/dev/search.json
+++ b/dev/search.json
@@ -1 +1 @@
-[{"path":"https://vincentarelbundock.github.io/modelsummary/dev/LICENSE.html","id":null,"dir":"","previous_headings":"","what":"GNU General Public License","title":"GNU General Public License","text":"Version 3, 29 June 2007Copyright © 2007 Free Software Foundation, Inc. Everyone permitted copy distribute verbatim copies license document, changing allowed.","code":""},{"path":"https://vincentarelbundock.github.io/modelsummary/dev/LICENSE.html","id":"preamble","dir":"","previous_headings":"","what":"Preamble","title":"GNU General Public License","text":"GNU General Public License free, copyleft license software kinds works. licenses software practical works designed take away freedom share change works. contrast, GNU General Public License intended guarantee freedom share change versions program–make sure remains free software users. , Free Software Foundation, use GNU General Public License software; applies also work released way authors. can apply programs, . speak free software, referring freedom, price. General Public Licenses designed make sure freedom distribute copies free software (charge wish), receive source code can get want , can change software use pieces new free programs, know can things. protect rights, need prevent others denying rights asking surrender rights. Therefore, certain responsibilities distribute copies software, modify : responsibilities respect freedom others. example, distribute copies program, whether gratis fee, must pass recipients freedoms received. must make sure , , receive can get source code. must show terms know rights. Developers use GNU GPL protect rights two steps: (1) assert copyright software, (2) offer License giving legal permission copy, distribute /modify . developers’ authors’ protection, GPL clearly explains warranty free software. users’ authors’ sake, GPL requires modified versions marked changed, problems attributed erroneously authors previous versions. devices designed deny users access install run modified versions software inside , although manufacturer can . fundamentally incompatible aim protecting users’ freedom change software. systematic pattern abuse occurs area products individuals use, precisely unacceptable. Therefore, designed version GPL prohibit practice products. problems arise substantially domains, stand ready extend provision domains future versions GPL, needed protect freedom users. Finally, every program threatened constantly software patents. States allow patents restrict development use software general-purpose computers, , wish avoid special danger patents applied free program make effectively proprietary. prevent , GPL assures patents used render program non-free. precise terms conditions copying, distribution modification follow.","code":""},{"path":[]},{"path":"https://vincentarelbundock.github.io/modelsummary/dev/LICENSE.html","id":"id_0-definitions","dir":"","previous_headings":"TERMS AND CONDITIONS","what":"0. Definitions","title":"GNU General Public License","text":"“License” refers version 3 GNU General Public License. “Copyright” also means copyright-like laws apply kinds works, semiconductor masks. “Program” refers copyrightable work licensed License. licensee addressed “”. “Licensees” “recipients” may individuals organizations. “modify” work means copy adapt part work fashion requiring copyright permission, making exact copy. resulting work called “modified version” earlier work work “based ” earlier work. “covered work” means either unmodified Program work based Program. “propagate” work means anything , without permission, make directly secondarily liable infringement applicable copyright law, except executing computer modifying private copy. Propagation includes copying, distribution (without modification), making available public, countries activities well. “convey” work means kind propagation enables parties make receive copies. Mere interaction user computer network, transfer copy, conveying. interactive user interface displays “Appropriate Legal Notices” extent includes convenient prominently visible feature (1) displays appropriate copyright notice, (2) tells user warranty work (except extent warranties provided), licensees may convey work License, view copy License. interface presents list user commands options, menu, prominent item list meets criterion.","code":""},{"path":"https://vincentarelbundock.github.io/modelsummary/dev/LICENSE.html","id":"id_1-source-code","dir":"","previous_headings":"TERMS AND CONDITIONS","what":"1. Source Code","title":"GNU General Public License","text":"“source code” work means preferred form work making modifications . “Object code” means non-source form work. “Standard Interface” means interface either official standard defined recognized standards body, , case interfaces specified particular programming language, one widely used among developers working language. “System Libraries” executable work include anything, work whole, () included normal form packaging Major Component, part Major Component, (b) serves enable use work Major Component, implement Standard Interface implementation available public source code form. “Major Component”, context, means major essential component (kernel, window system, ) specific operating system () executable work runs, compiler used produce work, object code interpreter used run . “Corresponding Source” work object code form means source code needed generate, install, (executable work) run object code modify work, including scripts control activities. However, include work’s System Libraries, general-purpose tools generally available free programs used unmodified performing activities part work. example, Corresponding Source includes interface definition files associated source files work, source code shared libraries dynamically linked subprograms work specifically designed require, intimate data communication control flow subprograms parts work. Corresponding Source need include anything users can regenerate automatically parts Corresponding Source. Corresponding Source work source code form work.","code":""},{"path":"https://vincentarelbundock.github.io/modelsummary/dev/LICENSE.html","id":"id_2-basic-permissions","dir":"","previous_headings":"TERMS AND CONDITIONS","what":"2. Basic Permissions","title":"GNU General Public License","text":"rights granted License granted term copyright Program, irrevocable provided stated conditions met. License explicitly affirms unlimited permission run unmodified Program. output running covered work covered License output, given content, constitutes covered work. License acknowledges rights fair use equivalent, provided copyright law. may make, run propagate covered works convey, without conditions long license otherwise remains force. may convey covered works others sole purpose make modifications exclusively , provide facilities running works, provided comply terms License conveying material control copyright. thus making running covered works must exclusively behalf, direction control, terms prohibit making copies copyrighted material outside relationship . Conveying circumstances permitted solely conditions stated . Sublicensing allowed; section 10 makes unnecessary.","code":""},{"path":"https://vincentarelbundock.github.io/modelsummary/dev/LICENSE.html","id":"id_3-protecting-users-legal-rights-from-anti-circumvention-law","dir":"","previous_headings":"TERMS AND CONDITIONS","what":"3. Protecting Users’ Legal Rights From Anti-Circumvention Law","title":"GNU General Public License","text":"covered work shall deemed part effective technological measure applicable law fulfilling obligations article 11 WIPO copyright treaty adopted 20 December 1996, similar laws prohibiting restricting circumvention measures. convey covered work, waive legal power forbid circumvention technological measures extent circumvention effected exercising rights License respect covered work, disclaim intention limit operation modification work means enforcing, work’s users, third parties’ legal rights forbid circumvention technological measures.","code":""},{"path":"https://vincentarelbundock.github.io/modelsummary/dev/LICENSE.html","id":"id_4-conveying-verbatim-copies","dir":"","previous_headings":"TERMS AND CONDITIONS","what":"4. Conveying Verbatim Copies","title":"GNU General Public License","text":"may convey verbatim copies Program’s source code receive , medium, provided conspicuously appropriately publish copy appropriate copyright notice; keep intact notices stating License non-permissive terms added accord section 7 apply code; keep intact notices absence warranty; give recipients copy License along Program. may charge price price copy convey, may offer support warranty protection fee.","code":""},{"path":"https://vincentarelbundock.github.io/modelsummary/dev/LICENSE.html","id":"id_5-conveying-modified-source-versions","dir":"","previous_headings":"TERMS AND CONDITIONS","what":"5. Conveying Modified Source Versions","title":"GNU General Public License","text":"may convey work based Program, modifications produce Program, form source code terms section 4, provided also meet conditions: ) work must carry prominent notices stating modified , giving relevant date. b) work must carry prominent notices stating released License conditions added section 7. requirement modifies requirement section 4 “keep intact notices”. c) must license entire work, whole, License anyone comes possession copy. License therefore apply, along applicable section 7 additional terms, whole work, parts, regardless packaged. License gives permission license work way, invalidate permission separately received . d) work interactive user interfaces, must display Appropriate Legal Notices; however, Program interactive interfaces display Appropriate Legal Notices, work need make . compilation covered work separate independent works, nature extensions covered work, combined form larger program, volume storage distribution medium, called “aggregate” compilation resulting copyright used limit access legal rights compilation’s users beyond individual works permit. Inclusion covered work aggregate cause License apply parts aggregate.","code":""},{"path":"https://vincentarelbundock.github.io/modelsummary/dev/LICENSE.html","id":"id_6-conveying-non-source-forms","dir":"","previous_headings":"TERMS AND CONDITIONS","what":"6. Conveying Non-Source Forms","title":"GNU General Public License","text":"may convey covered work object code form terms sections 4 5, provided also convey machine-readable Corresponding Source terms License, one ways: ) Convey object code , embodied , physical product (including physical distribution medium), accompanied Corresponding Source fixed durable physical medium customarily used software interchange. b) Convey object code , embodied , physical product (including physical distribution medium), accompanied written offer, valid least three years valid long offer spare parts customer support product model, give anyone possesses object code either (1) copy Corresponding Source software product covered License, durable physical medium customarily used software interchange, price reasonable cost physically performing conveying source, (2) access copy Corresponding Source network server charge. c) Convey individual copies object code copy written offer provide Corresponding Source. alternative allowed occasionally noncommercially, received object code offer, accord subsection 6b. d) Convey object code offering access designated place (gratis charge), offer equivalent access Corresponding Source way place charge. need require recipients copy Corresponding Source along object code. place copy object code network server, Corresponding Source may different server (operated third party) supports equivalent copying facilities, provided maintain clear directions next object code saying find Corresponding Source. Regardless server hosts Corresponding Source, remain obligated ensure available long needed satisfy requirements. e) Convey object code using peer--peer transmission, provided inform peers object code Corresponding Source work offered general public charge subsection 6d. separable portion object code, whose source code excluded Corresponding Source System Library, need included conveying object code work. “User Product” either (1) “consumer product”, means tangible personal property normally used personal, family, household purposes, (2) anything designed sold incorporation dwelling. determining whether product consumer product, doubtful cases shall resolved favor coverage. particular product received particular user, “normally used” refers typical common use class product, regardless status particular user way particular user actually uses, expects expected use, product. product consumer product regardless whether product substantial commercial, industrial non-consumer uses, unless uses represent significant mode use product. “Installation Information” User Product means methods, procedures, authorization keys, information required install execute modified versions covered work User Product modified version Corresponding Source. information must suffice ensure continued functioning modified object code case prevented interfered solely modification made. convey object code work section , , specifically use , User Product, conveying occurs part transaction right possession use User Product transferred recipient perpetuity fixed term (regardless transaction characterized), Corresponding Source conveyed section must accompanied Installation Information. requirement apply neither third party retains ability install modified object code User Product (example, work installed ROM). requirement provide Installation Information include requirement continue provide support service, warranty, updates work modified installed recipient, User Product modified installed. Access network may denied modification materially adversely affects operation network violates rules protocols communication across network. Corresponding Source conveyed, Installation Information provided, accord section must format publicly documented (implementation available public source code form), must require special password key unpacking, reading copying.","code":""},{"path":"https://vincentarelbundock.github.io/modelsummary/dev/LICENSE.html","id":"id_7-additional-terms","dir":"","previous_headings":"TERMS AND CONDITIONS","what":"7. Additional Terms","title":"GNU General Public License","text":"“Additional permissions” terms supplement terms License making exceptions one conditions. Additional permissions applicable entire Program shall treated though included License, extent valid applicable law. additional permissions apply part Program, part may used separately permissions, entire Program remains governed License without regard additional permissions. convey copy covered work, may option remove additional permissions copy, part . (Additional permissions may written require removal certain cases modify work.) may place additional permissions material, added covered work, can give appropriate copyright permission. Notwithstanding provision License, material add covered work, may (authorized copyright holders material) supplement terms License terms: ) Disclaiming warranty limiting liability differently terms sections 15 16 License; b) Requiring preservation specified reasonable legal notices author attributions material Appropriate Legal Notices displayed works containing ; c) Prohibiting misrepresentation origin material, requiring modified versions material marked reasonable ways different original version; d) Limiting use publicity purposes names licensors authors material; e) Declining grant rights trademark law use trade names, trademarks, service marks; f) Requiring indemnification licensors authors material anyone conveys material (modified versions ) contractual assumptions liability recipient, liability contractual assumptions directly impose licensors authors. non-permissive additional terms considered “restrictions” within meaning section 10. Program received , part , contains notice stating governed License along term restriction, may remove term. license document contains restriction permits relicensing conveying License, may add covered work material governed terms license document, provided restriction survive relicensing conveying. add terms covered work accord section, must place, relevant source files, statement additional terms apply files, notice indicating find applicable terms. Additional terms, permissive non-permissive, may stated form separately written license, stated exceptions; requirements apply either way.","code":""},{"path":"https://vincentarelbundock.github.io/modelsummary/dev/LICENSE.html","id":"id_8-termination","dir":"","previous_headings":"TERMS AND CONDITIONS","what":"8. Termination","title":"GNU General Public License","text":"may propagate modify covered work except expressly provided License. attempt otherwise propagate modify void, automatically terminate rights License (including patent licenses granted third paragraph section 11). However, cease violation License, license particular copyright holder reinstated () provisionally, unless copyright holder explicitly finally terminates license, (b) permanently, copyright holder fails notify violation reasonable means prior 60 days cessation. Moreover, license particular copyright holder reinstated permanently copyright holder notifies violation reasonable means, first time received notice violation License (work) copyright holder, cure violation prior 30 days receipt notice. Termination rights section terminate licenses parties received copies rights License. rights terminated permanently reinstated, qualify receive new licenses material section 10.","code":""},{"path":"https://vincentarelbundock.github.io/modelsummary/dev/LICENSE.html","id":"id_9-acceptance-not-required-for-having-copies","dir":"","previous_headings":"TERMS AND CONDITIONS","what":"9. Acceptance Not Required for Having Copies","title":"GNU General Public License","text":"required accept License order receive run copy Program. Ancillary propagation covered work occurring solely consequence using peer--peer transmission receive copy likewise require acceptance. However, nothing License grants permission propagate modify covered work. actions infringe copyright accept License. Therefore, modifying propagating covered work, indicate acceptance License .","code":""},{"path":"https://vincentarelbundock.github.io/modelsummary/dev/LICENSE.html","id":"id_10-automatic-licensing-of-downstream-recipients","dir":"","previous_headings":"TERMS AND CONDITIONS","what":"10. Automatic Licensing of Downstream Recipients","title":"GNU General Public License","text":"time convey covered work, recipient automatically receives license original licensors, run, modify propagate work, subject License. responsible enforcing compliance third parties License. “entity transaction” transaction transferring control organization, substantially assets one, subdividing organization, merging organizations. propagation covered work results entity transaction, party transaction receives copy work also receives whatever licenses work party’s predecessor interest give previous paragraph, plus right possession Corresponding Source work predecessor interest, predecessor can get reasonable efforts. may impose restrictions exercise rights granted affirmed License. example, may impose license fee, royalty, charge exercise rights granted License, may initiate litigation (including cross-claim counterclaim lawsuit) alleging patent claim infringed making, using, selling, offering sale, importing Program portion .","code":""},{"path":"https://vincentarelbundock.github.io/modelsummary/dev/LICENSE.html","id":"id_11-patents","dir":"","previous_headings":"TERMS AND CONDITIONS","what":"11. Patents","title":"GNU General Public License","text":"“contributor” copyright holder authorizes use License Program work Program based. work thus licensed called contributor’s “contributor version”. contributor’s “essential patent claims” patent claims owned controlled contributor, whether already acquired hereafter acquired, infringed manner, permitted License, making, using, selling contributor version, include claims infringed consequence modification contributor version. purposes definition, “control” includes right grant patent sublicenses manner consistent requirements License. contributor grants non-exclusive, worldwide, royalty-free patent license contributor’s essential patent claims, make, use, sell, offer sale, import otherwise run, modify propagate contents contributor version. following three paragraphs, “patent license” express agreement commitment, however denominated, enforce patent (express permission practice patent covenant sue patent infringement). “grant” patent license party means make agreement commitment enforce patent party. convey covered work, knowingly relying patent license, Corresponding Source work available anyone copy, free charge terms License, publicly available network server readily accessible means, must either (1) cause Corresponding Source available, (2) arrange deprive benefit patent license particular work, (3) arrange, manner consistent requirements License, extend patent license downstream recipients. “Knowingly relying” means actual knowledge , patent license, conveying covered work country, recipient’s use covered work country, infringe one identifiable patents country reason believe valid. , pursuant connection single transaction arrangement, convey, propagate procuring conveyance , covered work, grant patent license parties receiving covered work authorizing use, propagate, modify convey specific copy covered work, patent license grant automatically extended recipients covered work works based . patent license “discriminatory” include within scope coverage, prohibits exercise , conditioned non-exercise one rights specifically granted License. may convey covered work party arrangement third party business distributing software, make payment third party based extent activity conveying work, third party grants, parties receive covered work , discriminatory patent license () connection copies covered work conveyed (copies made copies), (b) primarily connection specific products compilations contain covered work, unless entered arrangement, patent license granted, prior 28 March 2007. Nothing License shall construed excluding limiting implied license defenses infringement may otherwise available applicable patent law.","code":""},{"path":"https://vincentarelbundock.github.io/modelsummary/dev/LICENSE.html","id":"id_12-no-surrender-of-others-freedom","dir":"","previous_headings":"TERMS AND CONDITIONS","what":"12. No Surrender of Others’ Freedom","title":"GNU General Public License","text":"conditions imposed (whether court order, agreement otherwise) contradict conditions License, excuse conditions License. convey covered work satisfy simultaneously obligations License pertinent obligations, consequence may convey . example, agree terms obligate collect royalty conveying convey Program, way satisfy terms License refrain entirely conveying Program.","code":""},{"path":"https://vincentarelbundock.github.io/modelsummary/dev/LICENSE.html","id":"id_13-use-with-the-gnu-affero-general-public-license","dir":"","previous_headings":"TERMS AND CONDITIONS","what":"13. Use with the GNU Affero General Public License","title":"GNU General Public License","text":"Notwithstanding provision License, permission link combine covered work work licensed version 3 GNU Affero General Public License single combined work, convey resulting work. terms License continue apply part covered work, special requirements GNU Affero General Public License, section 13, concerning interaction network apply combination .","code":""},{"path":"https://vincentarelbundock.github.io/modelsummary/dev/LICENSE.html","id":"id_14-revised-versions-of-this-license","dir":"","previous_headings":"TERMS AND CONDITIONS","what":"14. Revised Versions of this License","title":"GNU General Public License","text":"Free Software Foundation may publish revised /new versions GNU General Public License time time. new versions similar spirit present version, may differ detail address new problems concerns. version given distinguishing version number. Program specifies certain numbered version GNU General Public License “later version” applies , option following terms conditions either numbered version later version published Free Software Foundation. Program specify version number GNU General Public License, may choose version ever published Free Software Foundation. Program specifies proxy can decide future versions GNU General Public License can used, proxy’s public statement acceptance version permanently authorizes choose version Program. Later license versions may give additional different permissions. However, additional obligations imposed author copyright holder result choosing follow later version.","code":""},{"path":"https://vincentarelbundock.github.io/modelsummary/dev/LICENSE.html","id":"id_15-disclaimer-of-warranty","dir":"","previous_headings":"TERMS AND CONDITIONS","what":"15. Disclaimer of Warranty","title":"GNU General Public License","text":"WARRANTY PROGRAM, EXTENT PERMITTED APPLICABLE LAW. EXCEPT OTHERWISE STATED WRITING COPYRIGHT HOLDERS /PARTIES PROVIDE PROGRAM “” WITHOUT WARRANTY KIND, EITHER EXPRESSED IMPLIED, INCLUDING, LIMITED , IMPLIED WARRANTIES MERCHANTABILITY FITNESS PARTICULAR PURPOSE. ENTIRE RISK QUALITY PERFORMANCE PROGRAM . PROGRAM PROVE DEFECTIVE, ASSUME COST NECESSARY SERVICING, REPAIR CORRECTION.","code":""},{"path":"https://vincentarelbundock.github.io/modelsummary/dev/LICENSE.html","id":"id_16-limitation-of-liability","dir":"","previous_headings":"TERMS AND CONDITIONS","what":"16. Limitation of Liability","title":"GNU General Public License","text":"EVENT UNLESS REQUIRED APPLICABLE LAW AGREED WRITING COPYRIGHT HOLDER, PARTY MODIFIES /CONVEYS PROGRAM PERMITTED , LIABLE DAMAGES, INCLUDING GENERAL, SPECIAL, INCIDENTAL CONSEQUENTIAL DAMAGES ARISING USE INABILITY USE PROGRAM (INCLUDING LIMITED LOSS DATA DATA RENDERED INACCURATE LOSSES SUSTAINED THIRD PARTIES FAILURE PROGRAM OPERATE PROGRAMS), EVEN HOLDER PARTY ADVISED POSSIBILITY DAMAGES.","code":""},{"path":"https://vincentarelbundock.github.io/modelsummary/dev/LICENSE.html","id":"id_17-interpretation-of-sections-15-and-16","dir":"","previous_headings":"TERMS AND CONDITIONS","what":"17. Interpretation of Sections 15 and 16","title":"GNU General Public License","text":"disclaimer warranty limitation liability provided given local legal effect according terms, reviewing courts shall apply local law closely approximates absolute waiver civil liability connection Program, unless warranty assumption liability accompanies copy Program return fee. END TERMS CONDITIONS","code":""},{"path":"https://vincentarelbundock.github.io/modelsummary/dev/LICENSE.html","id":"how-to-apply-these-terms-to-your-new-programs","dir":"","previous_headings":"","what":"How to Apply These Terms to Your New Programs","title":"GNU General Public License","text":"develop new program, want greatest possible use public, best way achieve make free software everyone can redistribute change terms. , attach following notices program. safest attach start source file effectively state exclusion warranty; file least “copyright” line pointer full notice found. Also add information contact electronic paper mail. program terminal interaction, make output short notice like starts interactive mode: hypothetical commands show w show c show appropriate parts General Public License. course, program’s commands might different; GUI interface, use “box”. also get employer (work programmer) school, , sign “copyright disclaimer” program, necessary. information , apply follow GNU GPL, see . GNU General Public License permit incorporating program proprietary programs. program subroutine library, may consider useful permit linking proprietary applications library. want , use GNU Lesser General Public License instead License. first, please read .","code":" Copyright (C) 2019 Vincent Arel-Bundock This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program. If not, see . modelsummary Copyright (C) 2019 Vincent Arel-Bundock This program comes with ABSOLUTELY NO WARRANTY; for details type 'show w'. This is free software, and you are welcome to redistribute it under certain conditions; type 'show c' for details."},{"path":"https://vincentarelbundock.github.io/modelsummary/dev/articles/appearance.html","id":"gt","dir":"Articles","previous_headings":"","what":"gt","title":"Customizing the look of your table","text":"illustrate customize tables using gt package use following functions gt package: tab_spanner creates labels group columns. tab_footnote adds footnote matching marking specific cell. tab_style can modify text color rows, columns, cells. produce “cleaner” look, also use modelsummary’s stars, coef_map, gof_omit, title arguments. Note order access gt functions, must first load library. modelsummary table customized gt gt website offers many examples. possibilities endless. instance, gt allows embed images tables using text_transform local_image functions: modelsummary table customized gt","code":"library(gt) # build table with `modelsummary` cm <- c( '(Intercept)' = 'Constant', 'Literacy' = 'Literacy (%)', 'Clergy' = 'Priests/capita') cap <- 'A modelsummary table customized with gt' tab <- modelsummary(models, output = \"gt\", coef_map = cm, stars = TRUE, title = cap, gof_omit = 'IC|Log|Adj') # customize table with `gt` tab %>% # column labels tab_spanner(label = 'Donations', columns = 2:3) %>% tab_spanner(label = 'Crimes (persons)', columns = 4:5) %>% tab_spanner(label = 'Crimes (property)', columns = 6) %>% # footnote tab_footnote(footnote = md(\"A very **important** variable.\"), locations = cells_body(rows = 3, columns = 1)) %>% # text and background color tab_style(style = cell_text(color = 'red'), locations = cells_body(rows = 3)) %>% tab_style(style = cell_fill(color = 'lightblue'), locations = cells_body(rows = 5)) f <- function(x) web_image(url = \"https://user-images.githubusercontent.com/987057/82732352-b9aabf00-9cda-11ea-92a6-26750cf097d0.png\", height = 80) tab %>% text_transform(locations = cells_body(columns = 2:6, rows = 1), fn = f)"},{"path":"https://vincentarelbundock.github.io/modelsummary/dev/articles/appearance.html","id":"kableextra","dir":"Articles","previous_headings":"","what":"kableExtra","title":"Customizing the look of your table","text":"now illustrate customize tables using functions kableExtra package: add_header_above creates labels group columns. add_footnote adds footnote matching marking specific cell. row_spec can modify text color rows, columns, cells. use code , specify output='kableExtra' modelsummary() call: modelsummary table customized kableExtra kableExtra functions can used produce LaTeX / PDF tables one:","code":"library(kableExtra) # build table with `modelsummary` cm <- c( '(Intercept)' = 'Constant', 'Literacy' = 'Literacy (%)', 'Clergy' = 'Priests/capita') cap <- 'A modelsummary table customized with kableExtra' tab <- modelsummary(models, output = 'kableExtra', coef_map = cm, stars = TRUE, title = cap, gof_omit = 'IC|Log|Adj') # customize table with `kableExtra` tab %>% # column labels add_header_above(c(\" \" = 1, \"Donations\" = 2, \"Crimes (person)\" = 2, \"Crimes (property)\" = 1)) %>% # text and background color row_spec(3, color = 'red') %>% row_spec(5, background = 'lightblue')"},{"path":"https://vincentarelbundock.github.io/modelsummary/dev/articles/appearance.html","id":"flextable","dir":"Articles","previous_headings":"","what":"flextable","title":"Customizing the look of your table","text":"now illustrate customize tables using functions flextable package: color modify color text bg modify color background autofit sets column width sensible values. use code , specify output='flextable' modelsummary() call: modelsummary table customized flextable OLS 1 Poisson 1 OLS 2 Poisson 2 OLS 3 Constant 8759.068*** 8.986*** 20357.309*** 9.708*** 11243.544*** (1559.363) (0.004) (2020.980) (0.003) (1011.240) Literacy (%) -42.886 -0.006*** -15.358 0.000*** -68.507*** (36.362) (0.000) (47.127) (0.000) (18.029) Priests/capita 0.002*** 0.004*** -16.376 (0.000) (0.000) (12.522) Num.Obs. 86 86 86 86 86 R2 0.016 0.001 0.152 F 1.391 4170.610 0.106 7905.811 7.441 RMSE 5753.14 5727.27 7456.23 7233.22 2793.43 + p < 0.1, * p < 0.05, ** p < 0.01, *** p < 0.001","code":"library(flextable) #> #> Attaching package: 'flextable' #> The following objects are masked from 'package:kableExtra': #> #> as_image, footnote # build table with `modelsummary` cm <- c( '(Intercept)' = 'Constant', 'Literacy' = 'Literacy (%)', 'Clergy' = 'Priests/capita') cap <- 'A modelsummary table customized with flextable' tab <- modelsummary(models, output = 'flextable', coef_map = cm, stars = TRUE, title = cap, gof_omit = 'IC|Log|Adj') # customize table with `flextable` tab %>% # text and background color color(3, color = 'red') %>% bg(5, bg = 'lightblue') %>% # column widths autofit()"},{"path":"https://vincentarelbundock.github.io/modelsummary/dev/articles/appearance.html","id":"huxtable","dir":"Articles","previous_headings":"","what":"huxtable","title":"Customizing the look of your table","text":"now illustrate customize tables using functions huxtable package: set_text_color change color entries use code , specify output='huxtable' modelsummary() call: modelsummary table customized huxtable","code":"library(huxtable) # build table with `modelsummary` cm <- c( '(Intercept)' = 'Constant', 'Literacy' = 'Literacy (%)', 'Clergy' = 'Priests/capita') cap <- 'A modelsummary table customized with huxtable' tab <- modelsummary(models, output = 'huxtable', coef_map = cm, stars = TRUE, title = cap, gof_omit = 'IC|Log|Adj') # customize table with `huxtable` tab %>% # text color set_text_color(row = 4, col = 1:ncol(.), value = 'red')"},{"path":"https://vincentarelbundock.github.io/modelsummary/dev/articles/appearance.html","id":"themes","dir":"Articles","previous_headings":"","what":"Themes","title":"Customizing the look of your table","text":"want apply post-processing functions tables, can use modelsummary’s theming functionality. , first create function post-process table. function must accept table first argument, include ellipsis (...). Optionally, theming function can also accept hrule argument vector row positions insert horizontal rule, output_format allows output format-specific customization. inspiration, may want consult default modelsummary themes themes.R file Github repository. theming function created, assign global option called modelsummary_theme_kableExtra, modelsummary_theme_gt, modelsummary_theme_flextable, modelsummary_theme_huxtable. example, want add row striping gt tables: Restore default theme:","code":"library(gt) # The ... ellipsis is required! custom_theme <- function(x, ...) { x %>% gt::opt_row_striping(row_striping = TRUE) } options(\"modelsummary_theme_gt\" = custom_theme) mod <- lm(mpg ~ hp + drat, mtcars) modelsummary(mod, output = \"gt\") url <- 'https://vincentarelbundock.github.io/Rdatasets/csv/palmerpenguins/penguins.csv' penguins <- read.csv(url) datasummary_crosstab(island ~ sex * species, output = \"gt\", data = penguins) options(\"modelsummary_theme_gt\" = NULL)"},{"path":"https://vincentarelbundock.github.io/modelsummary/dev/articles/appearance.html","id":"themes-data-frame","dir":"Articles","previous_headings":"Themes","what":"Themes: Data Frame","title":"Customizing the look of your table","text":"particularly flexible strategy apply theme dataframe output format. illustrate, recall setting output=\"dataframe\" produces data frame lot extraneous meta information. produce nice table, process output bit: Imagine want create table using DT package, table-drawing backend currently supported modelsummary. , can create theming function: Restore default theme:","code":"mod <- lm(mpg ~ hp + drat, mtcars) modelsummary(mod, output = \"dataframe\") library(DT) theme_df <- function(tab) { out <- tab out$term[out$statistic == \"modelsummary_tmp2\"] <- \" \" out$part <- out$statistic <- NULL colnames(out)[1] <- \" \" datatable(out, rownames = FALSE, options = list(pageLength = 30)) } options(\"modelsummary_theme_dataframe\" = theme_df) modelsummary(mod, output = \"dataframe\") options(\"modelsummary_theme_dataframe\" = NULL)"},{"path":"https://vincentarelbundock.github.io/modelsummary/dev/articles/appearance.html","id":"variable-labels","dir":"Articles","previous_headings":"","what":"Variable labels","title":"Customizing the look of your table","text":"packages like haven can assign attributes columns dataset use labels. functions modelsummary can display labels automatically. example:","code":"library(haven) dat <- mtcars dat$am <- haven::labelled(dat$am, label = \"Transmission\") dat$mpg <- haven::labelled(dat$mpg, label = \"Miles per Gallon\") mod <- lm(hp ~ mpg + am, dat = dat) modelsummary(mod, coef_rename = TRUE) datasummary_skim(dat[, c(\"mpg\", \"am\", \"drat\")]) #> Warning: The histogram argument is only supported for (a) output types \"default\", #> \"html\", or \"kableExtra\"; (b) writing to file paths with extensions #> \".html\", \".jpg\", or \".png\"; and (c) Rmarkdown or knitr documents #> compiled to PDF or HTML. Use `histogram=FALSE` to silence this warning."},{"path":"https://vincentarelbundock.github.io/modelsummary/dev/articles/appearance.html","id":"warning-saving-to-file","dir":"Articles","previous_headings":"","what":"Warning: Saving to file","title":"Customizing the look of your table","text":"users supply file name output argument, table written immediately file. means users post-process customize resulting table using functions gt, kableExtra, huxtable, flextable. users specify filename output argument, modelsummary() call final one chain. OK: OK: save customized table, apply customization functions need saving using gt::gtsave, kableExtra::save_kable, appropriate helper function package using customize table. example, add color column spanners gt package: procedure slightly different kableExtra, package needs know final output format immediately table created. instance, want produce, customize, save LaTeX table:","code":"modelsummary(models, output = 'table.html') modelsummary(models, output = 'table.html') %>% tab_spanner(label = 'Literacy', columns = c('OLS 1', 'Poisson 1')) library(gt) tab <- modelsummary(models, output = \"gt\") %>% tab_spanner(label = 'Donations', columns = 2:3) %>% tab_spanner(label = 'Crimes (persons)', columns = 4:5) %>% tab_spanner(label = 'Crimes (property)', columns = 6) gt::gtsave(tab, filename = \"table.html\") library(kableExtra) tab <- modelsummary(models, output = 'latex') %>% add_header_above(c(\" \" = 1, \"Donations\" = 2, \"Crimes (person)\" = 2, \"Crimes (property)\" = 1)) kableExtra::save_kable(tab, file = \"table.tex\")"},{"path":"https://vincentarelbundock.github.io/modelsummary/dev/articles/appearance.html","id":"dt","dir":"Articles","previous_headings":"","what":"DT","title":"Customizing the look of your table","text":"DT package interface JavasScript DataTables library. can create DT table using output argument, pass arguments modelsummary() passed forward DT::datatable customize output table. example, let’s use fixest package estimate multiple linear regression models, DT package create table “frozen” first column:","code":"library(fixest) models <- feols(c(mpg, hp) ~ csw0(cyl, drat, am, vs, wt, carb, qsec, gear), data = mtcars) modelsummary( models, output = \"DT\", extensions = \"FixedColumns\", height = 50, options = list(pageLength = 50, scrollX = TRUE, fixedColumns = list(leftColumns = 1)))"},{"path":"https://vincentarelbundock.github.io/modelsummary/dev/articles/datasummary.html","id":"background","dir":"Articles","previous_headings":"","what":"Background","title":"`datasummary`: Crosstabs, frequencies, correlations, balance (a.k.a. ","text":"datasummary built around fantastic tables package R. thin “wrapper” adds convenience functions arguments; user-interface consistent modelsummary; cleaner html output; ability export tables formats, including gt tables, flextable objects, Microsoft Word documents. datasummary general-purpose table-making tool. allows us build (nearly) summary table want using simple 2-sided formulae. example, expression x + y ~ mean + sd, left-hand side formula identifies variables statistics display rows, right-hand side defines columns. , see variables statistics can “nested” * operator produce tables like ones . addition datasummary, modelsummary package includes “family” companion functions named datasummary_*. functions facilitate production standard, commonly used tables. family currently includes: datasummary(): Flexible function create custom tables using 2-sided formulae. datasummary_balance(): Group characteristics (e.g., control vs. treatment) datasummary_correlation(): Table correlations. datasummary_skim(): Quick summary dataset. datasummary_df(): Create table dataframe. datasummary_crosstab(): Cross tabulations categorical variables. next three sections, illustrate use datasummary_balance, datasummary_correlation, datasummary_skim, datasummary_crosstab. , dive datasummary highlight ease flexibility.","code":""},{"path":"https://vincentarelbundock.github.io/modelsummary/dev/articles/datasummary.html","id":"datasummary_skim","dir":"Articles","previous_headings":"","what":"datasummary_skim","title":"`datasummary`: Crosstabs, frequencies, correlations, balance (a.k.a. ","text":"first datasummary companion function called datasummary_skim. heavily inspired one favorite data exploration tools R: skimr package. goal function give us quick look data. illustrate, download data cool new palmerpenguins package Alison Presmanes Hill Allison Horst. data collected Palmer Station Antarctica Gorman, Williams & Fraser (2014), include 3 categorical variables 4 numeric variables. summarize numeric variables dataset, type: summarize categorical variables dataset, type: Later tutorial, become clear datasummary_skim just convenience “template” built around datasummary, since can achieve identical results latter. example, produce text-version tables , can type: Note histogram argument datasummary_skim function FALSE default, printing histograms work computers. issues option, try changing computer’s locale, try using different display font. datasummary_skim function currently allow users summarize continuous categorical variables together single table, datasummary_balance function described next section can .","code":"library(modelsummary) library(tidyverse) url <- 'https://vincentarelbundock.github.io/Rdatasets/csv/palmerpenguins/penguins.csv' penguins <- read.csv(url) datasummary_skim(penguins) datasummary_skim(penguins, type = \"categorical\") datasummary(All(penguins) ~ Mean + SD + Histogram, data = penguins, output = 'markdown') | | Mean| SD| Histogram| |:-----------------|-------:|------:|----------:| |bill_length_mm | 43.92| 5.46| ▁▅▆▆▆▇▇▂▁| |bill_depth_mm | 17.15| 1.97| ▃▄▄▄▇▆▇▅▂▁| |flipper_length_mm | 200.92| 14.06| ▂▅▇▄▁▄▄▂▁| |body_mass_g | 4201.75| 801.95| ▁▄▇▅▄▄▃▃▂▁|"},{"path":"https://vincentarelbundock.github.io/modelsummary/dev/articles/datasummary.html","id":"datasummary_balance","dir":"Articles","previous_headings":"","what":"datasummary_balance","title":"`datasummary`: Crosstabs, frequencies, correlations, balance (a.k.a. ","text":"expressions “balance table” “Table 1” refer type table often printed opening pages scientific peer-reviewed article. Typically, table includes basic descriptive statistics different subsets study population. instance, analysts may want compare socio-demographic characteristics members “control” “treatment” groups randomized control trial, flipper lengths male female penguins. addition, balance tables often include difference means tests. illustrate build balance table using datasummary_balance function, download data job training experiment studies Lalonde (1986). , clean data renaming recoding variables. Now, execute datasummary_balance function. estimatr package installed, datasummary_balance calculate difference means test statistics. Note dataset includes columns called “blocks”, “clusters”, “weights”, information automatically taken consideration estimatr calculating difference means associated statistics. Users can also use ~ 1 formula indicate want summarize data instead splitting analysis across subgroups:","code":"# Download and read data training <- 'https://vincentarelbundock.github.io/Rdatasets/csv/Ecdat/Treatment.csv' training <- read.csv(training) # Rename and recode variables training <- training %>% mutate(`Earnings Before` = re75 / 1000, `Earnings After` = re78 / 1000, Treatment = ifelse(treat == TRUE, 'Treatment', 'Control'), Married = ifelse(married == TRUE, 'Yes', 'No')) %>% select(`Earnings Before`, `Earnings After`, Treatment, Ethnicity = ethn, Age = age, Education = educ, Married) caption <- 'Descriptive statistics about participants in a job training experiment. The earnings are displayed in 1000s of USD. This table was created using the \"datasummary\" function from the \"modelsummary\" package for R.' reference <- 'Source: Lalonde (1986) American Economic Review.' library(modelsummary) datasummary_balance(~Treatment, data = training, title = caption, notes = reference) datasummary_balance(~ 1, data = training)"},{"path":"https://vincentarelbundock.github.io/modelsummary/dev/articles/datasummary.html","id":"datasummary_correlation","dir":"Articles","previous_headings":"","what":"datasummary_correlation","title":"`datasummary`: Crosstabs, frequencies, correlations, balance (a.k.a. ","text":"datasummary_correlation accepts dataframe tibble, identifies numeric variables, calculates correlation variables: values displayed table equivalent obtained calling: cor(x, use='pairwise.complete.obs').","code":"datasummary_correlation(mtcars)"},{"path":"https://vincentarelbundock.github.io/modelsummary/dev/articles/datasummary.html","id":"datasummary_crosstab","dir":"Articles","previous_headings":"","what":"datasummary_crosstab","title":"`datasummary`: Crosstabs, frequencies, correlations, balance (a.k.a. ","text":"cross tabulation often useful explore association two categorical variables. can create multi-level crosstabs specifying interactions using * operator: default, cell counts row percentages shown cell, row column totals calculated. show cell percentages column percentages, drop row column totals, adjust statistic argument. argument accepts formula follows datasummary “language”. understand exactly works, may find useful skip datasummary tutorial next section. Example: See ?datasummary_crosstab details.","code":"library(modelsummary) url <- 'https://vincentarelbundock.github.io/Rdatasets/csv/palmerpenguins/penguins.csv' penguins <- read.csv(url) datasummary_crosstab(species ~ sex, data = penguins) datasummary_crosstab(species ~ sex * island, data = penguins) datasummary_crosstab(species ~ sex, statistic = 1 ~ Percent(\"col\"), data = penguins)"},{"path":"https://vincentarelbundock.github.io/modelsummary/dev/articles/datasummary.html","id":"datasummary","dir":"Articles","previous_headings":"","what":"datasummary","title":"`datasummary`: Crosstabs, frequencies, correlations, balance (a.k.a. ","text":"datasummary tables specified using 2-sided formula, divided tilde ~. left-hand side describes rows; right-hand side describes columns. illustrate works, using palmerpenguins dataset: display flipper_length_mm variable row mean column, type: flip rows columns, flip left right-hand sides formula:","code":"datasummary(flipper_length_mm ~ Mean, data = penguins) datasummary(Mean ~ flipper_length_mm, data = penguins)"},{"path":"https://vincentarelbundock.github.io/modelsummary/dev/articles/datasummary.html","id":"custom-summary-functions","dir":"Articles","previous_headings":"datasummary","what":"Custom summary functions","title":"`datasummary`: Crosstabs, frequencies, correlations, balance (a.k.a. ","text":"Mean function shortcut supplied modelsummary, equivalent mean(x,na.rm=TRUE). Since flipper_length_mm variable includes missing observation, using mean formula (default na.rm=FALSE) produce missing/empty cell: modelsummary supplies functions: Mean, SD, Min, Max, Median, P0, P25, P50, P75, P100, Histogram, (see package documentation). Users also free create use custom summaries. R function takes vector produces single value acceptable. example, Range functions return numerical value, MinMax returns string:","code":"datasummary(flipper_length_mm ~ mean, data = penguins) Range <- function(x) max(x, na.rm = TRUE) - min(x, na.rm = TRUE) datasummary(flipper_length_mm ~ Range, data = penguins) MinMax <- function(x) paste0('[', min(x, na.rm = TRUE), ', ', max(x, na.rm = TRUE), ']') datasummary(flipper_length_mm ~ MinMax, data = penguins)"},{"path":"https://vincentarelbundock.github.io/modelsummary/dev/articles/datasummary.html","id":"concatenating-with","dir":"Articles","previous_headings":"datasummary","what":"Concatenating with +","title":"`datasummary`: Crosstabs, frequencies, correlations, balance (a.k.a. ","text":"include rows columns, use + sign: Sometimes, can cumbersome list variables separated + signs. () function useful shortcut: default, selects numeric variables. behavior can changed modifying function’s arguments. See ?details.","code":"datasummary(flipper_length_mm + body_mass_g ~ Mean + SD, data = penguins) datasummary(All(penguins) ~ Mean + SD, data = penguins)"},{"path":"https://vincentarelbundock.github.io/modelsummary/dev/articles/datasummary.html","id":"nesting-with","dir":"Articles","previous_headings":"datasummary","what":"Nesting with *","title":"`datasummary`: Crosstabs, frequencies, correlations, balance (a.k.a. ","text":"datasummary can nest variables statistics inside categorical variables using * symbol. applying * operator factor, character, logical variables, columns rows automatically nested. instance, want display separate means value variable sex, use mean * sex: can use parentheses nest several terms inside one another, using call form: x * (y + z). example nested columns: example nested rows: order terms enter formula determines order labels displayed. example, shows island sex: shows sex island values: default, datasummary omits column headers single value/label across columns, except header sits just data. header want see displayed, may want reorder terms formula. show headers, set sparse_header=FALSE: using sparse_header=FALSE, often useful insert Heading() * table formula, order rename omit labels manually. Type ?tables::Heading details examples.","code":"datasummary(flipper_length_mm + body_mass_g ~ mean * sex, data = penguins) datasummary(body_mass_g ~ sex * (mean + sd), data = penguins) datasummary(sex * (body_mass_g + flipper_length_mm) ~ mean + sd, data = penguins) datasummary(flipper_length_mm + body_mass_g ~ mean * island * sex, data = penguins) datasummary(flipper_length_mm + body_mass_g ~ mean * sex * island, data = penguins) datasummary(flipper_length_mm + body_mass_g ~ mean * sex * island, data = penguins, sparse_header = FALSE)"},{"path":"https://vincentarelbundock.github.io/modelsummary/dev/articles/datasummary.html","id":"renaming-with","dir":"Articles","previous_headings":"datasummary","what":"Renaming with =","title":"`datasummary`: Crosstabs, frequencies, correlations, balance (a.k.a. ","text":"Personally, prefer rename variables values drawing tables, using backticks variable names include whitespace. example, However, thanks tables package, datasummary offers two additional mechanisms rename. First, can wrap term parentheses use equal = sign: (NewName=OldName): Second, can use Heading() function: Heading function also nearData argument can useful cases rows nested others . Compare last row two tables:","code":"tmp <- penguins %>% select(`Flipper length (mm)` = flipper_length_mm, `Body mass (g)` = body_mass_g) datasummary(`Flipper length (mm)` + `Body mass (g)` ~ Mean + SD, data = tmp) datasummary((`Flipper length (mm)` = flipper_length_mm) + (`Body mass (g)` = body_mass_g) ~ island * ((Avg. = Mean) + (Std.Dev. = SD)), data = penguins) datasummary(Heading(\"Flipper length (mm)\") * flipper_length_mm + Heading(\"Body mass (g)\") * body_mass_g ~ island * (Mean + SD), data = penguins) datasummary(sex * (flipper_length_mm + bill_length_mm) + Heading(\"Body mass (g)\") * body_mass_g ~ Mean + SD, data = penguins) datasummary(sex * (flipper_length_mm + bill_length_mm) + Heading(\"Body mass (g)\", nearData=FALSE) * body_mass_g ~ Mean + SD, data = penguins)"},{"path":"https://vincentarelbundock.github.io/modelsummary/dev/articles/datasummary.html","id":"counts-and-percentages","dir":"Articles","previous_headings":"datasummary","what":"Counts and Percentages","title":"`datasummary`: Crosstabs, frequencies, correlations, balance (a.k.a. ","text":"tables package allows datasummary use neat tricks produce frequency tables: Add N right-hand side equation. Add Percent() right-hand side calculate percentage observations cell. Add 1 left-hand side include row total number observations: Note Percent() function accepts denom argument determine percentages calculated row column-wise, take account cells.","code":"datasummary(species * sex + 1 ~ N + Percent(), data = penguins)"},{"path":"https://vincentarelbundock.github.io/modelsummary/dev/articles/datasummary.html","id":"weighted-percentages","dir":"Articles","previous_headings":"datasummary","what":"Weighted percentages","title":"`datasummary`: Crosstabs, frequencies, correlations, balance (a.k.a. ","text":"Percent() pseudo-function also accepts fn argument, must function accepts two vectors: x values current cell, y values whole dataset. default fn : code takes number elements cell length(x) divides number total elements length(y). Now, let’s say want display percentages weighted one variables dataset. can often useful survey weights, example. , use arbitrary column weights called flipper_length_mm: cell now sum weights cell, divided total sum weights column.","code":"datasummary(species * sex + 1 ~ N + Percent(fn = function(x, y) 100 * length(x) / length(y)), output = \"markdown\", data = penguins) wtpct <- function(x, y) sum(x, na.rm = TRUE) / sum(y, na.rm = TRUE) * 100 datasummary(species * sex + 1 ~ N + flipper_length_mm * Percent(fn = wtpct), output = \"markdown\", data = penguins)"},{"path":"https://vincentarelbundock.github.io/modelsummary/dev/articles/datasummary.html","id":"custom-percentages","dir":"Articles","previous_headings":"datasummary","what":"Custom percentages","title":"`datasummary`: Crosstabs, frequencies, correlations, balance (a.k.a. ","text":"another simple illustration Percent function mechanism action, combine counts percentages simple nice label:","code":"dat <- mtcars dat$cyl <- as.factor(dat$cyl) fn <- function(x, y) { out <- sprintf( \"%s (%.1f%%)\", length(x), length(x) / length(y) * 100) } datasummary( cyl ~ Percent(fn = fn), data = dat)"},{"path":"https://vincentarelbundock.github.io/modelsummary/dev/articles/datasummary.html","id":"factor","dir":"Articles","previous_headings":"datasummary","what":"Factor","title":"`datasummary`: Crosstabs, frequencies, correlations, balance (a.k.a. ","text":"* nesting operator used works automatically factor, character, logical variables. Sometimes, convenient use types variables, binary numeric variables. case, can wrap variable name inside call Factor(). allows us treat variable factor, without modify original data. example, mtcars data, binary numeric variable call . nest statistics within categories typing:","code":"datasummary(mpg + hp ~ Factor(am) * (mean + sd), data = mtcars)"},{"path":"https://vincentarelbundock.github.io/modelsummary/dev/articles/datasummary.html","id":"arguments-na-rmtrue","dir":"Articles","previous_headings":"datasummary","what":"Arguments: na.rm=TRUE","title":"`datasummary`: Crosstabs, frequencies, correlations, balance (a.k.a. ","text":"can pass argument summary function including call Arguments(). instance, missing values flipper_length_mm variable penguins dataset. Therefore, standard mean function produce result, default argument na.rm=FALSE. can change calling: Notice empty cell (NA) normal mean function, mean call Arguments(na.rm=TRUE) produced numeric result. can pass arguments multiple functions using parentheses: Note shortcut functions modelsummary supplies use na.rm=TRUE default, can use directly without arguments, even missing values:","code":"datasummary(flipper_length_mm ~ mean + mean*Arguments(na.rm=TRUE), data = penguins) datasummary(flipper_length_mm ~ (mean + sd) * Arguments(na.rm=TRUE), data = penguins) datasummary(flipper_length_mm ~ Mean + Var + P75 + Range, data = penguins)"},{"path":"https://vincentarelbundock.github.io/modelsummary/dev/articles/datasummary.html","id":"arguments-weighted-mean","dir":"Articles","previous_headings":"datasummary","what":"Arguments: Weighted Mean","title":"`datasummary`: Crosstabs, frequencies, correlations, balance (a.k.a. ","text":"can use Arguments mechanism various things, calculating weighted means: produces results : different results :","code":"newdata <- data.frame( x = rnorm(20), w = rnorm(20), y = rnorm(20)) datasummary(x + y ~ weighted.mean * Arguments(w = w), data = newdata, output = \"markdown\") weighted.mean(newdata$x, newdata$w) ## [1] -1.038901 weighted.mean(newdata$y, newdata$w) ## [1] -0.2727611 mean(newdata$x) ## [1] 0.03326908 mean(newdata$y) ## [1] -0.159613"},{"path":"https://vincentarelbundock.github.io/modelsummary/dev/articles/datasummary.html","id":"empty-cells","dir":"Articles","previous_headings":"datasummary","what":"Empty cells","title":"`datasummary`: Crosstabs, frequencies, correlations, balance (a.k.a. ","text":"Sometimes, nest much dataset large/diverse enough, end empty cells. case, add *DropEmpty() formula:","code":"datasummary(island * species * body_mass_g ~ sex * (Mean + SD), data = penguins) datasummary(island * species * body_mass_g ~ sex * (Mean + SD) * DropEmpty(), data = penguins)"},{"path":"https://vincentarelbundock.github.io/modelsummary/dev/articles/datasummary.html","id":"logical-subsets","dir":"Articles","previous_headings":"datasummary","what":"Logical subsets","title":"`datasummary`: Crosstabs, frequencies, correlations, balance (a.k.a. ","text":"Cool stuff possible logical subsets: See tables package documentation details examples.","code":"datasummary((bill_length_mm > 44.5) + (bill_length_mm <= 44.5) ~ Mean * flipper_length_mm, data = penguins)"},{"path":"https://vincentarelbundock.github.io/modelsummary/dev/articles/datasummary.html","id":"output","dir":"Articles","previous_headings":"","what":"output","title":"`datasummary`: Crosstabs, frequencies, correlations, balance (a.k.a. ","text":"functions datasummary_* family accept output argument. Tables can saved several file formats: can returned human-readable data.frames, markdown, html, LaTeX code console: datasummary can return objects compatible gt, kableExtra, flextable, huxtable, DT table creation customization packages: Please note hierarchical “nested” column labels available output formats: kableExtra, gt, html, rtf, LaTeX. saving tables formats, nested labels combined “flat” header.","code":"f <- flipper_length_mm ~ island * (mean + sd) datasummary(f, data = penguins, output = 'table.html') datasummary(f, data = penguins, output = 'table.tex') datasummary(f, data = penguins, output = 'table.docx') datasummary(f, data = penguins, output = 'table.pptx') datasummary(f, data = penguins, output = 'table.md') datasummary(f, data = penguins, output = 'table.rtf') datasummary(f, data = penguins, output = 'table.jpg') datasummary(f, data = penguins, output = 'table.png') datasummary(f, data = penguins, output = 'data.frame') datasummary(f, data = penguins, output = 'markdown') datasummary(f, data = penguins, output = 'html') datasummary(f, data = penguins, output = 'latex') datasummary(f, data = penguins, output = 'gt') datasummary(f, data = penguins, output = 'kableExtra') datasummary(f, data = penguins, output = 'flextable') datasummary(f, data = penguins, output = 'huxtable') datasummary(f, data = penguins, output = 'DT')"},{"path":"https://vincentarelbundock.github.io/modelsummary/dev/articles/datasummary.html","id":"fmt","dir":"Articles","previous_headings":"","what":"fmt","title":"`datasummary`: Crosstabs, frequencies, correlations, balance (a.k.a. ","text":"fmt argument allows us set printing format numeric values. accepts single number representing number digits period, string passed sprintf function. instance, setting fmt=\"%.4f\" keep 4 digits dot (see ?sprintf options): can set formatting term--term basis using Arguments function used handle missing values previous section. shortcut functions ship modelsummary (e.g., Mean, SD, Median, P25) include fmt argument: want datasummary format numbers, want keep numerical values instead formatted strings, set fmt=NULL. can useful post-processing tables packages like gt, allow us transform cells based numerical content (gt table omitted PDF output): Please note N() function supplied upstream tables package, fmt argument. Fortunately, easy override built-function use custom formatting:","code":"datasummary(flipper_length_mm ~ Mean + SD, fmt = 4, data = penguins) datasummary(flipper_length_mm ~ Mean * Arguments(fmt = \"%.4f\") + SD * Arguments(fmt = \"%.1f\"), data = penguins) library(gt) datasummary(All(mtcars) ~ Mean + SD, data = mtcars, fmt = NULL, output = 'gt') %>% tab_style(style = cell_fill(color = \"pink\"), locations = cells_body(rows = Mean > 10, columns = 2)) tmp <- data.frame(X = sample(letters[1:3], 1e6, replace = TRUE)) N <- \\(x) format(length(x), big.mark = \",\") datasummary(X ~ N, data = tmp)"},{"path":"https://vincentarelbundock.github.io/modelsummary/dev/articles/datasummary.html","id":"title-notes","dir":"Articles","previous_headings":"","what":"title, notes","title":"`datasummary`: Crosstabs, frequencies, correlations, balance (a.k.a. ","text":"datasummary includes title notes arguments modelsummary: Statistics famous Palmer Penguins.","code":"datasummary(All(penguins) ~ Mean + SD, data = penguins, title = 'Statistics about the famous Palmer Penguins.', notes = c('A note at the bottom of the table.'))"},{"path":"https://vincentarelbundock.github.io/modelsummary/dev/articles/datasummary.html","id":"align","dir":"Articles","previous_headings":"","what":"align","title":"`datasummary`: Crosstabs, frequencies, correlations, balance (a.k.a. ","text":"can align columns using align argument. align string length equal number columns, includes letters “l”, “c”, “r”:","code":"datasummary(flipper_length_mm + bill_length_mm ~ Mean + SD + Range, data = penguins, align = 'lrcl')"},{"path":"https://vincentarelbundock.github.io/modelsummary/dev/articles/datasummary.html","id":"add_rows","dir":"Articles","previous_headings":"","what":"add_rows","title":"`datasummary`: Crosstabs, frequencies, correlations, balance (a.k.a. ","text":"","code":"new_rows <- data.frame('Does', 2, 'plus', 2, 'equals', 5, '?') datasummary(flipper_length_mm + body_mass_g ~ species * (Mean + SD), data = penguins, add_rows = new_rows)"},{"path":"https://vincentarelbundock.github.io/modelsummary/dev/articles/datasummary.html","id":"add_columns","dir":"Articles","previous_headings":"","what":"add_columns","title":"`datasummary`: Crosstabs, frequencies, correlations, balance (a.k.a. ","text":"","code":"new_cols <- data.frame('New Stat' = runif(2)) datasummary(flipper_length_mm + body_mass_g ~ species * (Mean + SD), data = penguins, add_columns = new_cols)"},{"path":"https://vincentarelbundock.github.io/modelsummary/dev/articles/datasummary.html","id":"histograms","dir":"Articles","previous_headings":"","what":"Histograms","title":"`datasummary`: Crosstabs, frequencies, correlations, balance (a.k.a. ","text":"datasummary family functions allow users display -line spark-style histograms describe distribution variables. example, datasummary_skim produces histogram: histograms table actually SVG image, produced kableExtra package. reason, histogram appear users use different output backend, gt, flextable, huxtable. datasummary function incredibly flexible, include histogram option default. simple example one can customize output datasummary. proceed 4 steps: Normalize variables store list Create table datasummary, making sure include 2 “empty” columns. example, use simple function called emptycol fill columns empty strings. Add histograms boxplots using functions kableExtra package. want simpler solution, can try Histogram function works datasummary automatically comes bundled modelsummary. downside function uses Unicode characters create histogram. kind histogram may display well certain typefaces operating systems (Windows!).","code":"tmp <- mtcars[, c(\"mpg\", \"hp\")] datasummary_skim(tmp) ## Warning: The histogram argument is only supported for (a) output types \"default\", \"html\", or \"kableExtra\"; (b) ## writing to file paths with extensions \".html\", \".jpg\", or \".png\"; and (c) Rmarkdown or knitr documents ## compiled to PDF or HTML. Use `histogram=FALSE` to silence this warning. tmp <- mtcars[, c(\"mpg\", \"hp\")] # create a list with individual variables # remove missing and rescale tmp_list <- lapply(tmp, na.omit) tmp_list <- lapply(tmp_list, scale) # create a table with `datasummary` # add a histogram with column_spec and spec_hist # add a boxplot with colun_spec and spec_box emptycol = function(x) \" \" datasummary(mpg + hp ~ Mean + SD + Heading(\"Boxplot\") * emptycol + Heading(\"Histogram\") * emptycol, output = \"kableExtra\", data = tmp) %>% kableExtra::column_spec(column = 4, image = spec_boxplot(tmp_list)) %>% kableExtra::column_spec(column = 5, image = spec_hist(tmp_list)) datasummary(mpg + hp ~ Mean + SD + Histogram, data = tmp)"},{"path":"https://vincentarelbundock.github.io/modelsummary/dev/articles/datasummary.html","id":"missing-values","dir":"Articles","previous_headings":"","what":"Missing values","title":"`datasummary`: Crosstabs, frequencies, correlations, balance (a.k.a. ","text":"least 3 distinct issues can arise related missing values.","code":""},{"path":"https://vincentarelbundock.github.io/modelsummary/dev/articles/datasummary.html","id":"functions-and-na-rm","dir":"Articles","previous_headings":"Missing values","what":"Functions and na.rm","title":"`datasummary`: Crosstabs, frequencies, correlations, balance (a.k.a. ","text":"empty cell can appear table statistical function returns NA instead numeric value. cases, : Make sure statistical function (e.g., mean sd) uses na.rm=TRUE default Use Arguments strategy set na.rm=TRUE (see Arguments section vignette). Use convenience function supplied modelsummary, na.rm TRUE default: Mean, SD, P25, etc.","code":""},{"path":"https://vincentarelbundock.github.io/modelsummary/dev/articles/datasummary.html","id":"empty-crosstab-cells","dir":"Articles","previous_headings":"Missing values","what":"Empty crosstab cells","title":"`datasummary`: Crosstabs, frequencies, correlations, balance (a.k.a. ","text":"empty cell can appear table crosstab deeply nested, observations given combination covariates. cases, can use * DropEmpty pseudo-function. See “Empty cells” section vignette examples.","code":""},{"path":"https://vincentarelbundock.github.io/modelsummary/dev/articles/datasummary.html","id":"factors","dir":"Articles","previous_headings":"Missing values","what":"Factors","title":"`datasummary`: Crosstabs, frequencies, correlations, balance (a.k.a. ","text":"default, factor function R assign distinct factor level missing values: factor function’s exclude argument set NA default. ensure NAs appear table, make sure set exclude=NULL create factor. Internally, datasummary_balance datasummary_crosstab functions convert logical character variables factor exclude=NULL argument. means NAs appear table distinct rows/columns. want NAs appear table, convert factors ahead time. example:","code":"mycars <- mtcars[, c(\"cyl\", \"mpg\", \"hp\", \"vs\")] mycars$cyl[c(1, 3, 6, 8)] <- NA mycars$cyl_nona <- factor(mycars$cyl) mycars$cyl_na <- factor(mycars$cyl, exclude = NULL) datasummary_crosstab(cyl_nona ~ vs, data = mycars) datasummary_crosstab(cyl_na ~ vs, data = mycars)"},{"path":"https://vincentarelbundock.github.io/modelsummary/dev/articles/datasummary.html","id":"appearance","dir":"Articles","previous_headings":"","what":"Appearance","title":"`datasummary`: Crosstabs, frequencies, correlations, balance (a.k.a. ","text":"Appearance Vignette saw customize tables produced modelsummary function. customization possibilities also available functions datasummary_* family functions. Indeed, can customize tables produced datasummary using functions provided gt, kableExtra, flextable, huxtable, DT. instance, customize tables using kableExtra, can : customize table using gt package, can: Flipper lengths (mm) famous penguins Palmer Station, Antarctica.","code":"# Convert to `data.frame` to circumvent a `tibbles`-related bug in `All()` # https://github.com/vincentarelbundock/modelsummary/issues/395 penguins <- data.frame(penguins) datasummary(All(penguins) ~ sex * (Mean + SD), data = penguins, output = 'kableExtra') %>% kableExtra::row_spec(3, background = 'cyan', color = 'red') library(gt) adelie <- function(x) web_image('https://user-images.githubusercontent.com/987057/85402702-20b1d280-b52a-11ea-9950-f3a03133fd45.png', height = 100) gentoo <- function(x) web_image('https://user-images.githubusercontent.com/987057/85402718-27404a00-b52a-11ea-9ad3-dd7562f6438d.png', height = 100) chinstrap <- function(x) web_image('https://user-images.githubusercontent.com/987057/85402708-23acc300-b52a-11ea-9a77-de360a0d1f7d.png', height = 100) cap <- 'Flipper lengths (mm) of the famous penguins of Palmer Station, Antarctica.' f <- (`Species` = species) ~ (` ` = flipper_length_mm) * (`Distribution` = Histogram) + flipper_length_mm * sex * ((`Avg.` = Mean)*Arguments(fmt='%.0f') + (`Std. Dev.` = SD)*Arguments(fmt='%.1f')) datasummary(f, data = penguins, output = 'gt', title = cap, notes = 'Artwork by @allison_horst', sparse_header = TRUE) %>% text_transform(locations = cells_body(columns = 1, rows = 1), fn = adelie) %>% text_transform(locations = cells_body(columns = 1, rows = 2), fn = chinstrap) %>% text_transform(locations = cells_body(columns = 1, rows = 3), fn = gentoo) %>% tab_style(style = list(cell_text(color = \"#FF6700\", size = 'x-large')), locations = cells_body(rows = 1)) %>% tab_style(style = list(cell_text(color = \"#CD51D1\", size = 'x-large')), locations = cells_body(rows = 2)) %>% tab_style(style = list(cell_text(color = \"#007377\", size = 'x-large')), locations = cells_body(rows = 3)) %>% tab_options(table_body.hlines.width = 0, table.border.top.width = 0, table.border.bottom.width = 0) %>% cols_align('center', columns = 3:6)"},{"path":"https://vincentarelbundock.github.io/modelsummary/dev/articles/modelplot.html","id":"rename-reorder-subset","dir":"Articles","previous_headings":"","what":"Rename, reorder, subset","title":"`modelplot`: Plot model coefficients with confidence intervals","text":"modelplot uses mechanics modelsummary rename, reorder, subset estimates. First, can use coef_omit argument. omit coefficient matches string regular expression. omit intercept, example, can type: Second, can use coef_map argument. coef_map named character vector, names correspond original term names, values correspond names want assign. variable included coef_map excluded. Variables also drawn order coef_map:","code":"modelplot(mod, coef_omit = 'Interc') cm <- c('speciesChinstrap' = 'Chinstrap', 'speciesGentoo' = 'Gentoo', 'flipper_length_cm' = 'Flipper length (cm)') modelplot(mod, coef_map = cm)"},{"path":"https://vincentarelbundock.github.io/modelsummary/dev/articles/modelplot.html","id":"several-models","dir":"Articles","previous_headings":"","what":"Several models","title":"`modelplot`: Plot model coefficients with confidence intervals","text":"main modelsummary functions allows create table results several models side--side, storing (potentially named) list: modelplot works way: Instead displaying results “dodged” side--side lines, can also use facet:","code":"models <- list( \"Small model\" = lm(bill_length_cm ~ flipper_length_cm, data = dat), \"Medium model\" = lm(bill_length_cm ~ flipper_length_cm + body_mass_g, data = dat), \"Large model\" = lm(bill_length_cm ~ flipper_length_cm + body_mass_g + species, data = dat)) modelsummary(models, statistic = 'conf.int') modelplot(models, coef_omit = 'Interc') modelplot(models, facet = TRUE)"},{"path":"https://vincentarelbundock.github.io/modelsummary/dev/articles/modelplot.html","id":"customizing-plots","dir":"Articles","previous_headings":"","what":"Customizing plots","title":"`modelplot`: Plot model coefficients with confidence intervals","text":"graphs produced modelplot simple ggplot2 objects. can thus post-process using normal suite functions available objects type. , change axis labels, add title caption, use color scheme inspired Wes Anderson’s Darjeeling Limited: ggplot2, visual choices must made calling “geom”, rather post-processing functions. instance, size, color, fatten, linetype arguments must specified inside geom_pointrange function take effect. modelplot pass unknown argument geom_pointrange, users can simply call:","code":"library(wesanderson) library(ggplot2) modelplot(models) + labs(x = 'Coefficients', y = 'Term names', title = 'Linear regression models of \"Bill Length (cm)\"', caption = \"Data source: Gorman, Williams & Fraser (2014), packaged for R by @apreshill and @allison_horst\") + scale_color_manual(values = wes_palette('Darjeeling1')) modelplot(mod, size = 1, fatten = .7, color = 'darkgreen', linetype = 'dotted') + theme_classic()"},{"path":"https://vincentarelbundock.github.io/modelsummary/dev/articles/modelplot.html","id":"conditional-colors-and-shape","dir":"Articles","previous_headings":"Customizing plots","what":"Conditional colors and shape","title":"`modelplot`: Plot model coefficients with confidence intervals","text":"Note: section requires version modelsummary greater 1.2.0 development version. nice Stack Overflow answer, Allan Cameron shows can use aes() function ggplot2 add conditional aesthetics. example, want display statistically significant coefficients different color:","code":"library(ggplot2) mod <- lm(hp ~ factor(gear) + factor(cyl), data = mtcars) modelplot(mod, coef_rename = TRUE) + aes(color = ifelse(p.value < 0.001, \"Significant\", \"Not significant\")) + scale_color_manual(values = c(\"grey\", \"black\"))"},{"path":"https://vincentarelbundock.github.io/modelsummary/dev/articles/modelplot.html","id":"example-using-facets-to-compare-models","dir":"Articles","previous_headings":"Customizing plots","what":"Example: Using facets to compare models","title":"`modelplot`: Plot model coefficients with confidence intervals","text":"Customizing plots ggplot2 makes modelplot flexible. example, imagine want compare coefficients three models different dependent variables. First, load packages estimate models: , use dvnames function rename list names matching dependent variable model: calling modelplot draw=FALSE argument, see raw data used draw plot. , see model column: Finally, use model column identifier ggplot2’s facet_grid command display models side side:","code":"library(ggplot2) library(modelsummary) models <- list( lm(vs ~ carb + mpg + cyl, data = mtcars), lm(disp ~ carb + mpg + cyl, data = mtcars), lm(hp ~ carb + mpg + cyl, data = mtcars)) models <- dvnames(models) modelplot(models, draw = FALSE) ## term model estimate std.error conf.low conf.high ## 1 (Intercept) vs 2.41742511 0.67622094 1.03224931 3.80260091 ## 5 (Intercept) disp 112.57276339 114.86315481 -122.71374324 347.85927003 ## 9 (Intercept) hp -10.56116383 68.75946117 -151.40853516 130.28620751 ## 2 carb vs -0.06945116 0.03943402 -0.15022810 0.01132577 ## 6 carb disp -12.30144724 6.69827859 -26.02224894 1.41935446 ## 10 carb hp 17.75593287 4.00972816 9.54237706 25.96948867 ## 3 mpg vs -0.01513960 0.01716410 -0.05029868 0.02001947 ## 7 mpg disp -7.14964651 2.91550156 -13.12178072 -1.17751230 ## 11 mpg hp -1.00486469 1.74527956 -4.57990780 2.57017842 ## 4 cyl vs -0.23926135 0.05687969 -0.35577411 -0.12274859 ## 8 cyl disp 47.90105842 9.66160634 28.11015499 67.69196184 ## 12 cyl hp 20.60581208 5.78363747 8.75856779 32.45305638 ## p.value ## 1 1.296718e-03 ## 5 3.354494e-01 ## 9 8.790301e-01 ## 2 8.912324e-02 ## 6 7.692105e-02 ## 10 1.320972e-04 ## 3 3.852593e-01 ## 7 2.068858e-02 ## 11 5.693755e-01 ## 4 2.410214e-04 ## 8 3.111898e-05 ## 12 1.338485e-03 modelplot(models, color = \"black\") + facet_grid(~model)"},{"path":"https://vincentarelbundock.github.io/modelsummary/dev/articles/modelplot.html","id":"confidence-intervals-change-or-omit","dir":"Articles","previous_headings":"","what":"Confidence intervals: change or omit","title":"`modelplot`: Plot model coefficients with confidence intervals","text":"can change \\(\\alpha\\) level confidence intervals changing conf_level argument:","code":"modelplot(mod, conf_level = .99) modelplot(mod, conf_level = NULL)"},{"path":"https://vincentarelbundock.github.io/modelsummary/dev/articles/modelplot.html","id":"background-annotations","dir":"Articles","previous_headings":"","what":"Background annotations","title":"`modelplot`: Plot model coefficients with confidence intervals","text":"Sometimes, want display annotations plot, like draw annotations behind geom_pointrange displays estimates. Since modelplot draws geom_pointrange automatically, ggplot2 annotation add plot using + added top existing ones. add annotations background, can pass list ggplot2 “geoms”:","code":"library(ggplot2) b <- list(geom_vline(xintercept = 0, color = 'orange'), annotate(\"rect\", alpha = .1, xmin = -.5, xmax = .5, ymin = -Inf, ymax = Inf), geom_point(aes(y = term, x = estimate), alpha = .3, size = 10, color = 'red')) modelplot(mod, background = b)"},{"path":"https://vincentarelbundock.github.io/modelsummary/dev/articles/modelplot.html","id":"raw-data-more-customization","dir":"Articles","previous_headings":"","what":"Raw data & More customization","title":"`modelplot`: Plot model coefficients with confidence intervals","text":"like customize plots even modelplot allows, can obtain raw data used draw plots setting draw=FALSE: allows users use external tools powerful ggdist package. example, use purrr::map_dfr function call modelplot several times different confidence levels. , draw plot different confidence intervals drawn different thicknesses:","code":"modelplot(models, draw = FALSE) ## term model estimate std.error conf.low conf.high ## 1 (Intercept) vs 2.41742511 0.67622094 1.03224931 3.80260091 ## 5 (Intercept) disp 112.57276339 114.86315481 -122.71374324 347.85927003 ## 9 (Intercept) hp -10.56116383 68.75946117 -151.40853516 130.28620751 ## 2 carb vs -0.06945116 0.03943402 -0.15022810 0.01132577 ## 6 carb disp -12.30144724 6.69827859 -26.02224894 1.41935446 ## 10 carb hp 17.75593287 4.00972816 9.54237706 25.96948867 ## 3 mpg vs -0.01513960 0.01716410 -0.05029868 0.02001947 ## 7 mpg disp -7.14964651 2.91550156 -13.12178072 -1.17751230 ## 11 mpg hp -1.00486469 1.74527956 -4.57990780 2.57017842 ## 4 cyl vs -0.23926135 0.05687969 -0.35577411 -0.12274859 ## 8 cyl disp 47.90105842 9.66160634 28.11015499 67.69196184 ## 12 cyl hp 20.60581208 5.78363747 8.75856779 32.45305638 ## p.value ## 1 1.296718e-03 ## 5 3.354494e-01 ## 9 8.790301e-01 ## 2 8.912324e-02 ## 6 7.692105e-02 ## 10 1.320972e-04 ## 3 3.852593e-01 ## 7 2.068858e-02 ## 11 5.693755e-01 ## 4 2.410214e-04 ## 8 3.111898e-05 ## 12 1.338485e-03 library(tidyverse) library(modelsummary) library(ggdist) # fit models <- list( lm(mpg ~ am, mtcars), lm(mpg ~ am + cyl, mtcars)) # summarize dat <- map_dfr(c(.8, .9, .99), function(x) { modelplot(models, conf_level = x, draw = FALSE) %>% mutate(.width = x) }) # plot ggplot(dat, aes( y = term, x = estimate, xmin = conf.low, xmax = conf.high, color = model)) + ggdist::geom_pointinterval( position = \"dodge\", interval_size_range = c(1, 3), fatten_point = .1)"},{"path":"https://vincentarelbundock.github.io/modelsummary/dev/articles/modelsummary.html","id":"output-print-and-save","dir":"Articles","previous_headings":"","what":"output: print and save","title":"modelsummary: regression tables","text":"output argument determines type object returned modelsummary /file table written. want save table directly file, can type: want raw HTML, LaTeX, Markdown table, can type: customize appearance table using external tools like gt, kableExtra, flextable, huxtable, can type: Warning: file name supplied output argument, table written immediately file. want customize table post-processing external package, need choose different output format saving mechanism. Unfortunately, approach differs package package: gt: set output=\"gt\", post-process table, use gt::gtsave function. kableExtra: set output destination format (e.g., “latex”, “html”, “markdown”), post-process table, use kableExtra::save_kable function.","code":"modelsummary(models, output = \"table.docx\") modelsummary(models, output = \"table.html\") modelsummary(models, output = \"table.tex\") modelsummary(models, output = \"table.md\") modelsummary(models, output = \"table.txt\") modelsummary(models, output = \"table.png\") modelsummary(models, output = \"html\") modelsummary(models, output = \"latex\") modelsummary(models, output = \"markdown\") modelsummary(models, output = \"gt\") modelsummary(models, output = \"kableExtra\") modelsummary(models, output = \"flextable\") modelsummary(models, output = \"huxtable\")"},{"path":"https://vincentarelbundock.github.io/modelsummary/dev/articles/modelsummary.html","id":"fmt-round-and-format","dir":"Articles","previous_headings":"","what":"fmt: round and format","title":"modelsummary: regression tables","text":"fmt argument defines numeric values rounded presented table. argument accepts three types input: Integer: Number decimal digits User-supplied function: Accepts numeric vector returns character vector length. modelsummary function: fmt_decimal(), fmt_significant(), fmt_sprintf(), fmt_term(), fmt_statistic, fmt_identity() Examples: Custom formatting function big mark commas: many languages comma used decimal mark instead period. modelsummary respects global R OutDec option, can simply execute command tables adjusted automatically:","code":"mod <- lm(mpg ~ hp + drat + qsec, data = mtcars) # decimal digits modelsummary(mod, fmt = 3) # user-supplied function modelsummary(mod, fmt = function(x) round(x, 2)) # p values with different number of digits modelsummary(mod, fmt = fmt_decimal(1, 3), statistic = c(\"std.error\", \"p.value\")) # significant digits modelsummary(mod, fmt = fmt_significant(3)) # sprintf(): decimal digits modelsummary(mod, fmt = fmt_sprintf(\"%.5f\")) # sprintf(): scientific notation modelsummary(mod, fmt = fmt_sprintf(\"%.5e\")) # statistic-specific formatting modelsummary(mod, fmt = fmt_statistic(estimate = 4, conf.int = 1), statistic = \"conf.int\") # term-specific formatting modelsummary(mod, fmt = fmt_term(hp = 4, drat = 1, default = fmt_significant(2))) modelsummary(mod, fmt = NULL) modf <- lm(I(mpg * 100) ~ hp, mtcars) f <- function(x) formatC(x, digits = 2, big.mark = \",\", format = \"f\") modelsummary(modf, fmt = f, gof_map = NA) options(OutDec=\",\")"},{"path":"https://vincentarelbundock.github.io/modelsummary/dev/articles/modelsummary.html","id":"estimate","dir":"Articles","previous_headings":"","what":"estimate","title":"modelsummary: regression tables","text":"default, modelsummary prints coefficient estimate row. can customize changing estimate argument. example, produce table p values instead coefficient estimates: can also use glue string, using curly braces specify statistics want. example, displays estimate next confidence interval: Glue strings can also apply R functions estimates. However, since modelsummary rounds numbers transforms character default, must set fmt = NULL: can also use different estimates different models using vector strings:","code":"modelsummary(models, estimate = \"p.value\") modelsummary( models, fmt = 1, estimate = \"{estimate} [{conf.low}, {conf.high}]\", statistic = NULL, coef_omit = \"Intercept\") m <- glm(am ~ mpg, data = mtcars, family = binomial) modelsummary( m, fmt = NULL, estimate = \"{round(exp(estimate), 5)}\", statistic = \"{round(exp(estimate) * std.error, 3)}\") modelsummary( models, fmt = 1, estimate = c(\"estimate\", \"{estimate}{stars}\", \"{estimate} ({std.error})\", \"{estimate} ({std.error}){stars}\", \"{estimate} [{conf.low}, {conf.high}]\"), statistic = NULL, coef_omit = \"Intercept\")"},{"path":"https://vincentarelbundock.github.io/modelsummary/dev/articles/modelsummary.html","id":"statistic-se-t-p-ci-etc-","dir":"Articles","previous_headings":"","what":"statistic: SE, t, p, CI, etc.","title":"modelsummary: regression tables","text":"default, modelsummary prints coefficient’s standard error parentheses corresponding estimate. value uncertainty statistic determined statistic argument. statistic argument accepts column names produced get_estimates(model). example: can also display confidence intervals brackets setting statistic=\"conf.int\": Alternatively, can supply glue string get complicated results: can also display several different uncertainty estimates coefficient estimates using vector. example, Setting statistic=NULL omits statistics. can often useful , example, want display confidence intervals next coefficients:","code":"modelsummary(models, statistic = 'std.error') modelsummary(models, statistic = 'p.value') modelsummary(models, statistic = 'statistic') modelsummary(models, fmt = 1, statistic = 'conf.int', conf_level = .99) modelsummary(models, statistic = \"{std.error} ({p.value})\") modelsummary(models, gof_omit = \".*\", statistic = c(\"conf.int\", \"s.e. = {std.error}\", \"t = {statistic}\", \"p = {p.value}\")) modelsummary(models, gof_omit = \".*\", estimate = \"{estimate} [{conf.low}, {conf.high}]\", statistic = NULL)"},{"path":"https://vincentarelbundock.github.io/modelsummary/dev/articles/modelsummary.html","id":"vcov-robust-ses","dir":"Articles","previous_headings":"","what":"vcov: robust SEs","title":"modelsummary: regression tables","text":"can use clustered robust uncertainty estimates modifying vcov parameter. function accepts 5 different types input. can use string vector strings: variance-covariance matrices calculated using sandwich package. can pass arguments sandwich functions directly modelsummary function. instance, change number bootstrap replicates specify clustering variable call: can use one-sided formula list one-sided formulas use clustered standard errors: can specify function produces variance-covariance matrices: can supply list functions length model list: can supply list named variance-covariance matrices: can supply list named vectors:","code":"modelsummary(models, vcov = \"robust\") modelsummary(models, vcov = c(\"classical\", \"robust\", \"bootstrap\", \"stata\", \"HC4\")) modelsummary(mod, vcov = \"bootstrap\", R = 1000, cluster = \"country\") modelsummary(models, vcov = ~Region) library(sandwich) modelsummary(models, vcov = vcovHC) modelsummary(models, vcov = list(vcov, vcovHC, vcovHAC, vcovHC, vcov)) vcov_matrices <- lapply(models, vcovHC) modelsummary(models, vcov = vcov_matrices) vc <- list( `OLS 1` = c(`(Intercept)` = 2, Literacy = 3, Clergy = 4), `Poisson 1` = c(`(Intercept)` = 3, Literacy = -5, Commerce = 3), `OLS 2` = c(`(Intercept)` = 7, Literacy = -6, Clergy = 9), `Poisson 2` = c(`(Intercept)` = 4, Literacy = -7, Commerce = -9), `OLS 3` = c(`(Intercept)` = 1, Literacy = -5, Clergy = -2)) modelsummary(models, vcov = vc)"},{"path":"https://vincentarelbundock.github.io/modelsummary/dev/articles/modelsummary.html","id":"stars","dir":"Articles","previous_headings":"","what":"stars","title":"modelsummary: regression tables","text":"people like add “stars” model summary tables mark statistical significance. stars argument can take three types input: NULL omits stars special marks (default) TRUE uses default values: + p < 0.1, * p < 0.05, ** p < 0.01, *** p < 0.001 Named numeric vector custom stars. Whenever stars NULL, modelsummary adds note bottom table automatically. like add stars include note bottom table, can define display estimate manually using glue string, described estimate argument section documentation. Whenever stars string appears estimate statistic arguments, modelsummary assume want fine-grained control table, include note stars. want create stars description, can add custom notes notes argument.","code":"modelsummary(models) modelsummary(models, stars = TRUE) modelsummary(models, stars = c('+' = .1, '&' = .01)) modelsummary(models, estimate = \"{estimate}{stars}\", gof_omit = \".*\")"},{"path":"https://vincentarelbundock.github.io/modelsummary/dev/articles/modelsummary.html","id":"coef_omit","dir":"Articles","previous_headings":"","what":"coef_omit","title":"modelsummary: regression tables","text":"alternative mechanism subset coefficients use coef_omit argument, accepts vector integer regular expression. example, can omit first second coefficients follows: Negative indices determine coefficients keep: coef_omit string, fed grepl(x,perl=TRUE) detect variable names excluded table. Since coef_omit accepts regexes, can interesting things , specifying list variables modelsummary keep instead omit. , use negative lookahead. keep coefficients starting “Lit”, call: keep coefficients matching “y” substring: keep coefficients matching one two substrings:","code":"modelsummary(models, coef_omit = 1:2, gof_map = NA) modelsummary(models, coef_omit = c(-1, -2), gof_map = NA) modelsummary(models, coef_omit = \"Intercept|.*merce\", gof_map = NA) modelsummary(models, coef_omit = \"^(?!Lit)\", gof_map = NA) modelsummary(models, coef_omit = \"^(?!.*y)\", gof_map = NA) modelsummary(models, coef_omit = \"^(?!.*tercept|.*y)\", gof_map = NA)"},{"path":"https://vincentarelbundock.github.io/modelsummary/dev/articles/modelsummary.html","id":"coef_rename","dir":"Articles","previous_headings":"","what":"coef_rename","title":"modelsummary: regression tables","text":"modelsummary offers powerful innovative mechanisms rename, reorder, subset coefficients goodness--fit statistics. can rename coefficients using coef_rename argument. example, two models different explanatory variables, want variables name appear row, can : provide named character vector coef_rename, exact matches complete original term name replaced. complex modifications, can feed function returns named vector coef_rename argument. example, modelsummary ships function called coef_rename, executes common renaming tasks automatically. example also uses dvnames function extract name dependent variable model: course, can also define custom functions. instance, rename model interacted variables (e.g., “drat:mpg”), define custom rename_explanator function: Beware inadvertently replacing parts variable names! Making regex pattern specific possible (e.g., adding word boundaries) likely good idea. custom rename function also good place re-introduce replacement “:” “×” dealing interaction terms – modelsummary makes replacement coef_rename argument specified. Another possibility assign variable labels attributes data used fit model. , can automatically rename :","code":"x <- list(lm(hp ~ drat, mtcars), lm(hp ~ vs, mtcars)) modelsummary(x, coef_rename = c(\"drat\" = \"Explanator\", \"vs\" = \"Explanator\")) x <- list( lm(mpg ~ factor(cyl) + drat + disp, data = mtcars), lm(hp ~ factor(cyl) + drat + disp, data = mtcars) ) modelsummary(dvnames(x), coef_rename = coef_rename) y <- list( lm(hp ~ drat / mpg, mtcars), lm(hp ~ vs / mpg, mtcars) ) rename_explanator <- function(old_names) { new_names <- gsub(\"drat|vs\", \"Explanator\", old_names) setNames(new_names, old_names) } modelsummary(y, coef_rename = rename_explanator) datlab <- mtcars datlab$cyl <- factor(datlab$cyl) attr(datlab$cyl, \"label\") <- \"Cylinders\" attr(datlab$am, \"label\") <- \"Transmission\" modlab <- lm(mpg ~ cyl + am, data = datlab) modelsummary(modlab, coef_rename = TRUE)"},{"path":"https://vincentarelbundock.github.io/modelsummary/dev/articles/modelsummary.html","id":"coef_map-order-omit-rename","dir":"Articles","previous_headings":"","what":"coef_map: order, omit, rename","title":"modelsummary: regression tables","text":"coef_map argument named vector allows users rename, reorder, subset coefficient estimates. Values vector correspond “clean” variable name. Names vector correspond “raw” variable name. table sorted order terms presented coef_map. Coefficients included coef_map excluded table.","code":"cm <- c('Literacy' = 'Literacy (%)', 'Commerce' = 'Patents per capita', '(Intercept)' = 'Constant') modelsummary(models, coef_map = cm)"},{"path":"https://vincentarelbundock.github.io/modelsummary/dev/articles/modelsummary.html","id":"gof_omit-goodness-of-fit-and-model-characteristics","dir":"Articles","previous_headings":"","what":"gof_omit: goodness-of-fit and model characteristics","title":"modelsummary: regression tables","text":"gof_omit regular expression fed grepl(x,perl=TRUE) detect names statistics excluded table.","code":"modelsummary(models, gof_omit = 'DF|Deviance|R2|AIC|BIC')"},{"path":"https://vincentarelbundock.github.io/modelsummary/dev/articles/modelsummary.html","id":"gof_map","dir":"Articles","previous_headings":"","what":"gof_map","title":"modelsummary: regression tables","text":"gof_map argument can used rename, re-order, subset, format statistics displayed bottom section table (“goodness--fit”). first type values allowed character vector elements equal column names data.frame produced get_gof(model): powerful mechanism supply data.frame (tibble) gof_map argument. data.frame must include 3 columns: raw: string name column produced get_gof(model). clean: string “clean” name statistic want appear final table. fmt: string used round/format string question (e.g., \"%.3f\"). follows standards fmt argument ?modelsummary. can see example valid data frame typing modelsummary::gof_map. default data.frame modelsummary uses subset reorder goodness--fit statistics. can see, omit == TRUE quite number statistics. can include setting omit == FALSE: goodness--fit statistics printed table order gof_map data.frame. Notice subtle difference coef_map gof_map. one hand, coef_map works “white list”: coefficient explicitly entered omitted table. , gof_map works “black list”: statistics need explicitly marked omission. Another convenient way build gof_map argument use tribble function tibble package. example, insert special HTML code display superscript, use escape=FALSE argument:","code":"modelsummary(models, gof_map = c(\"nobs\", \"r.squared\")) gm <- modelsummary::gof_map gm$omit <- FALSE modelsummary(models, gof_map = gm) f <- function(x) format(round(x, 3), big.mark=\",\") gm <- list( list(\"raw\" = \"nobs\", \"clean\" = \"N\", \"fmt\" = f), list(\"raw\" = \"AIC\", \"clean\" = \"aic\", \"fmt\" = f)) modelsummary(models, gof_map = gm) gm <- tibble::tribble( ~raw, ~clean, ~fmt, \"nobs\", \"N\", 0, \"r.squared\", \"R2<\/sup>\", 2) modelsummary( models, statistic = NULL, gof_map = gm, escape = FALSE)"},{"path":"https://vincentarelbundock.github.io/modelsummary/dev/articles/modelsummary.html","id":"shape-pivot-groups-panels-and-stacks","dir":"Articles","previous_headings":"","what":"shape: pivot, groups, panels, and stacks","title":"modelsummary: regression tables","text":"section requires version 1.3.1 modelsummary. version available CRAN yet, can install development version following instructions website. shape argument accepts: formula determines structure table, can display “grouped” coefficients together (e.g., multivariate outcome mixed-effects models). strings “rbind” “rcollapse” stack multiple tables top present models distinct “panels”.","code":""},{"path":"https://vincentarelbundock.github.io/modelsummary/dev/articles/modelsummary.html","id":"formula","dir":"Articles","previous_headings":"shape: pivot, groups, panels, and stacks","what":"Formula","title":"modelsummary: regression tables","text":"left side formula represents rows right side represents columns. default formula term + statistic ~ model: can display statistics horizontally : order terms formula determines order headers table. shape partial matching try fill-incomplete formulas: models like multinomial logit GAMLSS produce “grouped” parameter estimates. display groups, can include group identifier shape formula. group identifier must one column names produced get_estimates(model). example, models produced nnet::multinom, group identifier called “response”: summarize results, can type: terms shape formula can course rearranged reshape table. example: version 1.0.1 package later, can combine term group identifier columns inserting interaction colon : instead + formula:","code":"m <- list( lm(mpg ~ hp, data = mtcars), lm(mpg ~ hp + drat, data = mtcars)) modelsummary(m, shape = term + statistic ~ model, gof_map = NA) modelsummary(m, shape = term ~ model + statistic, statistic = \"conf.int\", gof_map = NA) modelsummary(m, shape = term ~ statistic + model, statistic = \"conf.int\", gof_map = NA) modelsummary(m, shape = ~ statistic) library(nnet) dat_multinom <- mtcars dat_multinom$cyl <- sprintf(\"Cyl: %s\", dat_multinom$cyl) mod <- list( nnet::multinom(cyl ~ mpg, data = dat_multinom, trace = FALSE), nnet::multinom(cyl ~ mpg + drat, data = dat_multinom, trace = FALSE)) get_estimates(mod[[1]]) #> term estimate std.error conf.level conf.low conf.high statistic #> 1 (Intercept) 47.252432 34.975171 0.95 -24.390958 118.89582104 1.351028 #> 2 mpg -2.205418 1.637963 0.95 -5.560632 1.14979649 -1.346440 #> 3 (Intercept) 72.440246 37.175162 0.95 -3.709622 148.59011342 1.948619 #> 4 mpg -3.579991 1.774693 0.95 -7.215284 0.05530216 -2.017246 #> df.error p.value response s.value group #> 1 28 0.18750348 Cyl: 6 2.4 #> 2 28 0.18896007 Cyl: 6 2.4 #> 3 28 0.06142602 Cyl: 8 4.0 #> 4 28 0.05334849 Cyl: 8 4.2 modelsummary(mod, shape = term + response ~ statistic) modelsummary(mod, shape = model + term ~ response) library(marginaleffects) mod <- glm(am ~ mpg + factor(cyl), family = binomial, data = mtcars) mfx <- marginaleffects(mod) modelsummary(mfx, shape = term + contrast ~ model) modelsummary(mfx, shape = term : contrast ~ model)"},{"path":"https://vincentarelbundock.github.io/modelsummary/dev/articles/modelsummary.html","id":"string-rbind-or-rcollapse-panels-of-models-in-stacked-regression-tables","dir":"Articles","previous_headings":"shape: pivot, groups, panels, and stacks","what":"String (“rbind” or “rcollapse”): Panels of models in stacked regression tables","title":"modelsummary: regression tables","text":"Note: code section requires version 1.3.0 development version modelsummary. See website installation instructions. section shows “stack/bind” multiple regression tables top one another, display results several models side--side top--bottom. example, imagine want present 4 different models, half estimated using different outcome variable. using modelsummary, store models list. using modelsummary shape=\"rbind\" shape=\"rbind\", store models list lists: Like modelsummary(), can can name models panels naming elements nested list:","code":"gm <- c(\"r.squared\", \"nobs\", \"rmse\") panels <- list( list( lm(mpg ~ 1, data = mtcars), lm(mpg ~ qsec, data = mtcars) ), list( lm(hp ~ 1, data = mtcars), lm(hp ~ qsec, data = mtcars) ) ) modelsummary( panels, shape = \"rbind\", gof_map = gm) panels <- list( \"Outcome: mpg\" = list( \"(I)\" = lm(mpg ~ 1, data = mtcars), \"(II)\" = lm(mpg ~ qsec, data = mtcars) ), \"Outcome: hp\" = list( \"(I)\" = lm(hp ~ 1, data = mtcars), \"(II)\" = lm(hp ~ qsec, data = mtcars) ) ) modelsummary( panels, shape = \"rbind\", gof_map = gm)"},{"path":"https://vincentarelbundock.github.io/modelsummary/dev/articles/modelsummary.html","id":"fixest","dir":"Articles","previous_headings":"shape: pivot, groups, panels, and stacks > String (“rbind” or “rcollapse”): Panels of models in stacked regression tables","what":"fixest","title":"modelsummary: regression tables","text":"fixest package offers powerful tools estimate multiple models using concise syntax. fixest functions also convenient return named lists models easy subset manipulate using standard R functions like grepl. example, introduce regressors stepwise fashion, estimate models different subsets data, can : can use typical extension systems add information, mean dependent variable:","code":"# estimate 4 models library(fixest) mod <- feols( c(hp, mpg) ~ csw(qsec, drat) | gear, data = mtcars) # select models with different outcome variables panels <- list( \"Miles per gallon\" = mod[grepl(\"mpg\", names(mod))], \"Horsepower\" = mod[grepl(\"hp\", names(mod))] ) modelsummary( panels, shape = \"rcollapse\", gof_omit = \"IC|R2\") glance_custom.fixest <- function(x, ...) { dv <- insight::get_response(x) dv <- sprintf(\"%.2f\", mean(dv, na.rm = TRUE)) data.table::data.table(`Mean of DV` = dv) } modelsummary( panels, shape = \"rcollapse\", gof_omit = \"IC|R2\") rm(\"glance_custom.fixest\")"},{"path":"https://vincentarelbundock.github.io/modelsummary/dev/articles/modelsummary.html","id":"align-column-alignment","dir":"Articles","previous_headings":"","what":"align: column alignment","title":"modelsummary: regression tables","text":"default, modelsummary align first column (coefficient names) left, center results columns. change default, can use align argument, accepts string length number columns: Users produce PDF documents using Rmarkdown LaTeX can also align values decimal dot using character “d” align argument: table produced code compile, users must include following code LaTeX preamble:","code":"modelsummary(models, align=\"lrrrrr\") modelsummary(models, align=\"lddddd\") \\usepackage{booktabs} \\usepackage{siunitx} \\newcolumntype{d}{S[input-symbols = ()]}"},{"path":"https://vincentarelbundock.github.io/modelsummary/dev/articles/modelsummary.html","id":"notes-footers","dir":"Articles","previous_headings":"","what":"notes: footers","title":"modelsummary: regression tables","text":"Add notes bottom table:","code":"modelsummary(models, notes = list('Text of the first note.', 'Text of the second note.'))"},{"path":"https://vincentarelbundock.github.io/modelsummary/dev/articles/modelsummary.html","id":"title-captions","dir":"Articles","previous_headings":"","what":"title: captions","title":"modelsummary: regression tables","text":"can add title table follows:","code":"modelsummary(models, title = 'This is a title for my table.')"},{"path":"https://vincentarelbundock.github.io/modelsummary/dev/articles/modelsummary.html","id":"add_rows","dir":"Articles","previous_headings":"","what":"add_rows","title":"modelsummary: regression tables","text":"Use add_rows argument add rows manually table. example, let’s say estimate two models factor variables want insert () empty line identify category reference, (b) customized information bottom table: create data.frame number columns summary table. , define “position” attribute specify new rows inserted table. Finally, pass data.frame add_rows argument:","code":"models <- list() models[['OLS']] <- lm(mpg ~ factor(cyl), mtcars) models[['Logit']] <- glm(am ~ factor(cyl), mtcars, family = binomial) library(tibble) rows <- tribble(~term, ~OLS, ~Logit, 'factor(cyl)4', '-', '-', 'Info', '???', 'XYZ') attr(rows, 'position') <- c(3, 9) modelsummary(models, add_rows = rows)"},{"path":"https://vincentarelbundock.github.io/modelsummary/dev/articles/modelsummary.html","id":"exponentiate","dir":"Articles","previous_headings":"","what":"exponentiate","title":"modelsummary: regression tables","text":"can exponentiate estimates using exponentiate argument: can also present exponentiated standard models side side using logical vector:","code":"mod_logit <- glm(am ~ mpg, data = mtcars, family = binomial) modelsummary(mod_logit, exponentiate = TRUE) mod_logit <- list(mod_logit, mod_logit) modelsummary(mod_logit, exponentiate = c(TRUE, FALSE))"},{"path":"https://vincentarelbundock.github.io/modelsummary/dev/articles/modelsummary.html","id":"ellipsis-additional-arguments","dir":"Articles","previous_headings":"","what":"... ellipsis: Additional arguments","title":"modelsummary: regression tables","text":"arguments passed user modelsummary function pushed forward two functions: default, additional arguments pushed forward parameters::parameters performance::performance. Users can also can also use different “backend” extract information model objects: broom package. setting modelsummary_get global option, tell modelsummary use easystats/parameters packages instead broom. packages, arguments available, metrics argument. Please refer package’s documentation details. default, additional arguments pushed forward kableExtra::kbl, users can use different table-making function setting output argument different value \"gt\", \"flextable\", \"huxtable\". See Appearance vignette examples. arguments passed supported functions thus automatically available directly modelsummary, modelplot, datasummary family functions.","code":""},{"path":"https://vincentarelbundock.github.io/modelsummary/dev/articles/modelsummary.html","id":"custom-appearance","dir":"Articles","previous_headings":"","what":"Custom appearance","title":"modelsummary: regression tables","text":"customize appearance tables, modelsummary supports five popular extremely powerful table-making packages: gt: https://gt.rstudio.com kableExtra: http://haozhu233.github.io/kableExtra huxtable: https://hughjonesd.github.io/huxtable/ flextable: https://davidgohel.github.io/flextable/ DT: https://rstudio.github.io/DT “customizing look tables” vignette shows examples 4 packages.","code":""},{"path":"https://vincentarelbundock.github.io/modelsummary/dev/articles/modelsummary.html","id":"supported-models","dir":"Articles","previous_headings":"","what":"Supported models","title":"modelsummary: regression tables","text":"modelsummary automatically supports models supported tidy function broom package parameters function parameters package. list supported models rapidly expanding. moment, covers following model classes: see given model supported, can fit , call function: function return valid output, can easily (really!!) add support. See next section tutorial. , may consider opening issue Github website broom package: https://github.com/tidymodels/broom/issues","code":"supported_models() #> [1] \"aareg\" \"acf\" #> [3] \"afex_aov\" \"AKP\" #> [5] \"anova\" \"Anova.mlm\" #> [7] \"anova.rms\" \"aov\" #> [9] \"aovlist\" \"Arima\" #> [11] \"averaging\" \"bamlss\" #> [13] \"bayesQR\" \"bcplm\" #> [15] \"befa\" \"betamfx\" #> [17] \"betaor\" \"betareg\" #> [19] \"BFBayesFactor\" \"bfsl\" #> [21] \"BGGM\" \"bifeAPEs\" #> [23] \"biglm\" \"binDesign\" #> [25] \"binWidth\" \"blavaan\" #> [27] \"blrm\" \"boot\" #> [29] \"bracl\" \"brmsfit\" #> [31] \"brmultinom\" \"btergm\" #> [33] \"cch\" \"censReg\" #> [35] \"cgam\" \"character\" #> [37] \"cld\" \"clm\" #> [39] \"clm2\" \"clmm\" #> [41] \"clmm2\" \"coeftest\" #> [43] \"comparisons\" \"confint.glht\" #> [45] \"confusionMatrix\" \"coxph\" #> [47] \"cpglmm\" \"crr\" #> [49] \"cv.glmnet\" \"data.frame\" #> [51] \"dbscan\" \"default\" #> [53] \"deltaMethod\" \"density\" #> [55] \"dep.effect\" \"DirichletRegModel\" #> [57] \"dist\" \"draws\" #> [59] \"drc\" \"durbinWatsonTest\" #> [61] \"emm_list\" \"emmeans\" #> [63] \"emmeans_summary\" \"emmGrid\" #> [65] \"epi.2by2\" \"ergm\" #> [67] \"fa\" \"fa.ci\" #> [69] \"factanal\" \"FAMD\" #> [71] \"felm\" \"fitdistr\" #> [73] \"fixest\" \"fixest_multi\" #> [75] \"flac\" \"flic\" #> [77] \"ftable\" \"gam\" #> [79] \"Gam\" \"gamlss\" #> [81] \"gamm\" \"garch\" #> [83] \"geeglm\" \"ggeffects\" #> [85] \"glht\" \"glimML\" #> [87] \"glm\" \"glmm\" #> [89] \"glmmTMB\" \"glmnet\" #> [91] \"glmrob\" \"glmRob\" #> [93] \"glmx\" \"gmm\" #> [95] \"hclust\" \"hdbscan\" #> [97] \"hglm\" \"hkmeans\" #> [99] \"HLfit\" \"htest\" #> [101] \"hurdle\" \"hypotheses\" #> [103] \"irlba\" \"ivFixed\" #> [105] \"ivprobit\" \"ivreg\" #> [107] \"kappa\" \"kde\" #> [109] \"Kendall\" \"kmeans\" #> [111] \"lavaan\" \"leveneTest\" #> [113] \"Line\" \"Lines\" #> [115] \"list\" \"lm\" #> [117] \"lm_robust\" \"lm.beta\" #> [119] \"lme\" \"lmodel2\" #> [121] \"lmrob\" \"lmRob\" #> [123] \"logical\" \"logistf\" #> [125] \"logitmfx\" \"logitor\" #> [127] \"lqm\" \"lqmm\" #> [129] \"lsmobj\" \"manova\" #> [131] \"maov\" \"map\" #> [133] \"marginaleffects\" \"marginalmeans\" #> [135] \"margins\" \"maxim\" #> [137] \"maxLik\" \"mblogit\" #> [139] \"Mclust\" \"mcmc\" #> [141] \"mcmc.list\" \"MCMCglmm\" #> [143] \"mcp1\" \"mcp2\" #> [145] \"med1way\" \"mediate\" #> [147] \"merMod\" \"merModList\" #> [149] \"meta_bma\" \"meta_fixed\" #> [151] \"meta_random\" \"metaplus\" #> [153] \"mfx\" \"mhurdle\" #> [155] \"mipo\" \"mira\" #> [157] \"mixed\" \"MixMod\" #> [159] \"mixor\" \"mjoint\" #> [161] \"mle\" \"mle2\" #> [163] \"mlm\" \"mlogit\" #> [165] \"mmrm\" \"mmrm_fit\" #> [167] \"mmrm_tmb\" \"model_fit\" #> [169] \"model_parameters\" \"muhaz\" #> [171] \"multinom\" \"mvord\" #> [173] \"negbin\" \"negbinirr\" #> [175] \"negbinmfx\" \"nestedLogit\" #> [177] \"nlrq\" \"nls\" #> [179] \"NULL\" \"numeric\" #> [181] \"omega\" \"onesampb\" #> [183] \"optim\" \"orcutt\" #> [185] \"osrt\" \"pairwise.htest\" #> [187] \"pam\" \"parameters_efa\" #> [189] \"parameters_pca\" \"PCA\" #> [191] \"pgmm\" \"plm\" #> [193] \"PMCMR\" \"poissonirr\" #> [195] \"poissonmfx\" \"poLCA\" #> [197] \"polr\" \"Polygon\" #> [199] \"Polygons\" \"power.htest\" #> [201] \"prcomp\" \"predictions\" #> [203] \"principal\" \"probitmfx\" #> [205] \"pvclust\" \"pyears\" #> [207] \"rcorr\" \"ref.grid\" #> [209] \"regsubsets\" \"ridgelm\" #> [211] \"rlm\" \"rlmerMod\" #> [213] \"rma\" \"robtab\" #> [215] \"roc\" \"rq\" #> [217] \"rqs\" \"rqss\" #> [219] \"sarlm\" \"Sarlm\" #> [221] \"scam\" \"selection\" #> [223] \"sem\" \"SemiParBIV\" #> [225] \"slopes\" \"SpatialLinesDataFrame\" #> [227] \"SpatialPolygons\" \"SpatialPolygonsDataFrame\" #> [229] \"spec\" \"speedglm\" #> [231] \"speedlm\" \"stanfit\" #> [233] \"stanmvreg\" \"stanreg\" #> [235] \"summary_emm\" \"summary.glht\" #> [237] \"summary.lm\" \"summary.plm\" #> [239] \"summaryDefault\" \"survdiff\" #> [241] \"survexp\" \"survfit\" #> [243] \"survreg\" \"svd\" #> [245] \"svyglm\" \"svyolr\" #> [247] \"svytable\" \"systemfit\" #> [249] \"t1way\" \"table\" #> [251] \"tobit\" \"trendPMCMR\" #> [253] \"trimcibt\" \"ts\" #> [255] \"TukeyHSD\" \"varest\" #> [257] \"vgam\" \"wbgee\" #> [259] \"wbm\" \"wmcpAKP\" #> [261] \"xyz\" \"yuen\" #> [263] \"zcpglm\" \"zerocount\" #> [265] \"zeroinfl\" \"zoo\" get_estimates(model)"},{"path":[]},{"path":"https://vincentarelbundock.github.io/modelsummary/dev/articles/modelsummary.html","id":"adding-new-models-part-i","dir":"Articles","previous_headings":"New models and custom statistics","what":"Adding new models (part I)","title":"modelsummary: regression tables","text":"simplest way summarize unsupported model create modelsummary_list object. approach super flexible, requires manual intervention, can become tedious need summarize many models. next section shows add formal support unsupported model type. modelsummary_list list two element conform broom package specification: tidy glance. tidy data.frame least three columns: term, estimate, std.error. glance data.frame single row, column displayed bottom table goodness--fit section. Finally, wrap two elements list assign modelsummary_list class:","code":"ti <- data.frame( term = c(\"coef1\", \"coef2\", \"coef3\"), estimate = 1:3, std.error = c(pi, exp(1), sqrt(2))) gl <- data.frame( stat1 = \"blah\", stat2 = \"blah blah\") mod <- list( tidy = ti, glance = gl) class(mod) <- \"modelsummary_list\" modelsummary(mod)"},{"path":"https://vincentarelbundock.github.io/modelsummary/dev/articles/modelsummary.html","id":"adding-new-models-part-ii","dir":"Articles","previous_headings":"New models and custom statistics","what":"Adding new models (part II)","title":"modelsummary: regression tables","text":"modelsummary relies two functions broom package extract model information: tidy glance. broom doesn’t support type model trying summarize, modelsummary won’t support box. Thankfully, extremely easy add support models using custom methods. example, models produced MCMCglmm package currently supported broom. add support, simply need create tidy glance method: Three important things note. First, methods named tidy.MCMCglmm glance.MCMCglmm model object trying summarize class MCMCglmm. can find class model running: class(model). Second, methods include ellipsis ... argument. Third, example used statistic = 'conf.int' argument. tidy method produces conf.low conf.high columns. cases, users define std.error column custom tidy methods, statistic argument need adjusted. create new tidy glance methods, please consider contributing broom rest community can benefit work: https://github.com/tidymodels/broom","code":"# load packages and data library(modelsummary) library(MCMCglmm) data(PlodiaPO) # add custom functions to extract estimates (tidy) and goodness-of-fit (glance) information tidy.MCMCglmm <- function(x, ...) { s <- summary(x, ...) ret <- data.frame( term = row.names(s$solutions), estimate = s$solutions[, 1], conf.low = s$solutions[, 2], conf.high = s$solutions[, 3]) ret } glance.MCMCglmm <- function(x, ...) { ret <- data.frame( dic = x$DIC, n = nrow(x$X)) ret } # estimate a simple model model <- MCMCglmm(PO ~ 1 + plate, random = ~ FSfamily, data = PlodiaPO, verbose=FALSE, pr=TRUE) # summarize the model modelsummary(model, statistic = 'conf.int')"},{"path":"https://vincentarelbundock.github.io/modelsummary/dev/articles/modelsummary.html","id":"adding-new-information-to-existing-models","dir":"Articles","previous_headings":"New models and custom statistics","what":"Adding new information to existing models","title":"modelsummary: regression tables","text":"Users may want include information made available default extractor function. example, models produced MASS::polr produce p values default, means use stars=TRUE argument modelsummary. However, possible extract information using lmtest::coeftest function. include custom information, define new glance_custom tidy_custom methods. begin estimating model MASS::polr: get_estimates function shows default extractor produce p.value column. result, setting stars=TRUE modelsummary produce error. know MASS::polr produces object class polr: extract (custom) information model class, thus define method called tidy_custom.polr returns data.frame two columns: term p.value: method defined, modelsummary can automatically extract p values models class, now work properly stars=TRUE:","code":"library(MASS) mod_ordinal <- polr(as.ordered(gear) ~ mpg + drat, data = mtcars) get_estimates(mod_ordinal) #> term estimate std.error conf.level conf.low conf.high statistic #> 1 3|4 13.962948761 4.04107300 0.95 5.6851860 22.2407116 3.45525774 #> 2 4|5 16.898937342 4.39497069 0.95 7.8962480 25.9016267 3.84506258 #> 3 mpg -0.008646682 0.09034201 0.95 -0.1916706 0.1708667 -0.09571053 #> 4 drat 3.949431923 1.30665144 0.95 1.6191505 6.8457246 3.02255965 #> df.error p.value component s.value group #> 1 28 0.0017706303 alpha 9.1 #> 2 28 0.0006356348 alpha 10.6 #> 3 28 0.9244322098 beta 0.1 #> 4 28 0.0053120619 beta 7.6 class(mod_ordinal) #> [1] \"polr\" tidy_custom.polr <- function(x, ...) { s <- lmtest::coeftest(x) out <- data.frame( term = row.names(s), p.value = s[, \"Pr(>|t|)\"]) out } modelsummary(mod_ordinal, stars = TRUE)"},{"path":"https://vincentarelbundock.github.io/modelsummary/dev/articles/modelsummary.html","id":"customizing-existing-models-part-i","dir":"Articles","previous_headings":"New models and custom statistics","what":"Customizing existing models (part I)","title":"modelsummary: regression tables","text":"Sometimes users want include information supplied functions. pretty easy way include extra information define new glance_custom tidy_custom methods. illustrate, estimate two linear regression models using lm function: R, lm function produces models class “lm”: Let’s say like print dependent variable model particular class. need define new method called glance_custom.lm. method return data.frame (tibble) 1 row, 1 column per piece information want display. example: Now, let’s customize body table. vcov argument already allows users customize uncertainty estimates. imagine want override coefficient estimates “lm” models. Easy! need define tidy_custom.lm method returns data.frame (tibble) one column called “term” one column called “estimate”. , ’ll substitute estimates /-pointing triangles represents signs: define glance_custom tidy_custom methods, modelsummary automatically display customized model information: Note can define std.error column tidy_custom.lm replace uncertainty estimates instead coefficients.","code":"library(modelsummary) mod <- list() mod[[1]] <- lm(hp ~ mpg + drat, mtcars) mod[[2]] <- lm(wt ~ mpg + drat + am, mtcars) class(mod[[1]]) #> [1] \"lm\" glance_custom.lm <- function(x, ...) { dv <- as.character(formula(x)[2]) out <- data.frame(\"DV\" = dv) return(out) } tidy_custom.lm <- function(x, ...) { s <- summary(x)$coefficients out <- data.frame( term = row.names(s), estimate = ifelse(s[,1] > 0, '▲', '▼')) return(out) } modelsummary(mod)"},{"path":"https://vincentarelbundock.github.io/modelsummary/dev/articles/modelsummary.html","id":"customizing-existing-models-part-ii","dir":"Articles","previous_headings":"New models and custom statistics","what":"Customizing existing models (part II)","title":"modelsummary: regression tables","text":"even fundamental way customize output completely bypass modelsummary’s extractor functions assigning new class name model. example, Warning: defining new tidy glance methods, important include ellipsis argument (...). Note glance.custom() method, called stats:::nobs.lm() instead default stats::nobs() method, latter know know dispatch models new “custom” class. explicit solves problem. alternative set new class inherits previous one, use global option set broom default extractor function (otherwise modelsummary use standard lm extractors inheritance):","code":"# estimate a linear model mod_custom <- lm(hp ~ mpg + drat, mtcars) # assign it a new class class(mod_custom) <- \"custom\" # define tidy and glance methods tidy.custom <- function(x, ...) { data.frame( term = names(coef(x)), estimate = letters[1:length(coef(x))], std.error = seq_along(coef(x)) ) } glance.custom <- function(x, ...) { data.frame( \"Model\" = \"Custom\", \"nobs\" = stats:::nobs.lm(x) ) } # summarize modelsummary(mod_custom) options(modelsummary_get = \"broom\") class(mod_custom) <- c(\"custom\", \"lm\")"},{"path":"https://vincentarelbundock.github.io/modelsummary/dev/articles/modelsummary.html","id":"customizing-existing-models-part-iii","dir":"Articles","previous_headings":"New models and custom statistics","what":"Customizing existing models (part III)","title":"modelsummary: regression tables","text":"Another flexible way customize model output use output = \"modelsummary_list\". output option, modelsummary() returns list two elements: tidy contains parameter estimates, standard errors, etc., glance contains model statistics AIC. example, tidy glance can now customized, updated model can passed back modelsummary using modelsummary(mod_list). information displayed table contained mod_list, pattern allows flexible adjustments output tables. useful example pattern concerns mixed models using lme4. Assume want compare effect using different degrees--freedom adjustments significance coefficients. models identical parameter estimates, standard errors, model fit statistics - want change p-values. use parameters package compute adjusted p-values.","code":"mod <- lm(hp ~ mpg + drat, mtcars) mod_list <- modelsummary(mod, output = \"modelsummary_list\") mod_list$tidy #> term estimate std.error statistic df.error p.value s.value #> 1 (Intercept) 278.515455 55.414866 5.0260061 29 2.359726e-05 15.4 #> 2 mpg -9.985499 1.791837 -5.5727709 29 5.172030e-06 17.6 #> 3 drat 19.125752 20.197756 0.9469246 29 3.515013e-01 1.5 #> group conf.low conf.high #> 1 NA NA #> 2 NA NA #> 3 NA NA mod_list$glance #> aic bic r.squared adj.r.squared rmse nobs F logLik #> 1 337.8809 343.7438 0.6143611 0.5877653 41.90687 32 23.09994 -164.9404 library(\"lme4\") mod <- lmer(mpg ~ drat + (1 | am), data = mtcars) mod_list <- modelsummary(mod, output = \"modelsummary_list\", effects = \"fixed\") # create a copy, where we'll change the p-values mod_list_kenward <- as.list(mod_list) mod_list_kenward$tidy$p.value <- parameters::p_value_kenward(mod)$p modelsummary(list(\"Wald\" = mod_list, \"Kenward\" = mod_list_kenward), statistic = \"{std.error} ({p.value}) {stars}\")"},{"path":[]},{"path":"https://vincentarelbundock.github.io/modelsummary/dev/articles/modelsummary.html","id":"rmarkdown","dir":"Articles","previous_headings":"Rmarkdown, Quarto, Org-Mode","what":"Rmarkdown","title":"modelsummary: regression tables","text":"can use modelsummary insert tables dynamic documents knitr Rmarkdown. minimal .Rmd file can produce tables PDF, HTML, RTF documents: minimal.Rmd .Rmd file shows illustrates use table numbering cross-references produce PDF documents using bookdown: cross_references.Rmd .Rmd file shows customize tables PDF HTML files using gt kableExtra functions: appearance.Rmd","code":""},{"path":"https://vincentarelbundock.github.io/modelsummary/dev/articles/modelsummary.html","id":"quarto","dir":"Articles","previous_headings":"Rmarkdown, Quarto, Org-Mode","what":"Quarto","title":"modelsummary: regression tables","text":"Quarto open source publishing system built top Pandoc. designed “successor” Rmarkdown, includes useful features technical writing, built-support cross-references. modelsummary works automatically Quarto. minimal document cross-references render automatically PDF, HTML, :","code":"--- format: pdf title: Example --- @tbl-mtcars shows that cars with high horse power get low miles per gallon. ```{r} #| label: tbl-mtcars #| tbl-cap: \"Horse Powers vs. Miles per Gallon\" library(modelsummary) mod <- lm(mpg ~ hp, mtcars) modelsummary(mod) ```"},{"path":"https://vincentarelbundock.github.io/modelsummary/dev/articles/modelsummary.html","id":"emacs-org-mode","dir":"Articles","previous_headings":"Rmarkdown, Quarto, Org-Mode","what":"Emacs Org-Mode","title":"modelsummary: regression tables","text":"can use modelsummary insert tables Emacs Org-Mode documents, can exported variety formats, including HTML PDF (via LaTeX). anything Emacs-related, many ways achieve outcomes want. one example Org-Mode document can automatically export tables HTML PDF without manual tweaks: first line tells Org-mode assign variable called orgbackend. variable accessible R session, equal “html” “latex”, depending export format. second line creates Org macro use automatically add useful information header source blocks. instance, export HTML, macro expand :results output html. tells Org-Mode insert last printed output R session, treat raw HTML. {{{Rtable}}} call expands macro add information header block follows. #+BEGIN_SRC R :exports says want print original code output (:exports results omit code, example). Finally, options(modelsummary_factory_default=orgbackend uses variable defined set default output format. way, don’t use output argument every time. One potentially issue keep mind code extracts printout R console. However, customize tables kableExtra gt functions, functions always return printed raw HTML LaTeX code. Sometimes, can necessary add call cat end table customization pipeline. example:","code":"#+PROPERTY: header-args:R :var orgbackend=(prin1-to-string org-export-current-backend) #+MACRO: Rtable (eval (concat \"#+header: :results output \" (prin1-to-string org-export-current-backend))) {{{Rtable}}} #+BEGIN_SRC R :exports both library(modelsummary) options(modelsummary_factory_default = orgbackend) mod = lm(hp ~ mpg, data = mtcars) modelsummary(mod) #+END_SRC {{{Rtable}}} #+BEGIN_SRC R :exports both library(modelsummary) library(kableExtra) mod = lm(hp ~ mpg, data = mtcars) modelsummary(mod, output = orgbackend) %>% row_spec(1, background = \"pink\") %>% cat() #+END_SRC"},{"path":"https://vincentarelbundock.github.io/modelsummary/dev/articles/modelsummary.html","id":"global-options","dir":"Articles","previous_headings":"","what":"Global options","title":"modelsummary: regression tables","text":"Users can change default behavior modelsummary setting global options. Omit note bottom table significance threshold: Change default output format: Change backend packages modelsummary uses create tables different output formats: Change packages modelsummary uses extract information models: appearance vignette shows set “themes” tables using modelsummary_theme_gt, modelsummary_theme_kableExtra, modelsummary_theme_flextable modelsummary_theme_huxtable global options. example:","code":"options(\"modelsummary_stars_note\" = FALSE) options(modelsummary_factory_default = \"latex\") options(modelsummary_factory_default = \"gt\") options(modelsummary_factory_html = 'kableExtra') options(modelsummary_factory_latex = 'flextable') options(modelsummary_factory_word = 'huxtable') options(modelsummary_factory_png = 'gt') # tidymodels: broom options(modelsummary_get = \"broom\") # easystats: performance + parameters options(modelsummary_get = \"easystats\") library(gt) # The ... ellipsis is required! custom_theme <- function(x, ...) { x %>% gt::opt_row_striping(row_striping = TRUE) } options(\"modelsummary_theme_gt\" = custom_theme) mod <- lm(mpg ~ hp + drat, mtcars) modelsummary(mod, output = \"gt\")"},{"path":[]},{"path":"https://vincentarelbundock.github.io/modelsummary/dev/articles/modelsummary.html","id":"subgroup-estimation-with-nest_by","dir":"Articles","previous_headings":"Case studies","what":"Subgroup estimation with nest_by","title":"modelsummary: regression tables","text":"Sometimes, useful estimate multiple regression models subsets data. efficiently, can use nest_by function dplyr package. , estimate models lm, extract name pull, finally summarize modelsummary:","code":"library(tidyverse) mtcars %>% nest_by(cyl) %>% mutate(models = list(lm(mpg ~ hp, data))) %>% pull(models, name = cyl) %>% modelsummary"},{"path":"https://vincentarelbundock.github.io/modelsummary/dev/articles/modelsummary.html","id":"statistics-in-separate-columns-instead-of-one-over-the-other","dir":"Articles","previous_headings":"Case studies","what":"Statistics in separate columns instead of one over the other","title":"modelsummary: regression tables","text":"somes cases, may want display statistics separate columns instead one . easy achieve outcome using estimate argument. argument accepts vector values, one models trying summarize. want include estimates standard errors separate columns, need repeat model, request different statistics. example, can automated using simple function:","code":"library(modelsummary) library(kableExtra) mod1 <- lm(mpg ~ hp, mtcars) mod2 <- lm(mpg ~ hp + drat, mtcars) models <- list( \"Coef.\" = mod1, \"Std.Error\" = mod1, \"Coef.\" = mod2, \"Std.Error\" = mod2) modelsummary(models, estimate = c(\"estimate\", \"std.error\", \"estimate\", \"std.error\"), statistic = NULL, gof_omit = \".*\", output = \"kableExtra\") %>% add_header_above(c(\" \" = 1, \"Model A\" = 2, \"Model B\" = 2)) side_by_side <- function(models, estimates, ...) { models <- rep(models, each = length(estimates)) estimates <- rep(estimates, times = 2) names(models) <- names(estimates) modelsummary(models = models, estimate = estimates, statistic = NULL, gof_omit = \".*\", ...) } models = list( lm(mpg ~ hp, mtcars), lm(mpg ~ hp + drat, mtcars)) estimates <- c(\"Coef.\" = \"estimate\", \"Std.Error\" = \"std.error\") side_by_side(models, estimates = estimates)"},{"path":"https://vincentarelbundock.github.io/modelsummary/dev/articles/modelsummary.html","id":"bootstrap","dir":"Articles","previous_headings":"Case studies","what":"Bootstrap","title":"modelsummary: regression tables","text":"Users often want use estimates standard errors obtained using custom strategy. achieve automated replicable way, can useful use tidy_custom strategy described “Cutomizing Existing Models” section. example, can use modelr package draw 500 resamples dataset, compute bootstrap standard errors taking standard deviation estimates computed resampled datasets. , defined tidy_custom.lm function automatically bootstrap lm model supplied modelsummary, replace values table automatically. Note tidy_custom_lm returns data.frame 3 columns: term, estimate, std.error:","code":"library(\"modelsummary\") library(\"broom\") library(\"tidyverse\") library(\"modelr\") tidy_custom.lm <- function(x, ...) { # extract data from the model model.frame(x) %>% # draw 500 bootstrap resamples modelr::bootstrap(n = 500) %>% # estimate the model 500 times mutate(results = map(strap, ~ update(x, data = .))) %>% # extract results using `broom::tidy` mutate(results = map(results, tidy)) %>% # unnest and summarize unnest(results) %>% group_by(term) %>% summarize(std.error = sd(estimate), estimate = mean(estimate)) } mod = list( lm(hp ~ mpg, mtcars) , lm(hp ~ mpg + drat, mtcars)) modelsummary(mod)"},{"path":"https://vincentarelbundock.github.io/modelsummary/dev/articles/modelsummary.html","id":"fixest-fixed-effects-and-instrumental-variable-regression","dir":"Articles","previous_headings":"Case studies","what":"fixest: Fixed effects and instrumental variable regression","title":"modelsummary: regression tables","text":"One common use-case glance_custom include additional goodness--fit statistics. example, instrumental variable estimation computed fixest package, may want include IV-Wald statistic first-stage regression endogenous regressor:","code":"library(fixest) library(tidyverse) # create a toy dataset base <- iris names(base) <- c(\"y\", \"x1\", \"x_endo_1\", \"x_inst_1\", \"fe\") base$x_inst_2 <- 0.2 * base$y + 0.2 * base$x_endo_1 + rnorm(150, sd = 0.5) base$x_endo_2 <- 0.2 * base$y - 0.2 * base$x_inst_1 + rnorm(150, sd = 0.5) # estimate an instrumental variable model mod <- feols(y ~ x1 | fe | x_endo_1 + x_endo_2 ~ x_inst_1 + x_inst_2, base) # custom extractor function returns a one-row data.frame (or tibble) glance_custom.fixest <- function(x) { tibble( \"Wald (x_endo_1)\" = fitstat(x, \"ivwald\")[[1]]$stat, \"Wald (x_endo_2)\" = fitstat(x, \"ivwald\")[[2]]$stat ) } # draw table modelsummary(mod) rm(\"glance_custom.fixest\")"},{"path":"https://vincentarelbundock.github.io/modelsummary/dev/articles/modelsummary.html","id":"multiple-imputation","dir":"Articles","previous_headings":"Case studies","what":"Multiple imputation","title":"modelsummary: regression tables","text":"modelsummary can pool display analyses several datasets imputed using mice Amelia packages. code illustrates :","code":"library(mice) library(Amelia) library(modelsummary) # Download data from `Rdatasets` url <- 'https://vincentarelbundock.github.io/Rdatasets/csv/HistData/Guerry.csv' dat <- read.csv(url)[, c('Clergy', 'Commerce', 'Literacy')] # Insert missing values dat$Clergy[sample(1:nrow(dat), 10)] <- NA dat$Commerce[sample(1:nrow(dat), 10)] <- NA dat$Literacy[sample(1:nrow(dat), 10)] <- NA # Impute with `mice` and `Amelia` dat_mice <- mice(dat, m = 5, printFlag = FALSE) dat_amelia <- amelia(dat, m = 5, p2s = 0)$imputations # Estimate models mod <- list() mod[['Listwise deletion']] <- lm(Clergy ~ Literacy + Commerce, dat) mod[['Mice']] <- with(dat_mice, lm(Clergy ~ Literacy + Commerce)) mod[['Amelia']] <- lapply(dat_amelia, function(x) lm(Clergy ~ Literacy + Commerce, x)) # Pool results mod[['Mice']] <- mice::pool(mod[['Mice']]) mod[['Amelia']] <- mice::pool(mod[['Amelia']]) # Summarize modelsummary(mod)"},{"path":"https://vincentarelbundock.github.io/modelsummary/dev/articles/modelsummary.html","id":"table-making-packages","dir":"Articles","previous_headings":"","what":"Table-making packages","title":"modelsummary: regression tables","text":"table-making backends supported modelsummary overlapping capabilities (e.g., several can produce HTML tables). default packages used different outputs: kableExtra: HTML LaTeX / PDF flextable: Word Powerpoint gt: jpg png can modify defaults setting global options :","code":"options(modelsummary_factory_html = \"kableExtra\") options(modelsummary_factory_latex = \"gt\") options(modelsummary_factory_word = \"huxtable\") options(modelsummary_factory_png = \"gt\")"},{"path":[]},{"path":"https://vincentarelbundock.github.io/modelsummary/dev/articles/modelsummary.html","id":"stack-overflow-is-useful","dir":"Articles","previous_headings":"FAQ","what":"Stack Overflow is useful","title":"modelsummary: regression tables","text":"Standardized coefficients Row group labels Customizing Word tables add p values datasummary_correlation","code":""},{"path":"https://vincentarelbundock.github.io/modelsummary/dev/articles/modelsummary.html","id":"where-can-i-get-help","dir":"Articles","previous_headings":"FAQ","what":"Where can I get help?","title":"modelsummary: regression tables","text":"First, please read documentation ?modelsummary modelsummary website. website includes dozens worked examples lot detailed explanation. Second, try use [modelsummary] tag StackOverflow. Third, think found bug feature request, please file Github issue tracker:","code":""},{"path":"https://vincentarelbundock.github.io/modelsummary/dev/articles/modelsummary.html","id":"how-can-i-add-or-modify-statistics-in-a-table","dir":"Articles","previous_headings":"FAQ","what":"How can I add or modify statistics in a table?","title":"modelsummary: regression tables","text":"See detailed documentation “Adding Customizing Models” section modelsummary website.","code":""},{"path":"https://vincentarelbundock.github.io/modelsummary/dev/articles/modelsummary.html","id":"how-does-modelsummary-extract-estimates-and-goodness-of-fit-statistics","dir":"Articles","previous_headings":"FAQ","what":"How does modelsummary extract estimates and goodness-of-fit statistics?","title":"modelsummary: regression tables","text":"modelsummary table divided two parts: “Estimates” (top table) “Goodness--fit” (bottom table). populate two parts, modelsummary tries using broom, parameters performance packages sequence. Estimates: Try broom::tidy function see package supports model type, user defined custom tidy function global environment. fails… Try parameters::model_parameters function see parameters package supports model type. Goodness--fit: Try performance::model_performance function see performance package supports model type. Try broom::glance function see package supports model type, user defined custom glance function global environment. fails… can change order steps executed setting global option: fails, modelsummary return error message. problems model object, can often diagnose problem running following commands clean R session: none options work, can create tidy glance methods, described Adding new models section. one extractor functions work well takes long process, can define new “custom” model class choose extractors, described Adding new models section.","code":"# tidymodels: broom options(modelsummary_get = \"broom\") # easystats: performance + parameters options(modelsummary_get = \"easystats\") # see if parameters and performance support your model type library(parameters) library(performance) model_parameters(model) model_performance(model) # see if broom supports your model type library(broom) tidy(model) glance(model) # see if broom.mixed supports your model type library(broom.mixed) tidy(model) glance(model)"},{"path":"https://vincentarelbundock.github.io/modelsummary/dev/articles/modelsummary.html","id":"how-can-i-speed-up-modelsummary","dir":"Articles","previous_headings":"FAQ","what":"How can I speed up modelsummary?","title":"modelsummary: regression tables","text":"modelsummary function, , slow: take couple seconds produce table output format. However, sometimes can computationally expensive (long) extract estimates compute goodness--fit statistics model. main options speed modelsummary : Set gof_map=NA avoid computing expensive goodness--fit statistics. Use easystats extractor functions metrics argument avoid computing expensive statistics (see example). Use parallel computation summarizing multiple models. See “Parallel computation” section ?modelsummary documentation. diagnose slowdown find bottleneck, can try benchmark various extractor functions: experience, main bottleneck tends computing goodness--fit statistics. performance extractor allows users specify metrics argument select subset GOF include. Using can speedup things considerably. call modelsummary metrics argument:","code":"library(tictoc) data(trade) mod <- lm(mpg ~ hp + drat, mtcars) tic(\"tidy\") x <- broom::tidy(mod) toc() #> tidy: 0.006 sec elapsed tic(\"glance\") x <- broom::glance(mod) toc() #> glance: 0.01 sec elapsed tic(\"parameters\") x <- parameters::parameters(mod) toc() #> parameters: 0.044 sec elapsed tic(\"performance\") x <- performance::performance(mod) toc() #> performance: 0.023 sec elapsed modelsummary(mod, metrics = \"rmse\")"},{"path":"https://vincentarelbundock.github.io/modelsummary/dev/articles/modelsummary.html","id":"escaped-latex-characters","dir":"Articles","previous_headings":"FAQ","what":"Escaped LaTeX characters","title":"modelsummary: regression tables","text":"Sometimes, users want include raw LaTeX commands tables, coefficient names including math mode: Apple $\\times$ Orange. result attempts often weird string : \\$\\textbackslash{}times\\$ instead proper LaTeX-rendered characters. source problem kableExtra, default table-making package modelsummary, automatically escapes weird characters make sure tables compile properly LaTeX. avoid , need pass escape=FALSE modelsummary:","code":"modelsummary(mod, escape = FALSE)"},{"path":"https://vincentarelbundock.github.io/modelsummary/dev/articles/modelsummary.html","id":"bayesian-models","dir":"Articles","previous_headings":"FAQ","what":"Bayesian models","title":"modelsummary: regression tables","text":"Many bayesian models supported ---box, including produced rstanarm brms packages. statistics available bayesian models slightly different available frequentist models. Users can call get_estimates see available: shows std.error column, mad statistic (mean absolute deviation). can : noted modelsummary() documentation, model results extracted using parameters package. Users can pass additional arguments modelsummary(), push forward arguments parameters::parameters function change results. example, parameters documentation bayesian models shows centrality argument, allows users report mean standard deviation posterior distribution, instead median MAD: can also get additional test statistics using test argument:","code":"library(rstanarm) #> This is rstanarm version 2.21.4 #> - See https://mc-stan.org/rstanarm/articles/priors for changes to default priors! #> - Default priors may change, so it's safest to specify priors, even if equivalent to the defaults. #> - For execution on a local, multicore CPU with excess RAM we recommend calling #> options(mc.cores = parallel::detectCores()) #> #> Attaching package: 'rstanarm' #> The following object is masked from 'package:fixest': #> #> se mod <- stan_glm(am ~ hp + drat, data = mtcars) get_estimates(mod) #> term estimate mad conf.level conf.low conf.high #> 1 (Intercept) -2.2386755829 0.577397121 0.95 -3.371992258 -1.03919442 #> 2 hp 0.0006911648 0.001067133 0.95 -0.001490074 0.00284835 #> 3 drat 0.7062289285 0.134735553 0.95 0.424172795 0.97769625 #> prior.distribution prior.location prior.scale group std.error statistic #> 1 normal 0.40625 1.24747729 NA NA #> 2 normal 0.00000 0.01819465 NA NA #> 3 normal 0.00000 2.33313429 NA NA #> p.value #> 1 NA #> 2 NA #> 3 NA modelsummary(mod, statistic = \"mad\") #> Warning: #> `modelsummary` uses the `performance` package to extract goodness-of-fit #> statistics from models of this class. You can specify the statistics you wish #> to compute by supplying a `metrics` argument to `modelsummary`, which will then #> push it forward to `performance`. Acceptable values are: \"all\", \"common\", #> \"none\", or a character vector of metrics names. For example: `modelsummary(mod, #> metrics = c(\"RMSE\", \"R2\")` Note that some metrics are computationally #> expensive. See `?performance::performance` for details. #> This warning appears once per session. get_estimates(mod, centrality = \"mean\") #> term estimate std.dev conf.level conf.low conf.high #> 1 (Intercept) -2.225786600 0.59441530 0.95 -3.371992258 -1.03919442 #> 2 hp 0.000672531 0.00109032 0.95 -0.001490074 0.00284835 #> 3 drat 0.703794192 0.14036134 0.95 0.424172795 0.97769625 #> prior.distribution prior.location prior.scale group std.error statistic #> 1 normal 0.40625 1.24747729 NA NA #> 2 normal 0.00000 0.01819465 NA NA #> 3 normal 0.00000 2.33313429 NA NA #> p.value #> 1 NA #> 2 NA #> 3 NA modelsummary(mod, statistic = \"std.dev\", centrality = \"mean\") get_estimates(mod, test = c(\"pd\", \"rope\")) #> term estimate mad conf.level conf.low conf.high #> 1 (Intercept) -2.2386755829 0.577397121 0.95 -3.371992258 -1.03919442 #> 2 hp 0.0006911648 0.001067133 0.95 -0.001490074 0.00284835 #> 3 drat 0.7062289285 0.134735553 0.95 0.424172795 0.97769625 #> pd rope.percentage prior.distribution prior.location prior.scale group #> 1 0.99975 0 normal 0.40625 1.24747729 #> 2 0.73800 1 normal 0.00000 0.01819465 #> 3 1.00000 0 normal 0.00000 2.33313429 #> std.error statistic p.value #> 1 NA NA NA #> 2 NA NA NA #> 3 NA NA NA"},{"path":"https://vincentarelbundock.github.io/modelsummary/dev/authors.html","id":null,"dir":"","previous_headings":"","what":"Authors","title":"Authors and Citation","text":"Vincent Arel-Bundock. Author, maintainer. Joachim Gassen. Contributor. Nathan Eastwood. Contributor. Nick Huntington-Klein. Contributor. Moritz Schwarz. Contributor. Benjamin Elbers. Contributor. 0000-0001-5392-3448 Grant McDermott. Contributor. Lukas Wallrich. Contributor.","code":""},{"path":"https://vincentarelbundock.github.io/modelsummary/dev/authors.html","id":"citation","dir":"","previous_headings":"","what":"Citation","title":"Authors and Citation","text":"Arel-Bundock V (2022). “modelsummary: Data Model Summaries R.” Journal Statistical Software, 103(1), 1–23. doi:10.18637/jss.v103.i01.","code":"@Article{, title = {{modelsummary}: Data and Model Summaries in {R}}, author = {Vincent Arel-Bundock}, journal = {Journal of Statistical Software}, year = {2022}, volume = {103}, number = {1}, pages = {1--23}, doi = {10.18637/jss.v103.i01}, }"},{"path":"https://vincentarelbundock.github.io/modelsummary/dev/index.html","id":"modelsummary-","dir":"","previous_headings":"","what":"Summary Tables and Plots for Statistical Models and Data: Beautiful, Customizable, and Publication-Ready ","title":"Summary Tables and Plots for Statistical Models and Data: Beautiful, Customizable, and Publication-Ready ","text":"modelsummary creates tables plots present descriptive statistics summarize statistical models R. modelsummary package summarize data statistical models R. supports one hundred types models ---box, allows users report results models side--side table, coefficient plots. makes easy execute common tasks computing robust standard errors, adding significance stars, manipulating coefficient model labels. Beyond model summaries, package also includes suite tools produce highly flexible data summary tables, dataset overviews, correlation matrices, (multi-level) cross-tabulations, balance tables (also known “Table 1”). appearance tables produced modelsummary can customized using external packages kableExtra, gt, flextable, huxtable; plots can customized using ggplot2. Tables can exported many output formats, including HTML, LaTeX, Text/Markdown, Microsoft Word, Powerpoint, Excel, RTF, PDF, image files. Tables plots can embedded seamlessly rmarkdown, knitr, Sweave dynamic documents. modelsummary package designed simple, robust, modular, extensible (Arel-Bundock, 2022). modelsummary includes two families functions: modelsummary: Regression tables side--side models. modelplot: Coefficient plots. datasummary: Powerful tool create (multi-level) cross-tabs data summaries. datasummary_crosstab: Cross-tabulations. datasummary_balance: Balance tables subgroup statistics difference means (aka “Table 1”). datasummary_correlation: Correlation tables. datasummary_skim: Quick overview (“skim”) dataset. datasummary_df: Turn dataframes nice tables titles, notes, etc. functions, can create tables plots like :","code":""},{"path":"https://vincentarelbundock.github.io/modelsummary/dev/index.html","id":"table-of-contents","dir":"","previous_headings":"","what":"Table of contents","title":"Summary Tables and Plots for Statistical Models and Data: Beautiful, Customizable, and Publication-Ready ","text":"modelsummary website hosts ton examples. Make sure click links top page: https://vincentarelbundock.github.io/modelsummary use modelsummary? Installation Getting started Alternative packages modelsummary: Model summaries modelplot: Model plots datasummary: Data summaries Customizing look tables","code":""},{"path":"https://vincentarelbundock.github.io/modelsummary/dev/index.html","id":"why-should-i-use-modelsummary","dir":"","previous_headings":"","what":"Why should I use modelsummary?","title":"Summary Tables and Plots for Statistical Models and Data: Beautiful, Customizable, and Publication-Ready ","text":"benefits modelsummary alternative packages:","code":""},{"path":"https://vincentarelbundock.github.io/modelsummary/dev/index.html","id":"easy","dir":"","previous_headings":"Why should I use modelsummary?","what":"Easy","title":"Summary Tables and Plots for Statistical Models and Data: Beautiful, Customizable, and Publication-Ready ","text":"modelsummary easy use. simple call often suffices: command automatically display summary table Rstudio Viewer web browser. need one word change output format. example, text-version table can printed Console typing: Tables Microsoft Word LaTeX formats can saved file typing:","code":"library(modelsummary) mod <- lm(y ~ x, dat) modelsummary(mod) modelsummary(mod, output = \"markdown\") modelsummary(mod, output = \"table.docx\") modelsummary(mod, output = \"table.tex\")"},{"path":"https://vincentarelbundock.github.io/modelsummary/dev/index.html","id":"flexible","dir":"","previous_headings":"Why should I use modelsummary?","what":"Flexible","title":"Summary Tables and Plots for Statistical Models and Data: Beautiful, Customizable, and Publication-Ready ","text":"Information: package offers many intuitive powerful utilities customize information reported summary table. can rename, reorder, subset omit parameter estimates; choose set goodness--fit statistics include; display various “robust” standard errors confidence intervals; add titles, footnotes, source notes; insert stars custom characters indicate levels statistical significance; add rows supplemental information models. Appearance: Thanks gt, kableExtra, huxtable, flextable, DT packages, appearance modelsummary tables endlessly customizable. appearance customization page shows tables colored cells, weird text, spanning column labels, row groups, titles, source notes, footnotes, significance stars, . scratches surface possibilities. Supported models: Thanks broom parameters, modelsummary supports hundreds statistical models ---box. Installing packages can extend capabilities (e.g., broom.mixed). also easy add customize models. Output formats: modelsummary tables can saved HTML, LaTeX, Text/Markdown, Microsoft Word, Powerpoint, RTF, JPG, PNG formats. can also inserted seamlessly Rmarkdown documents produce automated documents reports PDF, HTML, RTF, Microsoft Word formats.","code":""},{"path":"https://vincentarelbundock.github.io/modelsummary/dev/index.html","id":"dangerous","dir":"","previous_headings":"Why should I use modelsummary?","what":"Dangerous","title":"Summary Tables and Plots for Statistical Models and Data: Beautiful, Customizable, and Publication-Ready ","text":"modelsummary dangerous! allows users stupid stuff like replacing intercepts squirrels.","code":""},{"path":"https://vincentarelbundock.github.io/modelsummary/dev/index.html","id":"reliable","dir":"","previous_headings":"Why should I use modelsummary?","what":"Reliable","title":"Summary Tables and Plots for Statistical Models and Data: Beautiful, Customizable, and Publication-Ready ","text":"modelsummary reliably dangerous! package developed using suite unit tests 95% coverage, (probably) won’t break.","code":""},{"path":"https://vincentarelbundock.github.io/modelsummary/dev/index.html","id":"community","dir":"","previous_headings":"Why should I use modelsummary?","what":"Community","title":"Summary Tables and Plots for Statistical Models and Data: Beautiful, Customizable, and Publication-Ready ","text":"modelsummary try everything. Instead, leverages incredible work R community. building top broom parameters packages, modelsummary already supports hundreds model types ---box. modelsummary also supports five popular table-building customization packages: gt, kableExtra, huxtable, flextable, DT packages. using packages, modelsummary allows users produce beautiful, endlessly customizable tables wide variety formats, including HTML, PDF, LaTeX, Markdown, MS Word. One benefit community-focused approach external packages improve, modelsummary improves well. Another benefit leveraging external packages allows modelsummary massively simplified codebase (relative similar packages). improve long term code maintainability, allow contributors participate GitHub.","code":""},{"path":"https://vincentarelbundock.github.io/modelsummary/dev/index.html","id":"installation","dir":"","previous_headings":"","what":"Installation","title":"Summary Tables and Plots for Statistical Models and Data: Beautiful, Customizable, and Publication-Ready ","text":"can install modelsummary CRAN: can install development version modelsummary (dependency insight) R-Universe: Restart R completely moving .","code":"install.packages('modelsummary') install.packages( c(\"modelsummary\", \"insight\", \"performance\", \"parameters\"), repos = c( \"https://vincentarelbundock.r-universe.dev\", \"https://easystats.r-universe.dev\"))"},{"path":"https://vincentarelbundock.github.io/modelsummary/dev/index.html","id":"getting-started","dir":"","previous_headings":"","what":"Getting started","title":"Summary Tables and Plots for Statistical Models and Data: Beautiful, Customizable, and Publication-Ready ","text":"million ways customize tables plots produced modelsummary. Getting Started section scratch surface. details, see vignettes: modelsummary: https://vincentarelbundock.github.io/modelsummary/articles/modelsummary.html modelplot: https://vincentarelbundock.github.io/modelsummary/articles/modelplot.html datasummary: https://vincentarelbundock.github.io/modelsummary/articles/datasummary.html Appearance: https://vincentarelbundock.github.io/modelsummary/articles/appearance.html begin, load modelsummary package download data Rdatasets archive: Quick overview data: Balance table (aka “Table 1”) differences means subgroups: Correlation table: Two variables two statistics, nested subgroups: Estimate linear model display results: Estimate five regression models, display results side--side, save Microsoft Word document:","code":"library(modelsummary) url <- 'https://vincentarelbundock.github.io/Rdatasets/csv/HistData/Guerry.csv' dat <- read.csv(url) dat$Small <- dat$Pop1831 > median(dat$Pop1831) datasummary_skim(dat) datasummary_balance(~Small, dat) datasummary_correlation(dat) datasummary(Literacy + Commerce ~ Small * (mean + sd), dat) mod <- lm(Donations ~ Crime_prop, data = dat) modelsummary(mod) models <- list( \"OLS 1\" = lm(Donations ~ Literacy + Clergy, data = dat), \"Poisson 1\" = glm(Donations ~ Literacy + Commerce, family = poisson, data = dat), \"OLS 2\" = lm(Crime_pers ~ Literacy + Clergy, data = dat), \"Poisson 2\" = glm(Crime_pers ~ Literacy + Commerce, family = poisson, data = dat), \"OLS 3\" = lm(Crime_prop ~ Literacy + Clergy, data = dat) ) modelsummary(models, output = \"table.docx\")"},{"path":"https://vincentarelbundock.github.io/modelsummary/dev/index.html","id":"alternative-packages","dir":"","previous_headings":"","what":"Alternative packages","title":"Summary Tables and Plots for Statistical Models and Data: Beautiful, Customizable, and Publication-Ready ","text":"several excellent alternatives draw model summary tables R: sjPlot gtsummary texreg stargazer apsrtable huxtable janitor","code":""},{"path":"https://vincentarelbundock.github.io/modelsummary/dev/reference/All.html","id":null,"dir":"Reference","previous_headings":"","what":"Include all columns of a dataframe. — All","title":"Include all columns of a dataframe. — All","text":"objects imported packages. Follow links see documentation. tables ","code":""},{"path":"https://vincentarelbundock.github.io/modelsummary/dev/reference/AllObs.html","id":null,"dir":"Reference","previous_headings":"","what":"Display all observations in a table. — AllObs","title":"Display all observations in a table. — AllObs","text":"objects imported packages. Follow links see documentation. tables AllObs","code":""},{"path":"https://vincentarelbundock.github.io/modelsummary/dev/reference/Arguments.html","id":null,"dir":"Reference","previous_headings":"","what":"'Arguments' pseudo-function — Arguments","title":"'Arguments' pseudo-function — Arguments","text":"objects imported packages. Follow links see documentation. tables Arguments","code":""},{"path":"https://vincentarelbundock.github.io/modelsummary/dev/reference/DropEmpty.html","id":null,"dir":"Reference","previous_headings":"","what":"'DropEmpty' pseudo-function — DropEmpty","title":"'DropEmpty' pseudo-function — DropEmpty","text":"objects imported packages. Follow links see documentation. tables DropEmpty","code":""},{"path":"https://vincentarelbundock.github.io/modelsummary/dev/reference/Factor.html","id":null,"dir":"Reference","previous_headings":"","what":"Use a variable as a factor to give rows in a table. — Factor","title":"Use a variable as a factor to give rows in a table. — Factor","text":"objects imported packages. Follow links see documentation. tables Factor","code":""},{"path":"https://vincentarelbundock.github.io/modelsummary/dev/reference/Format.html","id":null,"dir":"Reference","previous_headings":"","what":"Use a variable as a factor to give rows in a table. — Format","title":"Use a variable as a factor to give rows in a table. — Format","text":"objects imported packages. Follow links see documentation. tables Format","code":""},{"path":"https://vincentarelbundock.github.io/modelsummary/dev/reference/Heading.html","id":null,"dir":"Reference","previous_headings":"","what":"'Heading' pseudo-function — Heading","title":"'Heading' pseudo-function — Heading","text":"objects imported packages. Follow links see documentation. tables Heading","code":""},{"path":"https://vincentarelbundock.github.io/modelsummary/dev/reference/Histogram.html","id":null,"dir":"Reference","previous_headings":"","what":"datasummary statistic shortcut — Histogram","title":"datasummary statistic shortcut — Histogram","text":"function uses Unicode characters create histogram. can sometimes useful, generally discouraged. Unicode characters can display limited number heights bars, accuracy output highly dependent platform (typeface, output type, windows vs. mac, etc.). recommend use kableExtra::spec_hist function instead.","code":""},{"path":"https://vincentarelbundock.github.io/modelsummary/dev/reference/Histogram.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"datasummary statistic shortcut — Histogram","text":"","code":"Histogram(x, bins = 10)"},{"path":"https://vincentarelbundock.github.io/modelsummary/dev/reference/Histogram.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"datasummary statistic shortcut — Histogram","text":"x variable summarize bins number histogram bars","code":""},{"path":"https://vincentarelbundock.github.io/modelsummary/dev/reference/Max.html","id":null,"dir":"Reference","previous_headings":"","what":"datasummary statistic shortcut — Max","title":"datasummary statistic shortcut — Max","text":"datasummary statistic shortcut","code":""},{"path":"https://vincentarelbundock.github.io/modelsummary/dev/reference/Max.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"datasummary statistic shortcut — Max","text":"","code":"Max(x, fmt = NULL, na.rm = TRUE, ...)"},{"path":"https://vincentarelbundock.github.io/modelsummary/dev/reference/Max.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"datasummary statistic shortcut — Max","text":"x variable summarize fmt passed modelsummary:::rounding function na.rm logical value indicating whether ‘NA’ values stripped computation proceeds. ... unused","code":""},{"path":"https://vincentarelbundock.github.io/modelsummary/dev/reference/Max.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"datasummary statistic shortcut — Max","text":"","code":"if (identical(Sys.getenv(\"pkgdown\"), \"true\")) { datasummary(mpg + hp ~ Mean + Median + P0 + P25 + P50 + P75 + P100 + Min + Max + SD + Var, data = mtcars) } #> #> #> #> <\/th> #> | Mean <\/th> #> | Median <\/th> #> | P0 <\/th> #> | P25 <\/th> #> | P50 <\/th> #> | P75 <\/th> #> | P100 <\/th> #> | Min <\/th> #> | Max <\/th> #> | SD <\/th> #> | Var <\/th> #> <\/tr> #> <\/thead> #> |
#> #> mpg <\/td> #> | 20.09 <\/td> #> | 19.20 <\/td> #> | 10.40 <\/td> #> | 15.43 <\/td> #> | 19.20 <\/td> #> | 22.80 <\/td> #> | 33.90 <\/td> #> | 10.40 <\/td> #> | 33.90 <\/td> #> | 6.03 <\/td> #> | 36.32 <\/td> #> <\/tr> #> |
#> hp <\/td> #> | 146.69 <\/td> #> | 123.00 <\/td> #> | 52.00 <\/td> #> | 96.50 <\/td> #> | 123.00 <\/td> #> | 180.00 <\/td> #> | 335.00 <\/td> #> | 52.00 <\/td> #> | 335.00 <\/td> #> | 68.56 <\/td> #> | 4700.87 <\/td> #> <\/tr> #> <\/tbody> #> <\/table>"},{"path":"https://vincentarelbundock.github.io/modelsummary/dev/reference/Mean.html","id":null,"dir":"Reference","previous_headings":"","what":"datasummary statistic shortcut — Mean","title":"datasummary statistic shortcut — Mean","text":"datasummary statistic shortcut","code":""},{"path":"https://vincentarelbundock.github.io/modelsummary/dev/reference/Mean.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"datasummary statistic shortcut — Mean","text":"","code":"Mean(x, fmt = NULL, na.rm = TRUE, ...)"},{"path":"https://vincentarelbundock.github.io/modelsummary/dev/reference/Mean.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"datasummary statistic shortcut — Mean","text":"x variable summarize fmt passed modelsummary:::rounding function na.rm logical value indicating whether ‘NA’ values stripped computation proceeds. ... unused","code":""},{"path":"https://vincentarelbundock.github.io/modelsummary/dev/reference/Mean.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"datasummary statistic shortcut — Mean","text":"","code":"if (identical(Sys.getenv(\"pkgdown\"), \"true\")) { datasummary(mpg + hp ~ Mean + P0 + P25 + P50 + P75 + P100 + Min + Max + SD + Var, data = mtcars) } #> #> #> #> <\/th> #> | Mean <\/th> #> | P0 <\/th> #> | P25 <\/th> #> | P50 <\/th> #> | P75 <\/th> #> | P100 <\/th> #> | Min <\/th> #> | Max <\/th> #> | SD <\/th> #> | Var <\/th> #> <\/tr> #> <\/thead> #> | #> #> mpg <\/td> #> | 20.09 <\/td> #> | 10.40 <\/td> #> | 15.43 <\/td> #> | 19.20 <\/td> #> | 22.80 <\/td> #> | 33.90 <\/td> #> | 10.40 <\/td> #> | 33.90 <\/td> #> | 6.03 <\/td> #> | 36.32 <\/td> #> <\/tr> #> | #> hp <\/td> #> | 146.69 <\/td> #> | 52.00 <\/td> #> | 96.50 <\/td> #> | 123.00 <\/td> #> | 180.00 <\/td> #> | 335.00 <\/td> #> | 52.00 <\/td> #> | 335.00 <\/td> #> | 68.56 <\/td> #> | 4700.87 <\/td> #> <\/tr> #> <\/tbody> #> <\/table>"},{"path":"https://vincentarelbundock.github.io/modelsummary/dev/reference/Median.html","id":null,"dir":"Reference","previous_headings":"","what":"datasummary statistic shortcut — Median","title":"datasummary statistic shortcut — Median","text":"datasummary statistic shortcut","code":""},{"path":"https://vincentarelbundock.github.io/modelsummary/dev/reference/Median.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"datasummary statistic shortcut — Median","text":"","code":"Median(x, fmt = NULL, na.rm = TRUE, ...)"},{"path":"https://vincentarelbundock.github.io/modelsummary/dev/reference/Median.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"datasummary statistic shortcut — Median","text":"x variable summarize fmt passed modelsummary:::rounding function na.rm logical value indicating whether ‘NA’ values stripped computation proceeds. ... unused","code":""},{"path":"https://vincentarelbundock.github.io/modelsummary/dev/reference/Median.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"datasummary statistic shortcut — Median","text":"","code":"if (identical(Sys.getenv(\"pkgdown\"), \"true\")) { datasummary(mpg + hp ~ Mean + Median + P0 + P25 + P50 + P75 + P100 + Min + Max + SD + Var, data = mtcars) } #> #> #> #> <\/th> #> | Mean <\/th> #> | Median <\/th> #> | P0 <\/th> #> | P25 <\/th> #> | P50 <\/th> #> | P75 <\/th> #> | P100 <\/th> #> | Min <\/th> #> | Max <\/th> #> | SD <\/th> #> | Var <\/th> #> <\/tr> #> <\/thead> #> | #> #> mpg <\/td> #> | 20.09 <\/td> #> | 19.20 <\/td> #> | 10.40 <\/td> #> | 15.43 <\/td> #> | 19.20 <\/td> #> | 22.80 <\/td> #> | 33.90 <\/td> #> | 10.40 <\/td> #> | 33.90 <\/td> #> | 6.03 <\/td> #> | 36.32 <\/td> #> <\/tr> #> | #> hp <\/td> #> | 146.69 <\/td> #> | 123.00 <\/td> #> | 52.00 <\/td> #> | 96.50 <\/td> #> | 123.00 <\/td> #> | 180.00 <\/td> #> | 335.00 <\/td> #> | 52.00 <\/td> #> | 335.00 <\/td> #> | 68.56 <\/td> #> | 4700.87 <\/td> #> <\/tr> #> <\/tbody> #> <\/table>"},{"path":"https://vincentarelbundock.github.io/modelsummary/dev/reference/Min.html","id":null,"dir":"Reference","previous_headings":"","what":"datasummary statistic shortcut — Min","title":"datasummary statistic shortcut — Min","text":"datasummary statistic shortcut","code":""},{"path":"https://vincentarelbundock.github.io/modelsummary/dev/reference/Min.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"datasummary statistic shortcut — Min","text":"","code":"Min(x, fmt = NULL, na.rm = TRUE, ...)"},{"path":"https://vincentarelbundock.github.io/modelsummary/dev/reference/Min.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"datasummary statistic shortcut — Min","text":"x variable summarize fmt passed modelsummary:::rounding function na.rm logical value indicating whether ‘NA’ values stripped computation proceeds. ... unused","code":""},{"path":"https://vincentarelbundock.github.io/modelsummary/dev/reference/Min.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"datasummary statistic shortcut — Min","text":"","code":"if (identical(Sys.getenv(\"pkgdown\"), \"true\")) { datasummary(mpg + hp ~ Mean + Median + P0 + P25 + P50 + P75 + P100 + Min + Max + SD + Var, data = mtcars) } #> #> #> #> <\/th> #> | Mean <\/th> #> | Median <\/th> #> | P0 <\/th> #> | P25 <\/th> #> | P50 <\/th> #> | P75 <\/th> #> | P100 <\/th> #> | Min <\/th> #> | Max <\/th> #> | SD <\/th> #> | Var <\/th> #> <\/tr> #> <\/thead> #> | #> #> mpg <\/td> #> | 20.09 <\/td> #> | 19.20 <\/td> #> | 10.40 <\/td> #> | 15.43 <\/td> #> | 19.20 <\/td> #> | 22.80 <\/td> #> | 33.90 <\/td> #> | 10.40 <\/td> #> | 33.90 <\/td> #> | 6.03 <\/td> #> | 36.32 <\/td> #> <\/tr> #> | #> hp <\/td> #> | 146.69 <\/td> #> | 123.00 <\/td> #> | 52.00 <\/td> #> | 96.50 <\/td> #> | 123.00 <\/td> #> | 180.00 <\/td> #> | 335.00 <\/td> #> | 52.00 <\/td> #> | 335.00 <\/td> #> | 68.56 <\/td> #> | 4700.87 <\/td> #> <\/tr> #> <\/tbody> #> <\/table>"},{"path":"https://vincentarelbundock.github.io/modelsummary/dev/reference/Multicolumn.html","id":null,"dir":"Reference","previous_headings":"","what":"Use a variable as a factor to give rows in a table. — Multicolumn","title":"Use a variable as a factor to give rows in a table. — Multicolumn","text":"objects imported packages. Follow links see documentation. tables Multicolumn","code":""},{"path":"https://vincentarelbundock.github.io/modelsummary/dev/reference/N.html","id":null,"dir":"Reference","previous_headings":"","what":"datasummary statistic shortcut — N","title":"datasummary statistic shortcut — N","text":"datasummary statistic shortcut","code":""},{"path":"https://vincentarelbundock.github.io/modelsummary/dev/reference/N.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"datasummary statistic shortcut — N","text":"","code":"N(x)"},{"path":"https://vincentarelbundock.github.io/modelsummary/dev/reference/N.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"datasummary statistic shortcut — N","text":"x variable summarize","code":""},{"path":"https://vincentarelbundock.github.io/modelsummary/dev/reference/N.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"datasummary statistic shortcut — N","text":"","code":"if (identical(Sys.getenv(\"pkgdown\"), \"true\")) { datasummary(Factor(cyl) ~ N, data = mtcars) } #> #> #> #> cyl <\/th> #> | N <\/th> #> <\/tr> #> <\/thead> #> | #> #> 4 <\/td> #> | 11 <\/td> #> <\/tr> #> | #> 6 <\/td> #> | 7 <\/td> #> <\/tr> #> | #> 8 <\/td> #> | 14 <\/td> #> <\/tr> #> <\/tbody> #> <\/table>"},{"path":"https://vincentarelbundock.github.io/modelsummary/dev/reference/NPercent.html","id":null,"dir":"Reference","previous_headings":"","what":"datasummary statistic shortcut — NPercent","title":"datasummary statistic shortcut — NPercent","text":"datasummary statistic shortcut","code":""},{"path":"https://vincentarelbundock.github.io/modelsummary/dev/reference/NPercent.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"datasummary statistic shortcut — NPercent","text":"","code":"NPercent(x, y)"},{"path":"https://vincentarelbundock.github.io/modelsummary/dev/reference/NPercent.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"datasummary statistic shortcut — NPercent","text":"x variable summarize y denominator variable","code":""},{"path":"https://vincentarelbundock.github.io/modelsummary/dev/reference/NUnique.html","id":null,"dir":"Reference","previous_headings":"","what":"datasummary statistic shortcut — NUnique","title":"datasummary statistic shortcut — NUnique","text":"datasummary statistic shortcut","code":""},{"path":"https://vincentarelbundock.github.io/modelsummary/dev/reference/NUnique.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"datasummary statistic shortcut — NUnique","text":"","code":"NUnique(x, ...)"},{"path":"https://vincentarelbundock.github.io/modelsummary/dev/reference/NUnique.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"datasummary statistic shortcut — NUnique","text":"x variable summarize ... unused","code":""},{"path":"https://vincentarelbundock.github.io/modelsummary/dev/reference/NUnique.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"datasummary statistic shortcut — NUnique","text":"","code":"if (identical(Sys.getenv(\"pkgdown\"), \"true\")) { datasummary(cyl + hp ~ NUnique, data = mtcars) } #> #> #> #> <\/th> #> | NUnique <\/th> #> <\/tr> #> <\/thead> #> | #> #> cyl <\/td> #> | 3 <\/td> #> <\/tr> #> | #> hp <\/td> #> | 22 <\/td> #> <\/tr> #> <\/tbody> #> <\/table>"},{"path":"https://vincentarelbundock.github.io/modelsummary/dev/reference/Ncol.html","id":null,"dir":"Reference","previous_headings":"","what":"datasummary statistic shortcut — Ncol","title":"datasummary statistic shortcut — Ncol","text":"datasummary statistic shortcut","code":""},{"path":"https://vincentarelbundock.github.io/modelsummary/dev/reference/Ncol.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"datasummary statistic shortcut — Ncol","text":"","code":"Ncol(x, ...)"},{"path":"https://vincentarelbundock.github.io/modelsummary/dev/reference/Ncol.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"datasummary statistic shortcut — Ncol","text":"x variable summarize ... unused","code":""},{"path":"https://vincentarelbundock.github.io/modelsummary/dev/reference/P0.html","id":null,"dir":"Reference","previous_headings":"","what":"datasummary statistic shortcut — P0","title":"datasummary statistic shortcut — P0","text":"datasummary statistic shortcut","code":""},{"path":"https://vincentarelbundock.github.io/modelsummary/dev/reference/P0.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"datasummary statistic shortcut — P0","text":"","code":"P0(x, fmt = NULL, na.rm = TRUE, ...)"},{"path":"https://vincentarelbundock.github.io/modelsummary/dev/reference/P0.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"datasummary statistic shortcut — P0","text":"x variable summarize fmt passed modelsummary:::rounding function na.rm logical value indicating whether ‘NA’ values stripped computation proceeds. ... unused","code":""},{"path":"https://vincentarelbundock.github.io/modelsummary/dev/reference/P0.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"datasummary statistic shortcut — P0","text":"","code":"if (identical(Sys.getenv(\"pkgdown\"), \"true\")) { datasummary(mpg + hp ~ Mean + Median + P0 + P25 + P50 + P75 + P100 + Min + Max + SD + Var, data = mtcars) } #> #> #> #> <\/th> #> | Mean <\/th> #> | Median <\/th> #> | P0 <\/th> #> | P25 <\/th> #> | P50 <\/th> #> | P75 <\/th> #> | P100 <\/th> #> | Min <\/th> #> | Max <\/th> #> | SD <\/th> #> | Var <\/th> #> <\/tr> #> <\/thead> #> | #> #> mpg <\/td> #> | 20.09 <\/td> #> | 19.20 <\/td> #> | 10.40 <\/td> #> | 15.43 <\/td> #> | 19.20 <\/td> #> | 22.80 <\/td> #> | 33.90 <\/td> #> | 10.40 <\/td> #> | 33.90 <\/td> #> | 6.03 <\/td> #> | 36.32 <\/td> #> <\/tr> #> | #> hp <\/td> #> | 146.69 <\/td> #> | 123.00 <\/td> #> | 52.00 <\/td> #> | 96.50 <\/td> #> | 123.00 <\/td> #> | 180.00 <\/td> #> | 335.00 <\/td> #> | 52.00 <\/td> #> | 335.00 <\/td> #> | 68.56 <\/td> #> | 4700.87 <\/td> #> <\/tr> #> <\/tbody> #> <\/table>"},{"path":"https://vincentarelbundock.github.io/modelsummary/dev/reference/P100.html","id":null,"dir":"Reference","previous_headings":"","what":"datasummary statistic shortcut — P100","title":"datasummary statistic shortcut — P100","text":"datasummary statistic shortcut","code":""},{"path":"https://vincentarelbundock.github.io/modelsummary/dev/reference/P100.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"datasummary statistic shortcut — P100","text":"","code":"P100(x, fmt = NULL, na.rm = TRUE, ...)"},{"path":"https://vincentarelbundock.github.io/modelsummary/dev/reference/P100.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"datasummary statistic shortcut — P100","text":"x variable summarize fmt passed modelsummary:::rounding function na.rm logical value indicating whether ‘NA’ values stripped computation proceeds. ... unused","code":""},{"path":"https://vincentarelbundock.github.io/modelsummary/dev/reference/P100.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"datasummary statistic shortcut — P100","text":"","code":"if (identical(Sys.getenv(\"pkgdown\"), \"true\")) { datasummary(mpg + hp ~ Mean + Median + P0 + P25 + P50 + P75 + P100 + Min + Max + SD + Var, data = mtcars) } #> #> #> #> <\/th> #> | Mean <\/th> #> | Median <\/th> #> | P0 <\/th> #> | P25 <\/th> #> | P50 <\/th> #> | P75 <\/th> #> | P100 <\/th> #> | Min <\/th> #> | Max <\/th> #> | SD <\/th> #> | Var <\/th> #> <\/tr> #> <\/thead> #> | #> #> mpg <\/td> #> | 20.09 <\/td> #> | 19.20 <\/td> #> | 10.40 <\/td> #> | 15.43 <\/td> #> | 19.20 <\/td> #> | 22.80 <\/td> #> | 33.90 <\/td> #> | 10.40 <\/td> #> | 33.90 <\/td> #> | 6.03 <\/td> #> | 36.32 <\/td> #> <\/tr> #> | #> hp <\/td> #> | 146.69 <\/td> #> | 123.00 <\/td> #> | 52.00 <\/td> #> | 96.50 <\/td> #> | 123.00 <\/td> #> | 180.00 <\/td> #> | 335.00 <\/td> #> | 52.00 <\/td> #> | 335.00 <\/td> #> | 68.56 <\/td> #> | 4700.87 <\/td> #> <\/tr> #> <\/tbody> #> <\/table>"},{"path":"https://vincentarelbundock.github.io/modelsummary/dev/reference/P25.html","id":null,"dir":"Reference","previous_headings":"","what":"datasummary statistic shortcut — P25","title":"datasummary statistic shortcut — P25","text":"datasummary statistic shortcut","code":""},{"path":"https://vincentarelbundock.github.io/modelsummary/dev/reference/P25.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"datasummary statistic shortcut — P25","text":"","code":"P25(x, fmt = NULL, na.rm = TRUE, ...)"},{"path":"https://vincentarelbundock.github.io/modelsummary/dev/reference/P25.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"datasummary statistic shortcut — P25","text":"x variable summarize fmt passed modelsummary:::rounding function na.rm logical value indicating whether ‘NA’ values stripped computation proceeds. ... unused","code":""},{"path":"https://vincentarelbundock.github.io/modelsummary/dev/reference/P25.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"datasummary statistic shortcut — P25","text":"","code":"if (identical(Sys.getenv(\"pkgdown\"), \"true\")) { datasummary(mpg + hp ~ Mean + Median + P0 + P25 + P50 + P75 + P100 + Min + Max + SD + Var, data = mtcars) } #> #> #> #> <\/th> #> | Mean <\/th> #> | Median <\/th> #> | P0 <\/th> #> | P25 <\/th> #> | P50 <\/th> #> | P75 <\/th> #> | P100 <\/th> #> | Min <\/th> #> | Max <\/th> #> | SD <\/th> #> | Var <\/th> #> <\/tr> #> <\/thead> #> | #> #> mpg <\/td> #> | 20.09 <\/td> #> | 19.20 <\/td> #> | 10.40 <\/td> #> | 15.43 <\/td> #> | 19.20 <\/td> #> | 22.80 <\/td> #> | 33.90 <\/td> #> | 10.40 <\/td> #> | 33.90 <\/td> #> | 6.03 <\/td> #> | 36.32 <\/td> #> <\/tr> #> | #> hp <\/td> #> | 146.69 <\/td> #> | 123.00 <\/td> #> | 52.00 <\/td> #> | 96.50 <\/td> #> | 123.00 <\/td> #> | 180.00 <\/td> #> | 335.00 <\/td> #> | 52.00 <\/td> #> | 335.00 <\/td> #> | 68.56 <\/td> #> | 4700.87 <\/td> #> <\/tr> #> <\/tbody> #> <\/table>"},{"path":"https://vincentarelbundock.github.io/modelsummary/dev/reference/P50.html","id":null,"dir":"Reference","previous_headings":"","what":"datasummary statistic shortcut — P50","title":"datasummary statistic shortcut — P50","text":"datasummary statistic shortcut","code":""},{"path":"https://vincentarelbundock.github.io/modelsummary/dev/reference/P50.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"datasummary statistic shortcut — P50","text":"","code":"P50(x, fmt = NULL, na.rm = TRUE, ...)"},{"path":"https://vincentarelbundock.github.io/modelsummary/dev/reference/P50.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"datasummary statistic shortcut — P50","text":"x variable summarize fmt passed modelsummary:::rounding function na.rm logical value indicating whether ‘NA’ values stripped computation proceeds. ... unused","code":""},{"path":"https://vincentarelbundock.github.io/modelsummary/dev/reference/P50.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"datasummary statistic shortcut — P50","text":"","code":"if (identical(Sys.getenv(\"pkgdown\"), \"true\")) { datasummary(mpg + hp ~ Mean + Median + P0 + P25 + P50 + P75 + P100 + Min + Max + SD + Var, data = mtcars) } #> #> #> #> <\/th> #> | Mean <\/th> #> | Median <\/th> #> | P0 <\/th> #> | P25 <\/th> #> | P50 <\/th> #> | P75 <\/th> #> | P100 <\/th> #> | Min <\/th> #> | Max <\/th> #> | SD <\/th> #> | Var <\/th> #> <\/tr> #> <\/thead> #> | #> #> mpg <\/td> #> | 20.09 <\/td> #> | 19.20 <\/td> #> | 10.40 <\/td> #> | 15.43 <\/td> #> | 19.20 <\/td> #> | 22.80 <\/td> #> | 33.90 <\/td> #> | 10.40 <\/td> #> | 33.90 <\/td> #> | 6.03 <\/td> #> | 36.32 <\/td> #> <\/tr> #> | #> hp <\/td> #> | 146.69 <\/td> #> | 123.00 <\/td> #> | 52.00 <\/td> #> | 96.50 <\/td> #> | 123.00 <\/td> #> | 180.00 <\/td> #> | 335.00 <\/td> #> | 52.00 <\/td> #> | 335.00 <\/td> #> | 68.56 <\/td> #> | 4700.87 <\/td> #> <\/tr> #> <\/tbody> #> <\/table>"},{"path":"https://vincentarelbundock.github.io/modelsummary/dev/reference/P75.html","id":null,"dir":"Reference","previous_headings":"","what":"datasummary statistic shortcut — P75","title":"datasummary statistic shortcut — P75","text":"datasummary statistic shortcut","code":""},{"path":"https://vincentarelbundock.github.io/modelsummary/dev/reference/P75.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"datasummary statistic shortcut — P75","text":"","code":"P75(x, fmt = NULL, na.rm = TRUE, ...)"},{"path":"https://vincentarelbundock.github.io/modelsummary/dev/reference/P75.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"datasummary statistic shortcut — P75","text":"x variable summarize fmt passed modelsummary:::rounding function na.rm logical value indicating whether ‘NA’ values stripped computation proceeds. ... unused","code":""},{"path":"https://vincentarelbundock.github.io/modelsummary/dev/reference/P75.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"datasummary statistic shortcut — P75","text":"","code":"if (identical(Sys.getenv(\"pkgdown\"), \"true\")) { datasummary(mpg + hp ~ Mean + Median + P0 + P25 + P50 + P75 + P100 + Min + Max + SD + Var, data = mtcars) } #> #> #> #> <\/th> #> | Mean <\/th> #> | Median <\/th> #> | P0 <\/th> #> | P25 <\/th> #> | P50 <\/th> #> | P75 <\/th> #> | P100 <\/th> #> | Min <\/th> #> | Max <\/th> #> | SD <\/th> #> | Var <\/th> #> <\/tr> #> <\/thead> #> | #> #> mpg <\/td> #> | 20.09 <\/td> #> | 19.20 <\/td> #> | 10.40 <\/td> #> | 15.43 <\/td> #> | 19.20 <\/td> #> | 22.80 <\/td> #> | 33.90 <\/td> #> | 10.40 <\/td> #> | 33.90 <\/td> #> | 6.03 <\/td> #> | 36.32 <\/td> #> <\/tr> #> | #> hp <\/td> #> | 146.69 <\/td> #> | 123.00 <\/td> #> | 52.00 <\/td> #> | 96.50 <\/td> #> | 123.00 <\/td> #> | 180.00 <\/td> #> | 335.00 <\/td> #> | 52.00 <\/td> #> | 335.00 <\/td> #> | 68.56 <\/td> #> | 4700.87 <\/td> #> <\/tr> #> <\/tbody> #> <\/table>"},{"path":"https://vincentarelbundock.github.io/modelsummary/dev/reference/Paste.html","id":null,"dir":"Reference","previous_headings":"","what":"Generate terms to paste values together in table. — Paste","title":"Generate terms to paste values together in table. — Paste","text":"objects imported packages. Follow links see documentation. tables Paste","code":""},{"path":"https://vincentarelbundock.github.io/modelsummary/dev/reference/Percent.html","id":null,"dir":"Reference","previous_headings":"","what":"Pseudo-function to compute a statistic relative to a reference set. — Percent","title":"Pseudo-function to compute a statistic relative to a reference set. — Percent","text":"objects imported packages. Follow links see documentation. tables Percent","code":""},{"path":"https://vincentarelbundock.github.io/modelsummary/dev/reference/PercentMissing.html","id":null,"dir":"Reference","previous_headings":"","what":"datasummary statistic shortcut — PercentMissing","title":"datasummary statistic shortcut — PercentMissing","text":"datasummary statistic shortcut","code":""},{"path":"https://vincentarelbundock.github.io/modelsummary/dev/reference/PercentMissing.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"datasummary statistic shortcut — PercentMissing","text":"","code":"PercentMissing(x)"},{"path":"https://vincentarelbundock.github.io/modelsummary/dev/reference/PercentMissing.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"datasummary statistic shortcut — PercentMissing","text":"x variable summarize","code":""},{"path":"https://vincentarelbundock.github.io/modelsummary/dev/reference/PlusMinus.html","id":null,"dir":"Reference","previous_headings":"","what":"Generate 'x +/- y' terms in table. — PlusMinus","title":"Generate 'x +/- y' terms in table. — PlusMinus","text":"objects imported packages. Follow links see documentation. tables PlusMinus","code":""},{"path":"https://vincentarelbundock.github.io/modelsummary/dev/reference/RowFactor.html","id":null,"dir":"Reference","previous_headings":"","what":"Use a variable as a factor to give rows in a table. — RowFactor","title":"Use a variable as a factor to give rows in a table. — RowFactor","text":"objects imported packages. Follow links see documentation. tables RowFactor","code":""},{"path":"https://vincentarelbundock.github.io/modelsummary/dev/reference/RowNum.html","id":null,"dir":"Reference","previous_headings":"","what":"Display all observations in a table. — RowNum","title":"Display all observations in a table. — RowNum","text":"objects imported packages. Follow links see documentation. tables RowNum","code":""},{"path":"https://vincentarelbundock.github.io/modelsummary/dev/reference/SD.html","id":null,"dir":"Reference","previous_headings":"","what":"datasummary statistic shortcut — SD","title":"datasummary statistic shortcut — SD","text":"datasummary statistic shortcut","code":""},{"path":"https://vincentarelbundock.github.io/modelsummary/dev/reference/SD.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"datasummary statistic shortcut — SD","text":"","code":"SD(x, fmt = NULL, na.rm = TRUE, ...)"},{"path":"https://vincentarelbundock.github.io/modelsummary/dev/reference/SD.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"datasummary statistic shortcut — SD","text":"x variable summarize fmt passed modelsummary:::rounding function na.rm logical value indicating whether ‘NA’ values stripped computation proceeds. ... unused","code":""},{"path":"https://vincentarelbundock.github.io/modelsummary/dev/reference/SD.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"datasummary statistic shortcut — SD","text":"","code":"if (identical(Sys.getenv(\"pkgdown\"), \"true\")) { datasummary(mpg + hp ~ Mean + Median + P0 + P25 + P50 + P75 + P100 + Min + Max + SD + Var, data = mtcars) } #> #> #> #> <\/th> #> | Mean <\/th> #> | Median <\/th> #> | P0 <\/th> #> | P25 <\/th> #> | P50 <\/th> #> | P75 <\/th> #> | P100 <\/th> #> | Min <\/th> #> | Max <\/th> #> | SD <\/th> #> | Var <\/th> #> <\/tr> #> <\/thead> #> | #> #> mpg <\/td> #> | 20.09 <\/td> #> | 19.20 <\/td> #> | 10.40 <\/td> #> | 15.43 <\/td> #> | 19.20 <\/td> #> | 22.80 <\/td> #> | 33.90 <\/td> #> | 10.40 <\/td> #> | 33.90 <\/td> #> | 6.03 <\/td> #> | 36.32 <\/td> #> <\/tr> #> | #> hp <\/td> #> | 146.69 <\/td> #> | 123.00 <\/td> #> | 52.00 <\/td> #> | 96.50 <\/td> #> | 123.00 <\/td> #> | 180.00 <\/td> #> | 335.00 <\/td> #> | 52.00 <\/td> #> | 335.00 <\/td> #> | 68.56 <\/td> #> | 4700.87 <\/td> #> <\/tr> #> <\/tbody> #> <\/table>"},{"path":"https://vincentarelbundock.github.io/modelsummary/dev/reference/Var.html","id":null,"dir":"Reference","previous_headings":"","what":"datasummary statistic shortcut — Var","title":"datasummary statistic shortcut — Var","text":"datasummary statistic shortcut","code":""},{"path":"https://vincentarelbundock.github.io/modelsummary/dev/reference/Var.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"datasummary statistic shortcut — Var","text":"","code":"Var(x, fmt = NULL, na.rm = TRUE, ...)"},{"path":"https://vincentarelbundock.github.io/modelsummary/dev/reference/Var.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"datasummary statistic shortcut — Var","text":"x variable summarize fmt passed modelsummary:::rounding function na.rm logical value indicating whether ‘NA’ values stripped computation proceeds. ... unused","code":""},{"path":"https://vincentarelbundock.github.io/modelsummary/dev/reference/Var.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"datasummary statistic shortcut — Var","text":"","code":"if (identical(Sys.getenv(\"pkgdown\"), \"true\")) { datasummary(mpg + hp ~ Mean + Median + P0 + P25 + P50 + P75 + P100 + Min + Max + SD + Var, data = mtcars) } #> #> #> #> <\/th> #> | Mean <\/th> #> | Median <\/th> #> | P0 <\/th> #> | P25 <\/th> #> | P50 <\/th> #> | P75 <\/th> #> | P100 <\/th> #> | Min <\/th> #> | Max <\/th> #> | SD <\/th> #> | Var <\/th> #> <\/tr> #> <\/thead> #> | #> #> mpg <\/td> #> | 20.09 <\/td> #> | 19.20 <\/td> #> | 10.40 <\/td> #> | 15.43 <\/td> #> | 19.20 <\/td> #> | 22.80 <\/td> #> | 33.90 <\/td> #> | 10.40 <\/td> #> | 33.90 <\/td> #> | 6.03 <\/td> #> | 36.32 <\/td> #> <\/tr> #> | #> hp <\/td> #> | 146.69 <\/td> #> | 123.00 <\/td> #> | 52.00 <\/td> #> | 96.50 <\/td> #> | 123.00 <\/td> #> | 180.00 <\/td> #> | 335.00 <\/td> #> | 52.00 <\/td> #> | 335.00 <\/td> #> | 68.56 <\/td> #> | 4700.87 <\/td> #> <\/tr> #> <\/tbody> #> <\/table>"},{"path":"https://vincentarelbundock.github.io/modelsummary/dev/reference/coef_rename.html","id":null,"dir":"Reference","previous_headings":"","what":"Rename model terms — coef_rename","title":"Rename model terms — coef_rename","text":"convenience function can passed coef_rename argument modelsummary function.","code":""},{"path":"https://vincentarelbundock.github.io/modelsummary/dev/reference/coef_rename.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Rename model terms — coef_rename","text":"","code":"coef_rename( x, factor = TRUE, factor_name = TRUE, backticks = TRUE, titlecase = TRUE, underscore = TRUE, asis = TRUE )"},{"path":"https://vincentarelbundock.github.io/modelsummary/dev/reference/coef_rename.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Rename model terms — coef_rename","text":"x character vector term names transform factor boolean remove \"factor()\" label factor_name boolean remove \"factor()\" label name variable backticks boolean remove backticks titlecase boolean convert title case underscore boolean replace underscores spaces asis boolean remove -formula calls","code":""},{"path":"https://vincentarelbundock.github.io/modelsummary/dev/reference/coef_rename.html","id":"examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Rename model terms — coef_rename","text":"","code":"library(modelsummary) dat <- mtcars dat$horse_power <- dat$hp mod <- lm(mpg ~ horse_power + factor(cyl), dat) modelsummary(mod, coef_rename = coef_rename)"},{"path":"https://vincentarelbundock.github.io/modelsummary/dev/reference/colLabels.html","id":null,"dir":"Reference","previous_headings":"","what":"Retrieve or modify the row or column labels. — colLabels","title":"Retrieve or modify the row or column labels. — colLabels","text":"objects imported packages. Follow links see documentation. tables colLabels","code":""},{"path":"https://vincentarelbundock.github.io/modelsummary/dev/reference/config_modelsummary.html","id":null,"dir":"Reference","previous_headings":"","what":"Persistent user settings for the modelsummary package — config_modelsummary","title":"Persistent user settings for the modelsummary package — config_modelsummary","text":"Persistent user settings modelsummary package","code":""},{"path":"https://vincentarelbundock.github.io/modelsummary/dev/reference/config_modelsummary.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Persistent user settings for the modelsummary package — config_modelsummary","text":"","code":"config_modelsummary( factory_default, factory_latex, factory_html, factory_markdown, reset = FALSE )"},{"path":"https://vincentarelbundock.github.io/modelsummary/dev/reference/config_modelsummary.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Persistent user settings for the modelsummary package — config_modelsummary","text":"factory_default Default output format: \"kableExtra\", \"gt\", \"flextable\", \"huxtable\", \"DT\", \"markdown\" factory_latex Name package used generate LaTeX output output=\"latex\". factory_html Name package used generate LaTeX output output=\"html\". factory_markdown Name package used generate LaTeX output output=\"markdown\". reset TRUE return default settings.","code":""},{"path":"https://vincentarelbundock.github.io/modelsummary/dev/reference/datasummary.html","id":null,"dir":"Reference","previous_headings":"","what":"Summary tables using 2-sided formulae: crosstabs, frequencies, table\n1s and more. — datasummary","title":"Summary tables using 2-sided formulae: crosstabs, frequencies, table\n1s and more. — datasummary","text":"datasummary can use summary function produces one numeric character value per variable. examples section documentation shows define custom summary functions. modelsummary also supplies several shortcut summary functions can used datasummary() formulas: Min, Max, Mean, Median, Var, SD, NPercent, NUnique, Ncol, P0, P25, P50, P75, P100. See Details Examples sections , vignettes modelsummary website: https://vincentarelbundock.github.io/modelsummary/ https://vincentarelbundock.github.io/modelsummary/articles/datasummary.html","code":""},{"path":"https://vincentarelbundock.github.io/modelsummary/dev/reference/datasummary.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Summary tables using 2-sided formulae: crosstabs, frequencies, table\n1s and more. — datasummary","text":"","code":"datasummary( formula, data, output = \"default\", fmt = 2, title = NULL, notes = NULL, align = NULL, add_columns = NULL, add_rows = NULL, sparse_header = TRUE, escape = TRUE, ... )"},{"path":"https://vincentarelbundock.github.io/modelsummary/dev/reference/datasummary.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Summary tables using 2-sided formulae: crosstabs, frequencies, table\n1s and more. — datasummary","text":"formula two-sided formula describe table: rows ~ columns. See Examples section mini-tutorial Details section resources. Grouping/nesting variables can appear sides formula, summary functions must one side. data data.frame (tibble) output filename object type (character string) Supported filename extensions: .docx, .html, .tex, .md, .txt, .csv, .xlsx, .png, .jpg Supported object types: \"default\", \"html\", \"markdown\", \"latex\", \"latex_tabular\", \"data.frame\", \"gt\", \"kableExtra\", \"huxtable\", \"flextable\", \"DT\", \"jupyter\". \"modelsummary_list\" value produces lightweight object can saved fed back modelsummary function. \"default\" output format can set \"kableExtra\", \"gt\", \"flextable\", \"huxtable\", \"DT\", \"markdown\" user choose default value, packages listed tried sequence. Session-specific configuration: options(\"modelsummary_factory_default\" = \"gt\") Persistent configuration: config_modelsummary(output = \"markdown\") Warning: Users supply file name output argument intend customize table external packages. See 'Details' section. LaTeX compilation requires booktabs siunitx packages, siunitx can disabled replaced global options. See 'Details' section. fmt format numeric values: integer, user-supplied function, modelsummary function. Integer: Number decimal digits User-supplied functions: function accepts numeric vector returns character vector length. modelsummary functions: fmt = fmt_significant(2): Two significant digits (term-level) fmt = fmt_sprintf(\"%.3f\"): See ?sprintf fmt = fmt_identity(): unformatted raw values title string notes list vector notes append bottom table. align string number characters equal number columns table (e.g., align = \"lcc\"). Valid characters: l, c, r, d. \"l\": left-aligned column \"c\": centered column \"r\": right-aligned column \"d\": dot-aligned column. LaTeX/PDF output, option requires least version 3.0.25 siunitx LaTeX package. commands must appear LaTeX preamble (added automatically compiling Rmarkdown documents PDF): \\usepackage{booktabs} \\usepackage{siunitx} \\newcolumntype{d}{S[ input-open-uncertainty=, input-close-uncertainty=, parse-numbers = false, table-align-text-pre=false, table-align-text-post=false ]} add_columns data.frame (tibble) number rows main table. add_rows data.frame (tibble) number columns main table. default, rows appended bottom table. can define \"position\" attribute integers set row positions. See Examples section . sparse_header TRUE FALSE. TRUE eliminates column headers unique label across columns, except row immediately data. FALSE keeps headers. order terms entered formula determines order headers appear. example, x~mean*z print mean-related header z-related header.` escape boolean TRUE escapes substitutes LaTeX/HTML characters prevent file compiling/displaying. setting affect captions notes. ... arguments passed table-making functions kableExtra::kbl, gt::gt, DT::datatable, etc. depending output argument. allows users pass arguments directly datasummary order affect behavior functions behind scenes.","code":""},{"path":"https://vincentarelbundock.github.io/modelsummary/dev/reference/datasummary.html","id":"details","dir":"Reference","previous_headings":"","what":"Details","title":"Summary tables using 2-sided formulae: crosstabs, frequencies, table\n1s and more. — datasummary","text":"Visit 'modelsummary' website usage examples: https://vincentarelbundock.github.io/modelsummary 'datasummary' function thin wrapper around 'tabular' function 'tables' package. details table-making formulas can found 'tables' package documentation: ?tables::tabular Hierarchical \"nested\" column labels available output formats: kableExtra, gt, html, rtf, LaTeX. saving tables formats, nested labels combined \"flat\" header.","code":""},{"path":"https://vincentarelbundock.github.io/modelsummary/dev/reference/datasummary.html","id":"global-options","dir":"Reference","previous_headings":"","what":"Global Options","title":"Summary tables using 2-sided formulae: crosstabs, frequencies, table\n1s and more. — datasummary","text":"behavior modelsummary can modified setting global options. example: options(modelsummary_model_labels = \"roman\") rest section describes options .","code":""},{"path":"https://vincentarelbundock.github.io/modelsummary/dev/reference/datasummary.html","id":"model-labels-default-column-names","dir":"Reference","previous_headings":"","what":"Model labels: default column names","title":"Summary tables using 2-sided formulae: crosstabs, frequencies, table\n1s and more. — datasummary","text":"global option changes style default column headers: options(modelsummary_model_labels = \"roman\") options(modelsummary_panel_labels = \"roman\") supported styles : \"model\", \"panel\", \"arabic\", \"letters\", \"roman\", \"(arabic)\", \"(letters)\", \"(roman)\"\" panel-specific option used shape=\"rbind\"","code":""},{"path":"https://vincentarelbundock.github.io/modelsummary/dev/reference/datasummary.html","id":"table-making-packages","dir":"Reference","previous_headings":"","what":"Table-making packages","title":"Summary tables using 2-sided formulae: crosstabs, frequencies, table\n1s and more. — datasummary","text":"modelsummary supports 4 table-making packages: kableExtra, gt, flextable, huxtable, DT. packages overlapping functionalities. example, 3 packages can export LaTeX. change default backend used specific file format, can use options function: options(modelsummary_factory_html = 'kableExtra') options(modelsummary_factory_latex = 'gt') options(modelsummary_factory_word = 'huxtable') options(modelsummary_factory_png = 'gt')","code":""},{"path":"https://vincentarelbundock.github.io/modelsummary/dev/reference/datasummary.html","id":"table-themes","dir":"Reference","previous_headings":"","what":"Table themes","title":"Summary tables using 2-sided formulae: crosstabs, frequencies, table\n1s and more. — datasummary","text":"Change look tables automated replicable way, using modelsummary theming functionality. See vignette: https://vincentarelbundock.github.io/modelsummary/articles/appearance.html modelsummary_theme_gt modelsummary_theme_kableExtra modelsummary_theme_huxtable modelsummary_theme_flextable modelsummary_theme_dataframe","code":""},{"path":"https://vincentarelbundock.github.io/modelsummary/dev/reference/datasummary.html","id":"model-extraction-functions","dir":"Reference","previous_headings":"","what":"Model extraction functions","title":"Summary tables using 2-sided formulae: crosstabs, frequencies, table\n1s and more. — datasummary","text":"modelsummary can use two sets packages extract information statistical models: easystats family (performance parameters) broom. default, uses easystats first falls back broom case failure. can change order priorities include goodness--fit extracted packages setting: options(modelsummary_get = \"broom\") options(modelsummary_get = \"easystats\") options(modelsummary_get = \"\")","code":""},{"path":"https://vincentarelbundock.github.io/modelsummary/dev/reference/datasummary.html","id":"formatting-numeric-entries","dir":"Reference","previous_headings":"","what":"Formatting numeric entries","title":"Summary tables using 2-sided formulae: crosstabs, frequencies, table\n1s and more. — datasummary","text":"default, LaTeX tables enclose numeric entries \\num{} command siunitx package. prevent behavior, enclose numbers dollar signs (LaTeX math mode), users can call: options(modelsummary_format_numeric_latex = \"plain\") options(modelsummary_format_numeric_latex = \"mathmode\") similar option can used display numerical entries using MathJax HTML tables: options(modelsummary_format_numeric_html = \"mathjax\")","code":""},{"path":"https://vincentarelbundock.github.io/modelsummary/dev/reference/datasummary.html","id":"examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Summary tables using 2-sided formulae: crosstabs, frequencies, table\n1s and more. — datasummary","text":"","code":"library(modelsummary) # The left-hand side of the formula describes rows, and the right-hand side # describes columns. This table uses the \"mpg\" variable as a row and the \"mean\" # function as a column: datasummary(mpg ~ mean, data = mtcars) # This table uses the \"mean\" function as a row and the \"mpg\" variable as a column: datasummary(mean ~ mpg, data = mtcars) # Display several variables or functions of the data using the \"+\" # concatenation operator. This table has 2 rows and 2 columns: datasummary(hp + mpg ~ mean + sd, data = mtcars) # Nest variables or statistics inside a \"factor\" variable using the \"*\" nesting # operator. This table shows the mean of \"hp\" and \"mpg\" for each value of # \"cyl\": mtcars$cyl <- as.factor(mtcars$cyl) datasummary(hp + mpg ~ cyl * mean, data = mtcars) # If you don't want to convert your original data # to factors, you can use the 'Factor()' # function inside 'datasummary' to obtain an identical result: datasummary(hp + mpg ~ Factor(cyl) * mean, data = mtcars) # You can nest several variables or statistics inside a factor by using # parentheses. This table shows the mean and the standard deviation for each # subset of \"cyl\": datasummary(hp + mpg ~ cyl * (mean + sd), data = mtcars) # Summarize all numeric variables with 'All()' datasummary(All(mtcars) ~ mean + sd, data = mtcars) # Define custom summary statistics. Your custom function should accept a vector # of numeric values and return a single numeric or string value: minmax <- function(x) sprintf(\"[%.2f, %.2f]\", min(x), max(x)) mean_na <- function(x) mean(x, na.rm = TRUE) datasummary(hp + mpg ~ minmax + mean_na, data = mtcars) # To handle missing values, you can pass arguments to your functions using # '*Arguments()' datasummary(hp + mpg ~ mean * Arguments(na.rm = TRUE), data = mtcars) # For convenience, 'modelsummary' supplies several convenience functions # with the argument `na.rm=TRUE` by default: Mean, Median, Min, Max, SD, Var, # P0, P25, P50, P75, P100, NUnique, Histogram #datasummary(hp + mpg ~ Mean + SD + Histogram, data = mtcars) # These functions also accept a 'fmt' argument which allows you to # round/format the results datasummary(hp + mpg ~ Mean * Arguments(fmt = \"%.3f\") + SD * Arguments(fmt = \"%.1f\"), data = mtcars) # Save your tables to a variety of output formats: f <- hp + mpg ~ Mean + SD #datasummary(f, data = mtcars, output = 'table.html') #datasummary(f, data = mtcars, output = 'table.tex') #datasummary(f, data = mtcars, output = 'table.md') #datasummary(f, data = mtcars, output = 'table.docx') #datasummary(f, data = mtcars, output = 'table.pptx') #datasummary(f, data = mtcars, output = 'table.jpg') #datasummary(f, data = mtcars, output = 'table.png') # Display human-readable code #datasummary(f, data = mtcars, output = 'html') #datasummary(f, data = mtcars, output = 'markdown') #datasummary(f, data = mtcars, output = 'latex') # Return a table object to customize using a table-making package #datasummary(f, data = mtcars, output = 'gt') #datasummary(f, data = mtcars, output = 'kableExtra') #datasummary(f, data = mtcars, output = 'flextable') #datasummary(f, data = mtcars, output = 'huxtable') # add_rows new_rows <- data.frame(a = 1:2, b = 2:3, c = 4:5) attr(new_rows, 'position') <- c(1, 3) datasummary(mpg + hp ~ mean + sd, data = mtcars, add_rows = new_rows)"},{"path":"https://vincentarelbundock.github.io/modelsummary/dev/reference/datasummary.html","id":"references","dir":"Reference","previous_headings":"","what":"References","title":"Summary tables using 2-sided formulae: crosstabs, frequencies, table\n1s and more. — datasummary","text":"Arel-Bundock V (2022). “modelsummary: Data Model Summaries R.” Journal Statistical Software, 103(1), 1-23. doi:10.18637/jss.v103.i01 .'","code":""},{"path":"https://vincentarelbundock.github.io/modelsummary/dev/reference/datasummary_balance.html","id":null,"dir":"Reference","previous_headings":"","what":"Balance table: Summary statistics for different subsets of the data (e.g.,\ncontrol and treatment groups) — datasummary_balance","title":"Balance table: Summary statistics for different subsets of the data (e.g.,\ncontrol and treatment groups) — datasummary_balance","text":"Creates balance tables summary statistics different subsets data (e.g., control treatment groups). can also used create summary tables full data sets. See Details Examples sections , vignettes modelsummary website: https://vincentarelbundock.github.io/modelsummary/ https://vincentarelbundock.github.io/modelsummary/articles/datasummary.html","code":""},{"path":"https://vincentarelbundock.github.io/modelsummary/dev/reference/datasummary_balance.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Balance table: Summary statistics for different subsets of the data (e.g.,\ncontrol and treatment groups) — datasummary_balance","text":"","code":"datasummary_balance( formula, data, output = \"default\", fmt = fmt_decimal(digits = 1, pdigits = 3), title = NULL, notes = NULL, align = NULL, stars = FALSE, add_columns = NULL, add_rows = NULL, dinm = TRUE, dinm_statistic = \"std.error\", escape = TRUE, ... )"},{"path":"https://vincentarelbundock.github.io/modelsummary/dev/reference/datasummary_balance.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Balance table: Summary statistics for different subsets of the data (e.g.,\ncontrol and treatment groups) — datasummary_balance","text":"formula one-sided formula \"condition\" \"column\" variable right-hand side. ~1 can used show summary statistics full data set data data.frame (tibble). data includes columns called \"blocks\", \"clusters\", /\"weights\", \"estimatr\" package consider calculating difference means. weights column, reported mean standard errors also weighted. output filename object type (character string) Supported filename extensions: .docx, .html, .tex, .md, .txt, .csv, .xlsx, .png, .jpg Supported object types: \"default\", \"html\", \"markdown\", \"latex\", \"latex_tabular\", \"data.frame\", \"gt\", \"kableExtra\", \"huxtable\", \"flextable\", \"DT\", \"jupyter\". \"modelsummary_list\" value produces lightweight object can saved fed back modelsummary function. \"default\" output format can set \"kableExtra\", \"gt\", \"flextable\", \"huxtable\", \"DT\", \"markdown\" user choose default value, packages listed tried sequence. Session-specific configuration: options(\"modelsummary_factory_default\" = \"gt\") Persistent configuration: config_modelsummary(output = \"markdown\") Warning: Users supply file name output argument intend customize table external packages. See 'Details' section. LaTeX compilation requires booktabs siunitx packages, siunitx can disabled replaced global options. See 'Details' section. fmt format numeric values: integer, user-supplied function, modelsummary function. Integer: Number decimal digits User-supplied functions: function accepts numeric vector returns character vector length. modelsummary functions: fmt = fmt_significant(2): Two significant digits (term-level) fmt = fmt_sprintf(\"%.3f\"): See ?sprintf fmt = fmt_identity(): unformatted raw values title string notes list vector notes append bottom table. align string number characters equal number columns table (e.g., align = \"lcc\"). Valid characters: l, c, r, d. \"l\": left-aligned column \"c\": centered column \"r\": right-aligned column \"d\": dot-aligned column. LaTeX/PDF output, option requires least version 3.0.25 siunitx LaTeX package. commands must appear LaTeX preamble (added automatically compiling Rmarkdown documents PDF): \\usepackage{booktabs} \\usepackage{siunitx} \\newcolumntype{d}{S[ input-open-uncertainty=, input-close-uncertainty=, parse-numbers = false, table-align-text-pre=false, table-align-text-post=false ]} stars indicate statistical significance FALSE (default): significance stars. TRUE: +=.1, *=.05, **=.01, ***=0.001 Named numeric vector custom stars c('*' = .1, '+' = .05) Note: legend inserted bottom table estimate statistic arguments use \"glue strings\" {stars}. add_columns data.frame (tibble) number rows main table. add_rows data.frame (tibble) number columns main table. default, rows appended bottom table. can define \"position\" attribute integers set row positions. See Examples section . dinm TRUE calculates difference means uncertainty estimates. option available estimatr package installed. data includes columns named \"blocks\", \"clusters\", \"weights\", information taken account automatically estimatr::difference_in_means. dinm_statistic string: \"std.error\" \"p.value\" escape boolean TRUE escapes substitutes LaTeX/HTML characters prevent file compiling/displaying. setting affect captions notes. ... arguments passed table-making functions kableExtra::kbl, gt::gt, DT::datatable, etc. depending output argument. allows users pass arguments directly datasummary order affect behavior functions behind scenes.","code":""},{"path":"https://vincentarelbundock.github.io/modelsummary/dev/reference/datasummary_balance.html","id":"global-options","dir":"Reference","previous_headings":"","what":"Global Options","title":"Balance table: Summary statistics for different subsets of the data (e.g.,\ncontrol and treatment groups) — datasummary_balance","text":"behavior modelsummary can modified setting global options. example: options(modelsummary_model_labels = \"roman\") rest section describes options .","code":""},{"path":"https://vincentarelbundock.github.io/modelsummary/dev/reference/datasummary_balance.html","id":"model-labels-default-column-names","dir":"Reference","previous_headings":"","what":"Model labels: default column names","title":"Balance table: Summary statistics for different subsets of the data (e.g.,\ncontrol and treatment groups) — datasummary_balance","text":"global option changes style default column headers: options(modelsummary_model_labels = \"roman\") options(modelsummary_panel_labels = \"roman\") supported styles : \"model\", \"panel\", \"arabic\", \"letters\", \"roman\", \"(arabic)\", \"(letters)\", \"(roman)\"\" panel-specific option used shape=\"rbind\"","code":""},{"path":"https://vincentarelbundock.github.io/modelsummary/dev/reference/datasummary_balance.html","id":"table-making-packages","dir":"Reference","previous_headings":"","what":"Table-making packages","title":"Balance table: Summary statistics for different subsets of the data (e.g.,\ncontrol and treatment groups) — datasummary_balance","text":"modelsummary supports 4 table-making packages: kableExtra, gt, flextable, huxtable, DT. packages overlapping functionalities. example, 3 packages can export LaTeX. change default backend used specific file format, can use options function: options(modelsummary_factory_html = 'kableExtra') options(modelsummary_factory_latex = 'gt') options(modelsummary_factory_word = 'huxtable') options(modelsummary_factory_png = 'gt')","code":""},{"path":"https://vincentarelbundock.github.io/modelsummary/dev/reference/datasummary_balance.html","id":"table-themes","dir":"Reference","previous_headings":"","what":"Table themes","title":"Balance table: Summary statistics for different subsets of the data (e.g.,\ncontrol and treatment groups) — datasummary_balance","text":"Change look tables automated replicable way, using modelsummary theming functionality. See vignette: https://vincentarelbundock.github.io/modelsummary/articles/appearance.html modelsummary_theme_gt modelsummary_theme_kableExtra modelsummary_theme_huxtable modelsummary_theme_flextable modelsummary_theme_dataframe","code":""},{"path":"https://vincentarelbundock.github.io/modelsummary/dev/reference/datasummary_balance.html","id":"model-extraction-functions","dir":"Reference","previous_headings":"","what":"Model extraction functions","title":"Balance table: Summary statistics for different subsets of the data (e.g.,\ncontrol and treatment groups) — datasummary_balance","text":"modelsummary can use two sets packages extract information statistical models: easystats family (performance parameters) broom. default, uses easystats first falls back broom case failure. can change order priorities include goodness--fit extracted packages setting: options(modelsummary_get = \"broom\") options(modelsummary_get = \"easystats\") options(modelsummary_get = \"\")","code":""},{"path":"https://vincentarelbundock.github.io/modelsummary/dev/reference/datasummary_balance.html","id":"formatting-numeric-entries","dir":"Reference","previous_headings":"","what":"Formatting numeric entries","title":"Balance table: Summary statistics for different subsets of the data (e.g.,\ncontrol and treatment groups) — datasummary_balance","text":"default, LaTeX tables enclose numeric entries \\num{} command siunitx package. prevent behavior, enclose numbers dollar signs (LaTeX math mode), users can call: options(modelsummary_format_numeric_latex = \"plain\") options(modelsummary_format_numeric_latex = \"mathmode\") similar option can used display numerical entries using MathJax HTML tables: options(modelsummary_format_numeric_html = \"mathjax\")","code":""},{"path":"https://vincentarelbundock.github.io/modelsummary/dev/reference/datasummary_balance.html","id":"examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Balance table: Summary statistics for different subsets of the data (e.g.,\ncontrol and treatment groups) — datasummary_balance","text":"","code":"library(modelsummary) datasummary_balance(~am, mtcars)"},{"path":"https://vincentarelbundock.github.io/modelsummary/dev/reference/datasummary_balance.html","id":"references","dir":"Reference","previous_headings":"","what":"References","title":"Balance table: Summary statistics for different subsets of the data (e.g.,\ncontrol and treatment groups) — datasummary_balance","text":"Arel-Bundock V (2022). “modelsummary: Data Model Summaries R.” Journal Statistical Software, 103(1), 1-23. doi:10.18637/jss.v103.i01 .'","code":""},{"path":"https://vincentarelbundock.github.io/modelsummary/dev/reference/datasummary_correlation.html","id":null,"dir":"Reference","previous_headings":"","what":"Generate a correlation table for all numeric variables in your dataset. — datasummary_correlation","title":"Generate a correlation table for all numeric variables in your dataset. — datasummary_correlation","text":"names variables displayed correlation table names columns data. can rename columns (without spaces) produce table human-readable variables. See Details Examples sections , vignettes modelsummary website: https://vincentarelbundock.github.io/modelsummary/ https://vincentarelbundock.github.io/modelsummary/articles/datasummary.html","code":""},{"path":"https://vincentarelbundock.github.io/modelsummary/dev/reference/datasummary_correlation.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Generate a correlation table for all numeric variables in your dataset. — datasummary_correlation","text":"","code":"datasummary_correlation( data, output = \"default\", method = \"pearson\", fmt = 2, align = NULL, add_rows = NULL, add_columns = NULL, title = NULL, notes = NULL, escape = TRUE, ... )"},{"path":"https://vincentarelbundock.github.io/modelsummary/dev/reference/datasummary_correlation.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Generate a correlation table for all numeric variables in your dataset. — datasummary_correlation","text":"data data.frame (tibble) output filename object type (character string) Supported filename extensions: .docx, .html, .tex, .md, .txt, .csv, .xlsx, .png, .jpg Supported object types: \"default\", \"html\", \"markdown\", \"latex\", \"latex_tabular\", \"data.frame\", \"gt\", \"kableExtra\", \"huxtable\", \"flextable\", \"DT\", \"jupyter\". \"modelsummary_list\" value produces lightweight object can saved fed back modelsummary function. \"default\" output format can set \"kableExtra\", \"gt\", \"flextable\", \"huxtable\", \"DT\", \"markdown\" user choose default value, packages listed tried sequence. Session-specific configuration: options(\"modelsummary_factory_default\" = \"gt\") Persistent configuration: config_modelsummary(output = \"markdown\") Warning: Users supply file name output argument intend customize table external packages. See 'Details' section. LaTeX compilation requires booktabs siunitx packages, siunitx can disabled replaced global options. See 'Details' section. method character function character: \"pearson\", \"kendall\", \"spearman\", \"pearspear\" (Pearson correlations Spearman correlations diagonal) function: takes data.frame numeric columns returns square matrix data.frame unique row.names colnames corresponding variable names. Note datasummary_correlation_format can often useful formatting output custom correlation functions. fmt format numeric values: integer, user-supplied function, modelsummary function. Integer: Number decimal digits User-supplied functions: function accepts numeric vector returns character vector length. modelsummary functions: fmt = fmt_significant(2): Two significant digits (term-level) fmt = fmt_sprintf(\"%.3f\"): See ?sprintf fmt = fmt_identity(): unformatted raw values align string number characters equal number columns table (e.g., align = \"lcc\"). Valid characters: l, c, r, d. \"l\": left-aligned column \"c\": centered column \"r\": right-aligned column \"d\": dot-aligned column. LaTeX/PDF output, option requires least version 3.0.25 siunitx LaTeX package. commands must appear LaTeX preamble (added automatically compiling Rmarkdown documents PDF): \\usepackage{booktabs} \\usepackage{siunitx} \\newcolumntype{d}{S[ input-open-uncertainty=, input-close-uncertainty=, parse-numbers = false, table-align-text-pre=false, table-align-text-post=false ]} add_rows data.frame (tibble) number columns main table. default, rows appended bottom table. can define \"position\" attribute integers set row positions. See Examples section . add_columns data.frame (tibble) number rows main table. title string notes list vector notes append bottom table. escape boolean TRUE escapes substitutes LaTeX/HTML characters prevent file compiling/displaying. setting affect captions notes. ... parameters passed table-making packages.","code":""},{"path":"https://vincentarelbundock.github.io/modelsummary/dev/reference/datasummary_correlation.html","id":"global-options","dir":"Reference","previous_headings":"","what":"Global Options","title":"Generate a correlation table for all numeric variables in your dataset. — datasummary_correlation","text":"behavior modelsummary can modified setting global options. example: options(modelsummary_model_labels = \"roman\") rest section describes options .","code":""},{"path":"https://vincentarelbundock.github.io/modelsummary/dev/reference/datasummary_correlation.html","id":"model-labels-default-column-names","dir":"Reference","previous_headings":"","what":"Model labels: default column names","title":"Generate a correlation table for all numeric variables in your dataset. — datasummary_correlation","text":"global option changes style default column headers: options(modelsummary_model_labels = \"roman\") options(modelsummary_panel_labels = \"roman\") supported styles : \"model\", \"panel\", \"arabic\", \"letters\", \"roman\", \"(arabic)\", \"(letters)\", \"(roman)\"\" panel-specific option used shape=\"rbind\"","code":""},{"path":"https://vincentarelbundock.github.io/modelsummary/dev/reference/datasummary_correlation.html","id":"table-making-packages","dir":"Reference","previous_headings":"","what":"Table-making packages","title":"Generate a correlation table for all numeric variables in your dataset. — datasummary_correlation","text":"modelsummary supports 4 table-making packages: kableExtra, gt, flextable, huxtable, DT. packages overlapping functionalities. example, 3 packages can export LaTeX. change default backend used specific file format, can use options function: options(modelsummary_factory_html = 'kableExtra') options(modelsummary_factory_latex = 'gt') options(modelsummary_factory_word = 'huxtable') options(modelsummary_factory_png = 'gt')","code":""},{"path":"https://vincentarelbundock.github.io/modelsummary/dev/reference/datasummary_correlation.html","id":"table-themes","dir":"Reference","previous_headings":"","what":"Table themes","title":"Generate a correlation table for all numeric variables in your dataset. — datasummary_correlation","text":"Change look tables automated replicable way, using modelsummary theming functionality. See vignette: https://vincentarelbundock.github.io/modelsummary/articles/appearance.html modelsummary_theme_gt modelsummary_theme_kableExtra modelsummary_theme_huxtable modelsummary_theme_flextable modelsummary_theme_dataframe","code":""},{"path":"https://vincentarelbundock.github.io/modelsummary/dev/reference/datasummary_correlation.html","id":"model-extraction-functions","dir":"Reference","previous_headings":"","what":"Model extraction functions","title":"Generate a correlation table for all numeric variables in your dataset. — datasummary_correlation","text":"modelsummary can use two sets packages extract information statistical models: easystats family (performance parameters) broom. default, uses easystats first falls back broom case failure. can change order priorities include goodness--fit extracted packages setting: options(modelsummary_get = \"broom\") options(modelsummary_get = \"easystats\") options(modelsummary_get = \"\")","code":""},{"path":"https://vincentarelbundock.github.io/modelsummary/dev/reference/datasummary_correlation.html","id":"formatting-numeric-entries","dir":"Reference","previous_headings":"","what":"Formatting numeric entries","title":"Generate a correlation table for all numeric variables in your dataset. — datasummary_correlation","text":"default, LaTeX tables enclose numeric entries \\num{} command siunitx package. prevent behavior, enclose numbers dollar signs (LaTeX math mode), users can call: options(modelsummary_format_numeric_latex = \"plain\") options(modelsummary_format_numeric_latex = \"mathmode\") similar option can used display numerical entries using MathJax HTML tables: options(modelsummary_format_numeric_html = \"mathjax\")","code":""},{"path":"https://vincentarelbundock.github.io/modelsummary/dev/reference/datasummary_correlation.html","id":"examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Generate a correlation table for all numeric variables in your dataset. — datasummary_correlation","text":"","code":"library(modelsummary) # clean variable names (base R) dat <- mtcars[, c(\"mpg\", \"hp\")] colnames(dat) <- c(\"Miles / Gallon\", \"Horse Power\") datasummary_correlation(dat) # clean variable names (tidyverse) library(tidyverse) dat <- mtcars %>% select(`Miles / Gallon` = mpg, `Horse Power` = hp) datasummary_correlation(dat) # alternative methods datasummary_correlation(dat, method = \"pearspear\") # custom function cor_fun <- function(x) cor(x, method = \"kendall\") datasummary_correlation(dat, method = cor_fun) # rename columns alphabetically and include a footnote for reference note <- sprintf(\"(%s) %s\", letters[1:ncol(dat)], colnames(dat)) note <- paste(note, collapse = \"; \") colnames(dat) <- sprintf(\"(%s)\", letters[1:ncol(dat)]) datasummary_correlation(dat, notes = note) # `datasummary_correlation_format`: custom function with formatting dat <- mtcars[, c(\"mpg\", \"hp\", \"disp\")] cor_fun <- function(x) { out <- cor(x, method = \"kendall\") datasummary_correlation_format( out, fmt = 2, upper_triangle = \"x\", diagonal = \".\") } datasummary_correlation(dat, method = cor_fun) # use kableExtra and psych to color significant cells library(psych) library(kableExtra) dat <- mtcars[, c(\"vs\", \"hp\", \"gear\")] cor_fun <- function(dat) { # compute correlations and format them correlations <- data.frame(cor(dat)) correlations <- datasummary_correlation_format(correlations, fmt = 2) # calculate pvalues using the `psych` package pvalues <- psych::corr.test(dat)$p # use `kableExtra::cell_spec` to color significant cells for (i in 1:nrow(correlations)) { for (j in 1:ncol(correlations)) { if (pvalues[i, j] < 0.05 && i != j) { correlations[i, j] <- cell_spec(correlations[i, j], background = \"pink\") } } } return(correlations) } # The `escape=FALSE` is important here! datasummary_correlation(dat, method = cor_fun, escape = FALSE)"},{"path":"https://vincentarelbundock.github.io/modelsummary/dev/reference/datasummary_correlation.html","id":"references","dir":"Reference","previous_headings":"","what":"References","title":"Generate a correlation table for all numeric variables in your dataset. — datasummary_correlation","text":"Arel-Bundock V (2022). “modelsummary: Data Model Summaries R.” Journal Statistical Software, 103(1), 1-23. doi:10.18637/jss.v103.i01 .'","code":""},{"path":"https://vincentarelbundock.github.io/modelsummary/dev/reference/datasummary_correlation_format.html","id":null,"dir":"Reference","previous_headings":"","what":"Format the content of a correlation table — datasummary_correlation_format","title":"Format the content of a correlation table — datasummary_correlation_format","text":"Mostly internal use, can useful users supply function method argument datasummary_correlation.","code":""},{"path":"https://vincentarelbundock.github.io/modelsummary/dev/reference/datasummary_correlation_format.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Format the content of a correlation table — datasummary_correlation_format","text":"","code":"datasummary_correlation_format( x, fmt, leading_zero = FALSE, diagonal = NULL, upper_triangle = NULL )"},{"path":"https://vincentarelbundock.github.io/modelsummary/dev/reference/datasummary_correlation_format.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Format the content of a correlation table — datasummary_correlation_format","text":"x square numeric matrix fmt format numeric values: integer, user-supplied function, modelsummary function. Integer: Number decimal digits User-supplied functions: function accepts numeric vector returns character vector length. modelsummary functions: fmt = fmt_significant(2): Two significant digits (term-level) fmt = fmt_sprintf(\"%.3f\"): See ?sprintf fmt = fmt_identity(): unformatted raw values leading_zero boolean. FALSE, leading zeros removed diagonal character NULL. character, elements diagonal replaced character (e.g., \"1\"). upper_triangle character NULL. character, elements upper triangle replaced character (e.g., \"\" \".\").","code":""},{"path":"https://vincentarelbundock.github.io/modelsummary/dev/reference/datasummary_correlation_format.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Format the content of a correlation table — datasummary_correlation_format","text":"","code":"library(modelsummary) dat <- mtcars[, c(\"mpg\", \"hp\", \"disp\")] cor_fun <- function(x) { out <- cor(x, method = \"kendall\") datasummary_correlation_format( out, fmt = 2, upper_triangle = \"x\", diagonal = \".\") } datasummary_correlation(dat, method = cor_fun) #> #> #> #> <\/th> #> | mpg <\/th> #> | hp <\/th> #> | disp <\/th> #> <\/tr> #> <\/thead> #> | #> #> mpg <\/td> #> | . <\/td> #> | x <\/td> #> | x <\/td> #> <\/tr> #> | #> hp <\/td> #> | −.74 <\/td> #> | . <\/td> #> | x <\/td> #> <\/tr> #> | #> disp <\/td> #> | −.77 <\/td> #> | .67 <\/td> #> | . <\/td> #> <\/tr> #> <\/tbody> #> <\/table>"},{"path":"https://vincentarelbundock.github.io/modelsummary/dev/reference/datasummary_crosstab.html","id":null,"dir":"Reference","previous_headings":"","what":"Cross tabulations for categorical variables — datasummary_crosstab","title":"Cross tabulations for categorical variables — datasummary_crosstab","text":"Convenience function tabulate counts, cell percentages, row/column percentages categorical variables. See Details section description internal design. complex cross tabulations, use datasummary directly. See Details Examples sections , vignettes modelsummary website: https://vincentarelbundock.github.io/modelsummary/ https://vincentarelbundock.github.io/modelsummary/articles/datasummary.html","code":""},{"path":"https://vincentarelbundock.github.io/modelsummary/dev/reference/datasummary_crosstab.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Cross tabulations for categorical variables — datasummary_crosstab","text":"","code":"datasummary_crosstab( formula, statistic = 1 ~ 1 + N + Percent(\"row\"), data, output = \"default\", fmt = 1, title = NULL, notes = NULL, align = NULL, add_columns = NULL, add_rows = NULL, sparse_header = TRUE, escape = TRUE, ... )"},{"path":"https://vincentarelbundock.github.io/modelsummary/dev/reference/datasummary_crosstab.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Cross tabulations for categorical variables — datasummary_crosstab","text":"formula two-sided formula describe table: rows ~ columns, rows columns variables data. Rows columns may contain interactions, e.g., var1 * var2 ~ var3. statistic formula form 1 ~ 1 + N + Percent(\"row\"). left-hand side may empty contain 1 include row totals. right-hand side may contain: 1 column totals, N counts, Percent() cell percentages, Percent(\"row\") row percentages, Percent(\"col\") column percentages. data data.frame (tibble) output filename object type (character string) Supported filename extensions: .docx, .html, .tex, .md, .txt, .csv, .xlsx, .png, .jpg Supported object types: \"default\", \"html\", \"markdown\", \"latex\", \"latex_tabular\", \"data.frame\", \"gt\", \"kableExtra\", \"huxtable\", \"flextable\", \"DT\", \"jupyter\". \"modelsummary_list\" value produces lightweight object can saved fed back modelsummary function. \"default\" output format can set \"kableExtra\", \"gt\", \"flextable\", \"huxtable\", \"DT\", \"markdown\" user choose default value, packages listed tried sequence. Session-specific configuration: options(\"modelsummary_factory_default\" = \"gt\") Persistent configuration: config_modelsummary(output = \"markdown\") Warning: Users supply file name output argument intend customize table external packages. See 'Details' section. LaTeX compilation requires booktabs siunitx packages, siunitx can disabled replaced global options. See 'Details' section. fmt format numeric values: integer, user-supplied function, modelsummary function. Integer: Number decimal digits User-supplied functions: function accepts numeric vector returns character vector length. modelsummary functions: fmt = fmt_significant(2): Two significant digits (term-level) fmt = fmt_sprintf(\"%.3f\"): See ?sprintf fmt = fmt_identity(): unformatted raw values title string notes list vector notes append bottom table. align string number characters equal number columns table (e.g., align = \"lcc\"). Valid characters: l, c, r, d. \"l\": left-aligned column \"c\": centered column \"r\": right-aligned column \"d\": dot-aligned column. LaTeX/PDF output, option requires least version 3.0.25 siunitx LaTeX package. commands must appear LaTeX preamble (added automatically compiling Rmarkdown documents PDF): \\usepackage{booktabs} \\usepackage{siunitx} \\newcolumntype{d}{S[ input-open-uncertainty=, input-close-uncertainty=, parse-numbers = false, table-align-text-pre=false, table-align-text-post=false ]} add_columns data.frame (tibble) number rows main table. add_rows data.frame (tibble) number columns main table. default, rows appended bottom table. can define \"position\" attribute integers set row positions. See Examples section . sparse_header TRUE FALSE. TRUE eliminates column headers unique label across columns, except row immediately data. FALSE keeps headers. order terms entered formula determines order headers appear. example, x~mean*z print mean-related header z-related header.` escape boolean TRUE escapes substitutes LaTeX/HTML characters prevent file compiling/displaying. setting affect captions notes. ... arguments passed table-making functions kableExtra::kbl, gt::gt, DT::datatable, etc. depending output argument. allows users pass arguments directly datasummary order affect behavior functions behind scenes.","code":""},{"path":"https://vincentarelbundock.github.io/modelsummary/dev/reference/datasummary_crosstab.html","id":"details","dir":"Reference","previous_headings":"","what":"Details","title":"Cross tabulations for categorical variables — datasummary_crosstab","text":"datasummary_crosstab wrapper around datasummary function. wrapper works creating customized formula feeding datasummary. customized formula comes two parts. First, take two-sided formula supplied formula argument. variables formula wrapped Factor() call ensure variables treated categorical. Second, statistic argument gives two-sided formula specifies statistics include table. datasummary_crosstab modifies formula automatically include \"clean\" labels. Finally, formula statistic formulas combined single formula fed directly datasummary function produce table. Variables formula automatically wrapped Factor().","code":""},{"path":"https://vincentarelbundock.github.io/modelsummary/dev/reference/datasummary_crosstab.html","id":"global-options","dir":"Reference","previous_headings":"","what":"Global Options","title":"Cross tabulations for categorical variables — datasummary_crosstab","text":"behavior modelsummary can modified setting global options. example: options(modelsummary_model_labels = \"roman\") rest section describes options .","code":""},{"path":"https://vincentarelbundock.github.io/modelsummary/dev/reference/datasummary_crosstab.html","id":"model-labels-default-column-names","dir":"Reference","previous_headings":"","what":"Model labels: default column names","title":"Cross tabulations for categorical variables — datasummary_crosstab","text":"global option changes style default column headers: options(modelsummary_model_labels = \"roman\") options(modelsummary_panel_labels = \"roman\") supported styles : \"model\", \"panel\", \"arabic\", \"letters\", \"roman\", \"(arabic)\", \"(letters)\", \"(roman)\"\" panel-specific option used shape=\"rbind\"","code":""},{"path":"https://vincentarelbundock.github.io/modelsummary/dev/reference/datasummary_crosstab.html","id":"table-making-packages","dir":"Reference","previous_headings":"","what":"Table-making packages","title":"Cross tabulations for categorical variables — datasummary_crosstab","text":"modelsummary supports 4 table-making packages: kableExtra, gt, flextable, huxtable, DT. packages overlapping functionalities. example, 3 packages can export LaTeX. change default backend used specific file format, can use options function: options(modelsummary_factory_html = 'kableExtra') options(modelsummary_factory_latex = 'gt') options(modelsummary_factory_word = 'huxtable') options(modelsummary_factory_png = 'gt')","code":""},{"path":"https://vincentarelbundock.github.io/modelsummary/dev/reference/datasummary_crosstab.html","id":"table-themes","dir":"Reference","previous_headings":"","what":"Table themes","title":"Cross tabulations for categorical variables — datasummary_crosstab","text":"Change look tables automated replicable way, using modelsummary theming functionality. See vignette: https://vincentarelbundock.github.io/modelsummary/articles/appearance.html modelsummary_theme_gt modelsummary_theme_kableExtra modelsummary_theme_huxtable modelsummary_theme_flextable modelsummary_theme_dataframe","code":""},{"path":"https://vincentarelbundock.github.io/modelsummary/dev/reference/datasummary_crosstab.html","id":"model-extraction-functions","dir":"Reference","previous_headings":"","what":"Model extraction functions","title":"Cross tabulations for categorical variables — datasummary_crosstab","text":"modelsummary can use two sets packages extract information statistical models: easystats family (performance parameters) broom. default, uses easystats first falls back broom case failure. can change order priorities include goodness--fit extracted packages setting: options(modelsummary_get = \"broom\") options(modelsummary_get = \"easystats\") options(modelsummary_get = \"\")","code":""},{"path":"https://vincentarelbundock.github.io/modelsummary/dev/reference/datasummary_crosstab.html","id":"formatting-numeric-entries","dir":"Reference","previous_headings":"","what":"Formatting numeric entries","title":"Cross tabulations for categorical variables — datasummary_crosstab","text":"default, LaTeX tables enclose numeric entries \\num{} command siunitx package. prevent behavior, enclose numbers dollar signs (LaTeX math mode), users can call: options(modelsummary_format_numeric_latex = \"plain\") options(modelsummary_format_numeric_latex = \"mathmode\") similar option can used display numerical entries using MathJax HTML tables: options(modelsummary_format_numeric_html = \"mathjax\")","code":""},{"path":"https://vincentarelbundock.github.io/modelsummary/dev/reference/datasummary_crosstab.html","id":"examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Cross tabulations for categorical variables — datasummary_crosstab","text":"","code":"library(modelsummary) # crosstab of two variables, showing counts, row percentages, and row/column totals datasummary_crosstab(cyl ~ gear, data = mtcars) # crosstab of two variables, showing counts only and no totals datasummary_crosstab(cyl ~ gear, statistic = ~ N, data = mtcars) # crosstab of three variables datasummary_crosstab(am * cyl ~ gear, data = mtcars) # crosstab with two variables and column percentages datasummary_crosstab(am ~ gear, statistic = ~ Percent(\"col\"), data = mtcars)"},{"path":"https://vincentarelbundock.github.io/modelsummary/dev/reference/datasummary_crosstab.html","id":"references","dir":"Reference","previous_headings":"","what":"References","title":"Cross tabulations for categorical variables — datasummary_crosstab","text":"Arel-Bundock V (2022). “modelsummary: Data Model Summaries R.” Journal Statistical Software, 103(1), 1-23. doi:10.18637/jss.v103.i01 .'","code":""},{"path":"https://vincentarelbundock.github.io/modelsummary/dev/reference/datasummary_df.html","id":null,"dir":"Reference","previous_headings":"","what":"Draw a table from a data.frame — datasummary_df","title":"Draw a table from a data.frame — datasummary_df","text":"Draw table data.frame","code":""},{"path":"https://vincentarelbundock.github.io/modelsummary/dev/reference/datasummary_df.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Draw a table from a data.frame — datasummary_df","text":"","code":"datasummary_df( data, output = \"default\", fmt = 2, align = NULL, hrule = NULL, title = NULL, notes = NULL, add_rows = NULL, add_columns = NULL, escape = TRUE, ... )"},{"path":"https://vincentarelbundock.github.io/modelsummary/dev/reference/datasummary_df.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Draw a table from a data.frame — datasummary_df","text":"data data.frame (tibble) output filename object type (character string) Supported filename extensions: .docx, .html, .tex, .md, .txt, .csv, .xlsx, .png, .jpg Supported object types: \"default\", \"html\", \"markdown\", \"latex\", \"latex_tabular\", \"data.frame\", \"gt\", \"kableExtra\", \"huxtable\", \"flextable\", \"DT\", \"jupyter\". \"modelsummary_list\" value produces lightweight object can saved fed back modelsummary function. \"default\" output format can set \"kableExtra\", \"gt\", \"flextable\", \"huxtable\", \"DT\", \"markdown\" user choose default value, packages listed tried sequence. Session-specific configuration: options(\"modelsummary_factory_default\" = \"gt\") Persistent configuration: config_modelsummary(output = \"markdown\") Warning: Users supply file name output argument intend customize table external packages. See 'Details' section. LaTeX compilation requires booktabs siunitx packages, siunitx can disabled replaced global options. See 'Details' section. fmt format numeric values: integer, user-supplied function, modelsummary function. Integer: Number decimal digits User-supplied functions: function accepts numeric vector returns character vector length. modelsummary functions: fmt = fmt_significant(2): Two significant digits (term-level) fmt = fmt_sprintf(\"%.3f\"): See ?sprintf fmt = fmt_identity(): unformatted raw values align string number characters equal number columns table (e.g., align = \"lcc\"). Valid characters: l, c, r, d. \"l\": left-aligned column \"c\": centered column \"r\": right-aligned column \"d\": dot-aligned column. LaTeX/PDF output, option requires least version 3.0.25 siunitx LaTeX package. commands must appear LaTeX preamble (added automatically compiling Rmarkdown documents PDF): \\usepackage{booktabs} \\usepackage{siunitx} \\newcolumntype{d}{S[ input-open-uncertainty=, input-close-uncertainty=, parse-numbers = false, table-align-text-pre=false, table-align-text-post=false ]} hrule position horizontal rules (integer vector) title string notes list vector notes append bottom table. add_rows data.frame (tibble) number columns main table. default, rows appended bottom table. can define \"position\" attribute integers set row positions. See Examples section . add_columns data.frame (tibble) number rows main table. escape boolean TRUE escapes substitutes LaTeX/HTML characters prevent file compiling/displaying. setting affect captions notes. ... arguments passed table-making functions kableExtra::kbl, gt::gt, DT::datatable, etc. depending output argument. allows users pass arguments directly datasummary order affect behavior functions behind scenes.","code":""},{"path":"https://vincentarelbundock.github.io/modelsummary/dev/reference/datasummary_df.html","id":"references","dir":"Reference","previous_headings":"","what":"References","title":"Draw a table from a data.frame — datasummary_df","text":"Arel-Bundock V (2022). “modelsummary: Data Model Summaries R.” Journal Statistical Software, 103(1), 1-23. doi:10.18637/jss.v103.i01 .'","code":""},{"path":"https://vincentarelbundock.github.io/modelsummary/dev/reference/datasummary_skim.html","id":null,"dir":"Reference","previous_headings":"","what":"Quick overview of numeric or categorical variables — datasummary_skim","title":"Quick overview of numeric or categorical variables — datasummary_skim","text":"function inspired excellent skimr package R. See Details Examples sections , vignettes modelsummary website: https://vincentarelbundock.github.io/modelsummary/ https://vincentarelbundock.github.io/modelsummary/articles/datasummary.html","code":""},{"path":"https://vincentarelbundock.github.io/modelsummary/dev/reference/datasummary_skim.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Quick overview of numeric or categorical variables — datasummary_skim","text":"","code":"datasummary_skim( data, type = \"numeric\", output = \"default\", fmt = \"%.1f\", histogram = TRUE, title = NULL, notes = NULL, align = NULL, escape = TRUE, ... )"},{"path":"https://vincentarelbundock.github.io/modelsummary/dev/reference/datasummary_skim.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Quick overview of numeric or categorical variables — datasummary_skim","text":"data data.frame (tibble) type variables summarize: \"numeric\" \"categorical\" (character) output filename object type (character string) Supported filename extensions: .docx, .html, .tex, .md, .txt, .csv, .xlsx, .png, .jpg Supported object types: \"default\", \"html\", \"markdown\", \"latex\", \"latex_tabular\", \"data.frame\", \"gt\", \"kableExtra\", \"huxtable\", \"flextable\", \"DT\", \"jupyter\". \"modelsummary_list\" value produces lightweight object can saved fed back modelsummary function. \"default\" output format can set \"kableExtra\", \"gt\", \"flextable\", \"huxtable\", \"DT\", \"markdown\" user choose default value, packages listed tried sequence. Session-specific configuration: options(\"modelsummary_factory_default\" = \"gt\") Persistent configuration: config_modelsummary(output = \"markdown\") Warning: Users supply file name output argument intend customize table external packages. See 'Details' section. LaTeX compilation requires booktabs siunitx packages, siunitx can disabled replaced global options. See 'Details' section. fmt format numeric values: integer, user-supplied function, modelsummary function. Integer: Number decimal digits User-supplied functions: function accepts numeric vector returns character vector length. modelsummary functions: fmt = fmt_significant(2): Two significant digits (term-level) fmt = fmt_sprintf(\"%.3f\"): See ?sprintf fmt = fmt_identity(): unformatted raw values histogram include histogram (TRUE/FALSE). Supported : type = \"numeric\" output \"html\", \"default\", \"jpg\", \"png\", \"kableExtra\" PDF HTML documents compiled via Rmarkdown knitr See examples section example use datasummary include histograms formats markdown. title string notes list vector notes append bottom table. align string number characters equal number columns table (e.g., align = \"lcc\"). Valid characters: l, c, r, d. \"l\": left-aligned column \"c\": centered column \"r\": right-aligned column \"d\": dot-aligned column. LaTeX/PDF output, option requires least version 3.0.25 siunitx LaTeX package. commands must appear LaTeX preamble (added automatically compiling Rmarkdown documents PDF): \\usepackage{booktabs} \\usepackage{siunitx} \\newcolumntype{d}{S[ input-open-uncertainty=, input-close-uncertainty=, parse-numbers = false, table-align-text-pre=false, table-align-text-post=false ]} escape boolean TRUE escapes substitutes LaTeX/HTML characters prevent file compiling/displaying. setting affect captions notes. ... arguments passed table-making functions kableExtra::kbl, gt::gt, DT::datatable, etc. depending output argument. allows users pass arguments directly datasummary order affect behavior functions behind scenes.","code":""},{"path":"https://vincentarelbundock.github.io/modelsummary/dev/reference/datasummary_skim.html","id":"global-options","dir":"Reference","previous_headings":"","what":"Global Options","title":"Quick overview of numeric or categorical variables — datasummary_skim","text":"behavior modelsummary can modified setting global options. example: options(modelsummary_model_labels = \"roman\") rest section describes options .","code":""},{"path":"https://vincentarelbundock.github.io/modelsummary/dev/reference/datasummary_skim.html","id":"model-labels-default-column-names","dir":"Reference","previous_headings":"","what":"Model labels: default column names","title":"Quick overview of numeric or categorical variables — datasummary_skim","text":"global option changes style default column headers: options(modelsummary_model_labels = \"roman\") options(modelsummary_panel_labels = \"roman\") supported styles : \"model\", \"panel\", \"arabic\", \"letters\", \"roman\", \"(arabic)\", \"(letters)\", \"(roman)\"\" panel-specific option used shape=\"rbind\"","code":""},{"path":"https://vincentarelbundock.github.io/modelsummary/dev/reference/datasummary_skim.html","id":"table-making-packages","dir":"Reference","previous_headings":"","what":"Table-making packages","title":"Quick overview of numeric or categorical variables — datasummary_skim","text":"modelsummary supports 4 table-making packages: kableExtra, gt, flextable, huxtable, DT. packages overlapping functionalities. example, 3 packages can export LaTeX. change default backend used specific file format, can use options function: options(modelsummary_factory_html = 'kableExtra') options(modelsummary_factory_latex = 'gt') options(modelsummary_factory_word = 'huxtable') options(modelsummary_factory_png = 'gt')","code":""},{"path":"https://vincentarelbundock.github.io/modelsummary/dev/reference/datasummary_skim.html","id":"table-themes","dir":"Reference","previous_headings":"","what":"Table themes","title":"Quick overview of numeric or categorical variables — datasummary_skim","text":"Change look tables automated replicable way, using modelsummary theming functionality. See vignette: https://vincentarelbundock.github.io/modelsummary/articles/appearance.html modelsummary_theme_gt modelsummary_theme_kableExtra modelsummary_theme_huxtable modelsummary_theme_flextable modelsummary_theme_dataframe","code":""},{"path":"https://vincentarelbundock.github.io/modelsummary/dev/reference/datasummary_skim.html","id":"model-extraction-functions","dir":"Reference","previous_headings":"","what":"Model extraction functions","title":"Quick overview of numeric or categorical variables — datasummary_skim","text":"modelsummary can use two sets packages extract information statistical models: easystats family (performance parameters) broom. default, uses easystats first falls back broom case failure. can change order priorities include goodness--fit extracted packages setting: options(modelsummary_get = \"broom\") options(modelsummary_get = \"easystats\") options(modelsummary_get = \"\")","code":""},{"path":"https://vincentarelbundock.github.io/modelsummary/dev/reference/datasummary_skim.html","id":"formatting-numeric-entries","dir":"Reference","previous_headings":"","what":"Formatting numeric entries","title":"Quick overview of numeric or categorical variables — datasummary_skim","text":"default, LaTeX tables enclose numeric entries \\num{} command siunitx package. prevent behavior, enclose numbers dollar signs (LaTeX math mode), users can call: options(modelsummary_format_numeric_latex = \"plain\") options(modelsummary_format_numeric_latex = \"mathmode\") similar option can used display numerical entries using MathJax HTML tables: options(modelsummary_format_numeric_html = \"mathjax\")","code":""},{"path":"https://vincentarelbundock.github.io/modelsummary/dev/reference/datasummary_skim.html","id":"examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Quick overview of numeric or categorical variables — datasummary_skim","text":"","code":"dat <- mtcars dat$vs <- as.logical(dat$vs) dat$cyl <- as.factor(dat$cyl) datasummary_skim(dat) datasummary_skim(dat, \"categorical\") # You can use `datasummary` to produce a similar table in different formats. # Note that the `Histogram` function relies on unicode characters. These # characters will only display correctly in some operating systems, under some # locales, using some fonts. Displaying such histograms on Windows computers # is notoriously tricky. The `modelsummary` authors cannot provide support to # display these unicode histograms. f <- All(mtcars) ~ Mean + SD + Min + Median + Max + Histogram # datasummary(f, mtcars, output=\"markdown\")"},{"path":"https://vincentarelbundock.github.io/modelsummary/dev/reference/datasummary_skim.html","id":"references","dir":"Reference","previous_headings":"","what":"References","title":"Quick overview of numeric or categorical variables — datasummary_skim","text":"Arel-Bundock V (2022). “modelsummary: Data Model Summaries R.” Journal Statistical Software, 103(1), 1-23. doi:10.18637/jss.v103.i01 .'","code":""},{"path":"https://vincentarelbundock.github.io/modelsummary/dev/reference/dsummary.html","id":null,"dir":"Reference","previous_headings":"","what":"dsummary() is a shortcut to datasummary() — dsummary","title":"dsummary() is a shortcut to datasummary() — dsummary","text":"datasummary can use summary function produces one numeric character value per variable. examples section documentation shows define custom summary functions. modelsummary also supplies several shortcut summary functions can used datasummary() formulas: Min, Max, Mean, Median, Var, SD, NPercent, NUnique, Ncol, P0, P25, P50, P75, P100. See Details Examples sections , vignettes modelsummary website: https://vincentarelbundock.github.io/modelsummary/ https://vincentarelbundock.github.io/modelsummary/articles/datasummary.html","code":""},{"path":"https://vincentarelbundock.github.io/modelsummary/dev/reference/dsummary.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"dsummary() is a shortcut to datasummary() — dsummary","text":"","code":"dsummary( formula, data, output = \"default\", fmt = 2, title = NULL, notes = NULL, align = NULL, add_columns = NULL, add_rows = NULL, sparse_header = TRUE, escape = TRUE, ... )"},{"path":"https://vincentarelbundock.github.io/modelsummary/dev/reference/dsummary.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"dsummary() is a shortcut to datasummary() — dsummary","text":"formula two-sided formula describe table: rows ~ columns. See Examples section mini-tutorial Details section resources. Grouping/nesting variables can appear sides formula, summary functions must one side. data data.frame (tibble) output filename object type (character string) Supported filename extensions: .docx, .html, .tex, .md, .txt, .csv, .xlsx, .png, .jpg Supported object types: \"default\", \"html\", \"markdown\", \"latex\", \"latex_tabular\", \"data.frame\", \"gt\", \"kableExtra\", \"huxtable\", \"flextable\", \"DT\", \"jupyter\". \"modelsummary_list\" value produces lightweight object can saved fed back modelsummary function. \"default\" output format can set \"kableExtra\", \"gt\", \"flextable\", \"huxtable\", \"DT\", \"markdown\" user choose default value, packages listed tried sequence. Session-specific configuration: options(\"modelsummary_factory_default\" = \"gt\") Persistent configuration: config_modelsummary(output = \"markdown\") Warning: Users supply file name output argument intend customize table external packages. See 'Details' section. LaTeX compilation requires booktabs siunitx packages, siunitx can disabled replaced global options. See 'Details' section. fmt format numeric values: integer, user-supplied function, modelsummary function. Integer: Number decimal digits User-supplied functions: function accepts numeric vector returns character vector length. modelsummary functions: fmt = fmt_significant(2): Two significant digits (term-level) fmt = fmt_sprintf(\"%.3f\"): See ?sprintf fmt = fmt_identity(): unformatted raw values title string notes list vector notes append bottom table. align string number characters equal number columns table (e.g., align = \"lcc\"). Valid characters: l, c, r, d. \"l\": left-aligned column \"c\": centered column \"r\": right-aligned column \"d\": dot-aligned column. LaTeX/PDF output, option requires least version 3.0.25 siunitx LaTeX package. commands must appear LaTeX preamble (added automatically compiling Rmarkdown documents PDF): \\usepackage{booktabs} \\usepackage{siunitx} \\newcolumntype{d}{S[ input-open-uncertainty=, input-close-uncertainty=, parse-numbers = false, table-align-text-pre=false, table-align-text-post=false ]} add_columns data.frame (tibble) number rows main table. add_rows data.frame (tibble) number columns main table. default, rows appended bottom table. can define \"position\" attribute integers set row positions. See Examples section . sparse_header TRUE FALSE. TRUE eliminates column headers unique label across columns, except row immediately data. FALSE keeps headers. order terms entered formula determines order headers appear. example, x~mean*z print mean-related header z-related header.` escape boolean TRUE escapes substitutes LaTeX/HTML characters prevent file compiling/displaying. setting affect captions notes. ... arguments passed table-making functions kableExtra::kbl, gt::gt, DT::datatable, etc. depending output argument. allows users pass arguments directly datasummary order affect behavior functions behind scenes.","code":""},{"path":"https://vincentarelbundock.github.io/modelsummary/dev/reference/dsummary.html","id":"details","dir":"Reference","previous_headings":"","what":"Details","title":"dsummary() is a shortcut to datasummary() — dsummary","text":"Visit 'modelsummary' website usage examples: https://vincentarelbundock.github.io/modelsummary 'datasummary' function thin wrapper around 'tabular' function 'tables' package. details table-making formulas can found 'tables' package documentation: ?tables::tabular Hierarchical \"nested\" column labels available output formats: kableExtra, gt, html, rtf, LaTeX. saving tables formats, nested labels combined \"flat\" header.","code":""},{"path":"https://vincentarelbundock.github.io/modelsummary/dev/reference/dsummary.html","id":"global-options","dir":"Reference","previous_headings":"","what":"Global Options","title":"dsummary() is a shortcut to datasummary() — dsummary","text":"behavior modelsummary can modified setting global options. example: options(modelsummary_model_labels = \"roman\") rest section describes options .","code":""},{"path":"https://vincentarelbundock.github.io/modelsummary/dev/reference/dsummary.html","id":"model-labels-default-column-names","dir":"Reference","previous_headings":"","what":"Model labels: default column names","title":"dsummary() is a shortcut to datasummary() — dsummary","text":"global option changes style default column headers: options(modelsummary_model_labels = \"roman\") options(modelsummary_panel_labels = \"roman\") supported styles : \"model\", \"panel\", \"arabic\", \"letters\", \"roman\", \"(arabic)\", \"(letters)\", \"(roman)\"\" panel-specific option used shape=\"rbind\"","code":""},{"path":"https://vincentarelbundock.github.io/modelsummary/dev/reference/dsummary.html","id":"table-making-packages","dir":"Reference","previous_headings":"","what":"Table-making packages","title":"dsummary() is a shortcut to datasummary() — dsummary","text":"modelsummary supports 4 table-making packages: kableExtra, gt, flextable, huxtable, DT. packages overlapping functionalities. example, 3 packages can export LaTeX. change default backend used specific file format, can use options function: options(modelsummary_factory_html = 'kableExtra') options(modelsummary_factory_latex = 'gt') options(modelsummary_factory_word = 'huxtable') options(modelsummary_factory_png = 'gt')","code":""},{"path":"https://vincentarelbundock.github.io/modelsummary/dev/reference/dsummary.html","id":"table-themes","dir":"Reference","previous_headings":"","what":"Table themes","title":"dsummary() is a shortcut to datasummary() — dsummary","text":"Change look tables automated replicable way, using modelsummary theming functionality. See vignette: https://vincentarelbundock.github.io/modelsummary/articles/appearance.html modelsummary_theme_gt modelsummary_theme_kableExtra modelsummary_theme_huxtable modelsummary_theme_flextable modelsummary_theme_dataframe","code":""},{"path":"https://vincentarelbundock.github.io/modelsummary/dev/reference/dsummary.html","id":"model-extraction-functions","dir":"Reference","previous_headings":"","what":"Model extraction functions","title":"dsummary() is a shortcut to datasummary() — dsummary","text":"modelsummary can use two sets packages extract information statistical models: easystats family (performance parameters) broom. default, uses easystats first falls back broom case failure. can change order priorities include goodness--fit extracted packages setting: options(modelsummary_get = \"broom\") options(modelsummary_get = \"easystats\") options(modelsummary_get = \"\")","code":""},{"path":"https://vincentarelbundock.github.io/modelsummary/dev/reference/dsummary.html","id":"formatting-numeric-entries","dir":"Reference","previous_headings":"","what":"Formatting numeric entries","title":"dsummary() is a shortcut to datasummary() — dsummary","text":"default, LaTeX tables enclose numeric entries \\num{} command siunitx package. prevent behavior, enclose numbers dollar signs (LaTeX math mode), users can call: options(modelsummary_format_numeric_latex = \"plain\") options(modelsummary_format_numeric_latex = \"mathmode\") similar option can used display numerical entries using MathJax HTML tables: options(modelsummary_format_numeric_html = \"mathjax\")","code":""},{"path":"https://vincentarelbundock.github.io/modelsummary/dev/reference/dsummary.html","id":"examples","dir":"Reference","previous_headings":"","what":"Examples","title":"dsummary() is a shortcut to datasummary() — dsummary","text":"","code":"library(modelsummary) # The left-hand side of the formula describes rows, and the right-hand side # describes columns. This table uses the \"mpg\" variable as a row and the \"mean\" # function as a column: datasummary(mpg ~ mean, data = mtcars) # This table uses the \"mean\" function as a row and the \"mpg\" variable as a column: datasummary(mean ~ mpg, data = mtcars) # Display several variables or functions of the data using the \"+\" # concatenation operator. This table has 2 rows and 2 columns: datasummary(hp + mpg ~ mean + sd, data = mtcars) # Nest variables or statistics inside a \"factor\" variable using the \"*\" nesting # operator. This table shows the mean of \"hp\" and \"mpg\" for each value of # \"cyl\": mtcars$cyl <- as.factor(mtcars$cyl) datasummary(hp + mpg ~ cyl * mean, data = mtcars) # If you don't want to convert your original data # to factors, you can use the 'Factor()' # function inside 'datasummary' to obtain an identical result: datasummary(hp + mpg ~ Factor(cyl) * mean, data = mtcars) # You can nest several variables or statistics inside a factor by using # parentheses. This table shows the mean and the standard deviation for each # subset of \"cyl\": datasummary(hp + mpg ~ cyl * (mean + sd), data = mtcars) # Summarize all numeric variables with 'All()' datasummary(All(mtcars) ~ mean + sd, data = mtcars) # Define custom summary statistics. Your custom function should accept a vector # of numeric values and return a single numeric or string value: minmax <- function(x) sprintf(\"[%.2f, %.2f]\", min(x), max(x)) mean_na <- function(x) mean(x, na.rm = TRUE) datasummary(hp + mpg ~ minmax + mean_na, data = mtcars) # To handle missing values, you can pass arguments to your functions using # '*Arguments()' datasummary(hp + mpg ~ mean * Arguments(na.rm = TRUE), data = mtcars) # For convenience, 'modelsummary' supplies several convenience functions # with the argument `na.rm=TRUE` by default: Mean, Median, Min, Max, SD, Var, # P0, P25, P50, P75, P100, NUnique, Histogram #datasummary(hp + mpg ~ Mean + SD + Histogram, data = mtcars) # These functions also accept a 'fmt' argument which allows you to # round/format the results datasummary(hp + mpg ~ Mean * Arguments(fmt = \"%.3f\") + SD * Arguments(fmt = \"%.1f\"), data = mtcars) # Save your tables to a variety of output formats: f <- hp + mpg ~ Mean + SD #datasummary(f, data = mtcars, output = 'table.html') #datasummary(f, data = mtcars, output = 'table.tex') #datasummary(f, data = mtcars, output = 'table.md') #datasummary(f, data = mtcars, output = 'table.docx') #datasummary(f, data = mtcars, output = 'table.pptx') #datasummary(f, data = mtcars, output = 'table.jpg') #datasummary(f, data = mtcars, output = 'table.png') # Display human-readable code #datasummary(f, data = mtcars, output = 'html') #datasummary(f, data = mtcars, output = 'markdown') #datasummary(f, data = mtcars, output = 'latex') # Return a table object to customize using a table-making package #datasummary(f, data = mtcars, output = 'gt') #datasummary(f, data = mtcars, output = 'kableExtra') #datasummary(f, data = mtcars, output = 'flextable') #datasummary(f, data = mtcars, output = 'huxtable') # add_rows new_rows <- data.frame(a = 1:2, b = 2:3, c = 4:5) attr(new_rows, 'position') <- c(1, 3) datasummary(mpg + hp ~ mean + sd, data = mtcars, add_rows = new_rows)"},{"path":"https://vincentarelbundock.github.io/modelsummary/dev/reference/dsummary.html","id":"references","dir":"Reference","previous_headings":"","what":"References","title":"dsummary() is a shortcut to datasummary() — dsummary","text":"Arel-Bundock V (2022). “modelsummary: Data Model Summaries R.” Journal Statistical Software, 103(1), 1-23. doi:10.18637/jss.v103.i01 .'","code":""},{"path":"https://vincentarelbundock.github.io/modelsummary/dev/reference/dvnames.html","id":null,"dir":"Reference","previous_headings":"","what":"Title models with their dependent variables — dvnames","title":"Title models with their dependent variables — dvnames","text":"convenience function use regression model list regression models. Returns named list models, names models' respective dependent variables. Pass list models dvnames sending modelsummary automatically get dependent variable-titled columns.","code":""},{"path":"https://vincentarelbundock.github.io/modelsummary/dev/reference/dvnames.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Title models with their dependent variables — dvnames","text":"","code":"dvnames(models, number = FALSE, strip = FALSE, fill = \"Model\")"},{"path":"https://vincentarelbundock.github.io/modelsummary/dev/reference/dvnames.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Title models with their dependent variables — dvnames","text":"models regression model list regression models number models numbered (1), (2), etc., addition dependent variable names? strip boolean FALSE returns dependent variable names appear model. TRUE returns dependent variable names appear data, without transformations. fill insight::find_response() find response, column title use place. Set ' ' leave blank.","code":""},{"path":"https://vincentarelbundock.github.io/modelsummary/dev/reference/dvnames.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Title models with their dependent variables — dvnames","text":"","code":"m1 <- lm(mpg ~ hp, data = mtcars) m2 <- lm(mpg ~ hp + wt, data = mtcars) # Without dvnames, column names are (1) and (2) modelsummary(list(m1, m2)) #> #> #> #> <\/th> #> | (1) <\/th> #> | (2) <\/th> #> <\/tr> #> <\/thead> #> | #> #> (Intercept) <\/td> #> | 30.099 <\/td> #> | 37.227 <\/td> #> <\/tr> #> | #> <\/td> #> | (1.634) <\/td> #> | (1.599) <\/td> #> <\/tr> #> | #> hp <\/td> #> | −0.068 <\/td> #> | −0.032 <\/td> #> <\/tr> #> | #> <\/td> #> | (0.010) <\/td> #> | (0.009) <\/td> #> <\/tr> #> | #> wt <\/td> #> | <\/td> #> | −3.878 <\/td> #> <\/tr> #> | #> <\/td> #> | <\/td> #> | (0.633) <\/td> #> <\/tr> #> | #> Num.Obs. <\/td> #> | 32 <\/td> #> | 32 <\/td> #> <\/tr> #> | #> R2 <\/td> #> | 0.602 <\/td> #> | 0.827 <\/td> #> <\/tr> #> | #> R2 Adj. <\/td> #> | 0.589 <\/td> #> | 0.815 <\/td> #> <\/tr> #> | #> AIC <\/td> #> | 181.2 <\/td> #> | 156.7 <\/td> #> <\/tr> #> | #> BIC <\/td> #> | 185.6 <\/td> #> | 162.5 <\/td> #> <\/tr> #> | #> Log.Lik. <\/td> #> | −87.619 <\/td> #> | −74.326 <\/td> #> <\/tr> #> | #> F <\/td> #> | 45.460 <\/td> #> | 69.211 <\/td> #> <\/tr> #> | #> RMSE <\/td> #> | 3.74 <\/td> #> | 2.47 <\/td> #> <\/tr> #> <\/tbody> #> <\/table> # With dvnames, they are \"mpg\" and \"mpg\" modelsummary(dvnames(list(m1,m2))) #> #> #> #> <\/th> #> | mpg <\/th> #> | mpg <\/th> #> <\/tr> #> <\/thead> #> | #> #> (Intercept) <\/td> #> | 30.099 <\/td> #> | 37.227 <\/td> #> <\/tr> #> | #> <\/td> #> | (1.634) <\/td> #> | (1.599) <\/td> #> <\/tr> #> | #> hp <\/td> #> | −0.068 <\/td> #> | −0.032 <\/td> #> <\/tr> #> | #> <\/td> #> | (0.010) <\/td> #> | (0.009) <\/td> #> <\/tr> #> | #> wt <\/td> #> | <\/td> #> | −3.878 <\/td> #> <\/tr> #> | #> <\/td> #> | <\/td> #> | (0.633) <\/td> #> <\/tr> #> | #> Num.Obs. <\/td> #> | 32 <\/td> #> | 32 <\/td> #> <\/tr> #> | #> R2 <\/td> #> | 0.602 <\/td> #> | 0.827 <\/td> #> <\/tr> #> | #> R2 Adj. <\/td> #> | 0.589 <\/td> #> | 0.815 <\/td> #> <\/tr> #> | #> AIC <\/td> #> | 181.2 <\/td> #> | 156.7 <\/td> #> <\/tr> #> | #> BIC <\/td> #> | 185.6 <\/td> #> | 162.5 <\/td> #> <\/tr> #> | #> Log.Lik. <\/td> #> | −87.619 <\/td> #> | −74.326 <\/td> #> <\/tr> #> | #> F <\/td> #> | 45.460 <\/td> #> | 69.211 <\/td> #> <\/tr> #> | #> RMSE <\/td> #> | 3.74 <\/td> #> | 2.47 <\/td> #> <\/tr> #> <\/tbody> #> <\/table>"},{"path":"https://vincentarelbundock.github.io/modelsummary/dev/reference/escape_html.html","id":null,"dir":"Reference","previous_headings":"","what":"Escape problematic characters to allow display in HTML — escape_html","title":"Escape problematic characters to allow display in HTML — escape_html","text":"Copied knitr internal use unexported CRAN rejects :::","code":""},{"path":"https://vincentarelbundock.github.io/modelsummary/dev/reference/escape_html.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Escape problematic characters to allow display in HTML — escape_html","text":"","code":"escape_html(x)"},{"path":"https://vincentarelbundock.github.io/modelsummary/dev/reference/escape_html.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Escape problematic characters to allow display in HTML — escape_html","text":"x character string escape","code":""},{"path":"https://vincentarelbundock.github.io/modelsummary/dev/reference/escape_latex.html","id":null,"dir":"Reference","previous_headings":"","what":"Escape problematic characters to allow compilation in LaTeX — escape_latex","title":"Escape problematic characters to allow compilation in LaTeX — escape_latex","text":"Copied knitr internal use unexported CRAN rejects :::","code":""},{"path":"https://vincentarelbundock.github.io/modelsummary/dev/reference/escape_latex.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Escape problematic characters to allow compilation in LaTeX — escape_latex","text":"","code":"escape_latex(x, newlines = FALSE, spaces = FALSE)"},{"path":"https://vincentarelbundock.github.io/modelsummary/dev/reference/escape_latex.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Escape problematic characters to allow compilation in LaTeX — escape_latex","text":"x character string escape newlines boolean spaces boolean","code":""},{"path":"https://vincentarelbundock.github.io/modelsummary/dev/reference/escape_string.html","id":null,"dir":"Reference","previous_headings":"","what":"Make sure LaTeX and HTML are safe to compile — escape_string","title":"Make sure LaTeX and HTML are safe to compile — escape_string","text":"Make sure LaTeX HTML safe compile","code":""},{"path":"https://vincentarelbundock.github.io/modelsummary/dev/reference/escape_string.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Make sure LaTeX and HTML are safe to compile — escape_string","text":"","code":"escape_string(x)"},{"path":"https://vincentarelbundock.github.io/modelsummary/dev/reference/fmt_decimal.html","id":null,"dir":"Reference","previous_headings":"","what":"Rounding with decimal digits in the fmt argument — fmt_decimal","title":"Rounding with decimal digits in the fmt argument — fmt_decimal","text":"Rounding decimal digits fmt argument","code":""},{"path":"https://vincentarelbundock.github.io/modelsummary/dev/reference/fmt_decimal.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Rounding with decimal digits in the fmt argument — fmt_decimal","text":"","code":"fmt_decimal(digits = 3, pdigits = NULL, ...)"},{"path":"https://vincentarelbundock.github.io/modelsummary/dev/reference/fmt_decimal.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Rounding with decimal digits in the fmt argument — fmt_decimal","text":"digits Number decimal digits keep, including trailing zeros. pdigits Number decimal digits keep p values. NULL, value digits used. ... Additional arguments passed format() function (e.g., big.marks, scientific). See ?format","code":""},{"path":"https://vincentarelbundock.github.io/modelsummary/dev/reference/fmt_sci.html","id":null,"dir":"Reference","previous_headings":"","what":"Rounding using scientific notation — fmt_sci","title":"Rounding using scientific notation — fmt_sci","text":"Rounding using scientific notation","code":""},{"path":"https://vincentarelbundock.github.io/modelsummary/dev/reference/fmt_sci.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Rounding using scientific notation — fmt_sci","text":"","code":"fmt_sci(digits = 3, ...)"},{"path":"https://vincentarelbundock.github.io/modelsummary/dev/reference/fmt_sci.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Rounding using scientific notation — fmt_sci","text":"digits positive integer indicating many significant digits used numeric complex x. ... additional arguments passed format().","code":""},{"path":"https://vincentarelbundock.github.io/modelsummary/dev/reference/fmt_significant.html","id":null,"dir":"Reference","previous_headings":"","what":"Rounding with significant digits in the fmt argument — fmt_significant","title":"Rounding with significant digits in the fmt argument — fmt_significant","text":"number decimal digits keep decimal assessed","code":""},{"path":"https://vincentarelbundock.github.io/modelsummary/dev/reference/fmt_significant.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Rounding with significant digits in the fmt argument — fmt_significant","text":"","code":"fmt_significant(digits = 3, ...)"},{"path":"https://vincentarelbundock.github.io/modelsummary/dev/reference/fmt_significant.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Rounding with significant digits in the fmt argument — fmt_significant","text":"digits Number significant digits keep. ... Additional arguments passed format() function (e.g., big.marks, scientific). See ?format","code":""},{"path":"https://vincentarelbundock.github.io/modelsummary/dev/reference/fmt_sprintf.html","id":null,"dir":"Reference","previous_headings":"","what":"Rounding with the sprintf() function in the fmt argument — fmt_sprintf","title":"Rounding with the sprintf() function in the fmt argument — fmt_sprintf","text":"Rounding sprintf() function fmt argument","code":""},{"path":"https://vincentarelbundock.github.io/modelsummary/dev/reference/fmt_sprintf.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Rounding with the sprintf() function in the fmt argument — fmt_sprintf","text":"","code":"fmt_sprintf(fmt)"},{"path":"https://vincentarelbundock.github.io/modelsummary/dev/reference/fmt_sprintf.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Rounding with the sprintf() function in the fmt argument — fmt_sprintf","text":"fmt string control sprintf(), \"%.3f\" keep 3 decimal digits. See ?sprintf","code":""},{"path":"https://vincentarelbundock.github.io/modelsummary/dev/reference/fmt_statistic.html","id":null,"dir":"Reference","previous_headings":"","what":"Rounding with decimal digits on a per-statistic basis in the fmt argument for modelsummary() — fmt_statistic","title":"Rounding with decimal digits on a per-statistic basis in the fmt argument for modelsummary() — fmt_statistic","text":"Rounding decimal digits per-statistic basis fmt argument modelsummary()","code":""},{"path":"https://vincentarelbundock.github.io/modelsummary/dev/reference/fmt_statistic.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Rounding with decimal digits on a per-statistic basis in the fmt argument for modelsummary() — fmt_statistic","text":"","code":"fmt_statistic(..., default = 3)"},{"path":"https://vincentarelbundock.github.io/modelsummary/dev/reference/fmt_statistic.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Rounding with decimal digits on a per-statistic basis in the fmt argument for modelsummary() — fmt_statistic","text":"... Statistic names fmt value default Number decimal digits keep unspecified terms","code":""},{"path":"https://vincentarelbundock.github.io/modelsummary/dev/reference/fmt_term.html","id":null,"dir":"Reference","previous_headings":"","what":"Rounding with decimal digits on a per-term basis in the fmt argument for modelsummary() — fmt_term","title":"Rounding with decimal digits on a per-term basis in the fmt argument for modelsummary() — fmt_term","text":"Rounding decimal digits per-term basis fmt argument modelsummary()","code":""},{"path":"https://vincentarelbundock.github.io/modelsummary/dev/reference/fmt_term.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Rounding with decimal digits on a per-term basis in the fmt argument for modelsummary() — fmt_term","text":"","code":"fmt_term(..., default = 3)"},{"path":"https://vincentarelbundock.github.io/modelsummary/dev/reference/fmt_term.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Rounding with decimal digits on a per-term basis in the fmt argument for modelsummary() — fmt_term","text":"... Term names fmt value default Number decimal digits keep unspecified terms","code":""},{"path":"https://vincentarelbundock.github.io/modelsummary/dev/reference/get_estimates.html","id":null,"dir":"Reference","previous_headings":"","what":"Extract model estimates in a tidy format. — get_estimates","title":"Extract model estimates in a tidy format. — get_estimates","text":"mostly internal function useful users want unified approach extract results wide variety models. models get_estimates attaches useful attributes output. can access information calling attributes function: attributes(get_estimates(model))","code":""},{"path":"https://vincentarelbundock.github.io/modelsummary/dev/reference/get_estimates.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Extract model estimates in a tidy format. — get_estimates","text":"","code":"get_estimates( model, conf_level = 0.95, vcov = NULL, shape = NULL, coef_rename = FALSE, ... )"},{"path":"https://vincentarelbundock.github.io/modelsummary/dev/reference/get_estimates.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Extract model estimates in a tidy format. — get_estimates","text":"model single model object conf_level numeric value 0 1. confidence level use confidence intervals. Setting argument NULL extract confidence intervals, can faster models. vcov robust standard errors manual statistics. vcov argument accepts six types input (see 'Details' 'Examples' sections ): NULL returns default uncertainty estimates model object string, vector, (named) list strings. \"iid\", \"classical\", \"constant\" aliases NULL, returns model's default uncertainty estimates. strings \"HC\", \"HC0\", \"HC1\" (alias: \"stata\"), \"HC2\", \"HC3\" (alias: \"robust\"), \"HC4\", \"HC4m\", \"HC5\", \"HAC\", \"NeweyWest\", \"Andrews\", \"panel-corrected\", \"outer-product\", \"weave\" use variance-covariance matrices computed using functions sandwich package, equivalent method. behavior functions can (sometimes must) altered passing arguments sandwich directly modelsummary ellipsis (...), safer define custom functions described next bullet. function (named) list functions return variance-covariance matrices row column names equal names coefficient estimates (e.g., stats::vcov, sandwich::vcovHC, function(x) vcovPC(x, cluster=\"country\")). formula (named) list formulas cluster variable(s) right-hand side (e.g., ~clusterid). named list length(models) variance-covariance matrices row column names equal names coefficient estimates. named list length(models) vectors names equal names coefficient estimates. See 'Examples' section . Warning: since list vectors can include arbitrary strings numbers, modelsummary automatically calculate p values. stars argument may thus use incorrect significance thresholds vcov list vectors. shape NULL, formula, string determines shape table. NULL: Default shape terms rows models columns. Formula: left side determines appears rows, right side determines appears columns. formula can include one group identifier(s) display related terms together, can useful models multivariate outcomes grouped coefficients (See examples section ). group identifier(s) must column names produced : get_estimates(model). group identifier(s) can combined term identifier single column using colon represent interaction. incomplete formula supplied (e.g., ~statistic), modelsummary tries complete automatically. Goodness--fit statistics appended bottom table model right hand side formula (.e., columns). Potential shape values include: term + statistic ~ model: default term ~ model + statistic: statistics separate columns model + statistic ~ term: models rows terms columns term + response + statistic ~ model: term group id separate columns term : response + statistic ~ model: term group id single column term ~ response String: \"rbind\" \"rcollapse\" bind rows two regression tables create \"panels\" \"stacks\" regression models. models argument must (potentially named) nested list models. Unnamed nested list 2 panels: list(list(model1, model2), list(model3, model4)) Named nested list 2 panels: list(\"Panel \" = list(model1, model2), \"Panel B\" = list(model3, model4)) Named panels named models: list(\"Panel \" = list(\"()\" = model1, \"(II)\" = model2), \"Panel B\" = list(\"()\" = model3, \"(II)\" = model4)) \"rbind\": Bind rows independent regression tables \"rcollapse\": Bind rows regression tables create panel bottom \"collapse\" goodness--fit statistics identical across models. coef_rename logical, named unnamed character vector, function Logical: TRUE renames variables based \"label\" attribute column. See Example section . Unnamed character vector length equal number coefficients final table, coef_omit applied. Named character vector: Values refer variable names appear table. Names refer original term names stored model object. Ex: c(\"hp:mpg\"=\"hp X mpg\") Function: Accepts character vector model's term names returns named vector like one described . modelsummary package supplies coef_rename() function can common cleaning tasks: modelsummary(model, coef_rename = coef_rename) ... arguments passed three functions. See documentation functions lists available arguments. parameters::model_parameters extracts parameter estimates. Available arguments depend model type, include: standardize, centrality, dispersion, test, ci_method, prior, diagnostic, rope_range, power, cluster, etc. performance::model_performance extracts goodness--fit statistics. Available arguments depend model type, include: metrics, estimator, etc. kableExtra::kbl gt::gt draw tables, depending value output argument.","code":""},{"path":"https://vincentarelbundock.github.io/modelsummary/dev/reference/get_gof.html","id":null,"dir":"Reference","previous_headings":"","what":"Extract model gof A mostly internal function with some potential uses\noutside. — get_gof","title":"Extract model gof A mostly internal function with some potential uses\noutside. — get_gof","text":"Extract model gof mostly internal function potential uses outside.","code":""},{"path":"https://vincentarelbundock.github.io/modelsummary/dev/reference/get_gof.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Extract model gof A mostly internal function with some potential uses\noutside. — get_gof","text":"","code":"get_gof(model, vcov_type = NULL, ...)"},{"path":"https://vincentarelbundock.github.io/modelsummary/dev/reference/get_gof.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Extract model gof A mostly internal function with some potential uses\noutside. — get_gof","text":"model single model object vcov_type string vcov type add bottom table ... arguments passed three functions. See documentation functions lists available arguments. parameters::model_parameters extracts parameter estimates. Available arguments depend model type, include: standardize, centrality, dispersion, test, ci_method, prior, diagnostic, rope_range, power, cluster, etc. performance::model_performance extracts goodness--fit statistics. Available arguments depend model type, include: metrics, estimator, etc. kableExtra::kbl gt::gt draw tables, depending value output argument.","code":""},{"path":"https://vincentarelbundock.github.io/modelsummary/dev/reference/get_gof_broom.html","id":null,"dir":"Reference","previous_headings":"","what":"Extract goodness-of-fit statistics from a single model using the\nbroom package or another package with package which supplies a\nmethod for the generics::glance generic. — get_gof_broom","title":"Extract goodness-of-fit statistics from a single model using the\nbroom package or another package with package which supplies a\nmethod for the generics::glance generic. — get_gof_broom","text":"Extract goodness--fit statistics single model using broom package another package package supplies method generics::glance generic.","code":""},{"path":"https://vincentarelbundock.github.io/modelsummary/dev/reference/get_gof_broom.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Extract goodness-of-fit statistics from a single model using the\nbroom package or another package with package which supplies a\nmethod for the generics::glance generic. — get_gof_broom","text":"","code":"get_gof_broom(model, ...)"},{"path":"https://vincentarelbundock.github.io/modelsummary/dev/reference/get_gof_parameters.html","id":null,"dir":"Reference","previous_headings":"","what":"Extract goodness-of-fit statistics from a single model using\nthe performance package — get_gof_parameters","title":"Extract goodness-of-fit statistics from a single model using\nthe performance package — get_gof_parameters","text":"Extract goodness--fit statistics single model using performance package","code":""},{"path":"https://vincentarelbundock.github.io/modelsummary/dev/reference/get_gof_parameters.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Extract goodness-of-fit statistics from a single model using\nthe performance package — get_gof_parameters","text":"","code":"get_gof_parameters(model, ...)"},{"path":"https://vincentarelbundock.github.io/modelsummary/dev/reference/get_vcov.html","id":null,"dir":"Reference","previous_headings":"","what":"Allow users to override uncertainty estimates — get_vcov","title":"Allow users to override uncertainty estimates — get_vcov","text":"Allow users override uncertainty estimates","code":""},{"path":"https://vincentarelbundock.github.io/modelsummary/dev/reference/get_vcov.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Allow users to override uncertainty estimates — get_vcov","text":"","code":"get_vcov(model, vcov = NULL, ...)"},{"path":"https://vincentarelbundock.github.io/modelsummary/dev/reference/get_vcov.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Allow users to override uncertainty estimates — get_vcov","text":"model object type available tidy method. vcov robust standard errors manual statistics. vcov argument accepts six types input (see 'Details' 'Examples' sections ): NULL returns default uncertainty estimates model object string, vector, (named) list strings. \"iid\", \"classical\", \"constant\" aliases NULL, returns model's default uncertainty estimates. strings \"HC\", \"HC0\", \"HC1\" (alias: \"stata\"), \"HC2\", \"HC3\" (alias: \"robust\"), \"HC4\", \"HC4m\", \"HC5\", \"HAC\", \"NeweyWest\", \"Andrews\", \"panel-corrected\", \"outer-product\", \"weave\" use variance-covariance matrices computed using functions sandwich package, equivalent method. behavior functions can (sometimes must) altered passing arguments sandwich directly modelsummary ellipsis (...), safer define custom functions described next bullet. function (named) list functions return variance-covariance matrices row column names equal names coefficient estimates (e.g., stats::vcov, sandwich::vcovHC, function(x) vcovPC(x, cluster=\"country\")). formula (named) list formulas cluster variable(s) right-hand side (e.g., ~clusterid). named list length(models) variance-covariance matrices row column names equal names coefficient estimates. named list length(models) vectors names equal names coefficient estimates. See 'Examples' section . Warning: since list vectors can include arbitrary strings numbers, modelsummary automatically calculate p values. stars argument may thus use incorrect significance thresholds vcov list vectors. ... arguments passed three functions. See documentation functions lists available arguments. parameters::model_parameters extracts parameter estimates. Available arguments depend model type, include: standardize, centrality, dispersion, test, ci_method, prior, diagnostic, rope_range, power, cluster, etc. performance::model_performance extracts goodness--fit statistics. Available arguments depend model type, include: metrics, estimator, etc. kableExtra::kbl gt::gt draw tables, depending value output argument.","code":""},{"path":"https://vincentarelbundock.github.io/modelsummary/dev/reference/get_vcov.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Allow users to override uncertainty estimates — get_vcov","text":"numeric vector test statistics","code":""},{"path":"https://vincentarelbundock.github.io/modelsummary/dev/reference/get_vcov.mlm.html","id":null,"dir":"Reference","previous_headings":"","what":"Allow users to override uncertainty estimates — get_vcov.mlm","title":"Allow users to override uncertainty estimates — get_vcov.mlm","text":"Allow users override uncertainty estimates","code":""},{"path":"https://vincentarelbundock.github.io/modelsummary/dev/reference/get_vcov.mlm.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Allow users to override uncertainty estimates — get_vcov.mlm","text":"","code":"# S3 method for mlm get_vcov(model, vcov = NULL, conf_level = NULL, ...)"},{"path":"https://vincentarelbundock.github.io/modelsummary/dev/reference/get_vcov.mlm.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Allow users to override uncertainty estimates — get_vcov.mlm","text":"model object type available tidy method. vcov robust standard errors manual statistics. vcov argument accepts six types input (see 'Details' 'Examples' sections ): NULL returns default uncertainty estimates model object string, vector, (named) list strings. \"iid\", \"classical\", \"constant\" aliases NULL, returns model's default uncertainty estimates. strings \"HC\", \"HC0\", \"HC1\" (alias: \"stata\"), \"HC2\", \"HC3\" (alias: \"robust\"), \"HC4\", \"HC4m\", \"HC5\", \"HAC\", \"NeweyWest\", \"Andrews\", \"panel-corrected\", \"outer-product\", \"weave\" use variance-covariance matrices computed using functions sandwich package, equivalent method. behavior functions can (sometimes must) altered passing arguments sandwich directly modelsummary ellipsis (...), safer define custom functions described next bullet. function (named) list functions return variance-covariance matrices row column names equal names coefficient estimates (e.g., stats::vcov, sandwich::vcovHC, function(x) vcovPC(x, cluster=\"country\")). formula (named) list formulas cluster variable(s) right-hand side (e.g., ~clusterid). named list length(models) variance-covariance matrices row column names equal names coefficient estimates. named list length(models) vectors names equal names coefficient estimates. See 'Examples' section . Warning: since list vectors can include arbitrary strings numbers, modelsummary automatically calculate p values. stars argument may thus use incorrect significance thresholds vcov list vectors. ... arguments passed three functions. See documentation functions lists available arguments. parameters::model_parameters extracts parameter estimates. Available arguments depend model type, include: standardize, centrality, dispersion, test, ci_method, prior, diagnostic, rope_range, power, cluster, etc. performance::model_performance extracts goodness--fit statistics. Available arguments depend model type, include: metrics, estimator, etc. kableExtra::kbl gt::gt draw tables, depending value output argument.","code":""},{"path":"https://vincentarelbundock.github.io/modelsummary/dev/reference/get_vcov.mlm.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Allow users to override uncertainty estimates — get_vcov.mlm","text":"numeric vector test statistics","code":""},{"path":"https://vincentarelbundock.github.io/modelsummary/dev/reference/glance_custom.html","id":null,"dir":"Reference","previous_headings":"","what":"Extract custom information from a model object and turn it into a tidy\ndata.frame or tibble with a single row. — glance_custom","title":"Extract custom information from a model object and turn it into a tidy\ndata.frame or tibble with a single row. — glance_custom","text":"customize output model class lm, can define new method called glance_custom.lm returns one-row data.frame.","code":""},{"path":"https://vincentarelbundock.github.io/modelsummary/dev/reference/glance_custom.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Extract custom information from a model object and turn it into a tidy\ndata.frame or tibble with a single row. — glance_custom","text":"","code":"glance_custom(x, ...)"},{"path":"https://vincentarelbundock.github.io/modelsummary/dev/reference/glance_custom.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Extract custom information from a model object and turn it into a tidy\ndata.frame or tibble with a single row. — glance_custom","text":"x model R object convert single-row data frame ... ellipsis","code":""},{"path":"https://vincentarelbundock.github.io/modelsummary/dev/reference/glance_custom_internal.default.html","id":null,"dir":"Reference","previous_headings":"","what":"Avoid namespace conflict when we want to customize glance internally and\nstill allow users to do the same with their own functions — glance_custom_internal.default","title":"Avoid namespace conflict when we want to customize glance internally and\nstill allow users to do the same with their own functions — glance_custom_internal.default","text":"Avoid namespace conflict want customize glance internally still allow users functions","code":""},{"path":"https://vincentarelbundock.github.io/modelsummary/dev/reference/glance_custom_internal.default.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Avoid namespace conflict when we want to customize glance internally and\nstill allow users to do the same with their own functions — glance_custom_internal.default","text":"","code":"# S3 method for default glance_custom_internal(x, ...)"},{"path":"https://vincentarelbundock.github.io/modelsummary/dev/reference/glance_custom_internal.html","id":null,"dir":"Reference","previous_headings":"","what":"Avoid namespace conflict when we want to customize glance internally and\nstill allow users to do the same with their own functions — glance_custom_internal","title":"Avoid namespace conflict when we want to customize glance internally and\nstill allow users to do the same with their own functions — glance_custom_internal","text":"Avoid namespace conflict want customize glance internally still allow users functions","code":""},{"path":"https://vincentarelbundock.github.io/modelsummary/dev/reference/glance_custom_internal.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Avoid namespace conflict when we want to customize glance internally and\nstill allow users to do the same with their own functions — glance_custom_internal","text":"","code":"glance_custom_internal(x, ...)"},{"path":"https://vincentarelbundock.github.io/modelsummary/dev/reference/glance_custom_internal.lm.html","id":null,"dir":"Reference","previous_headings":"","what":"Avoid namespace conflict when we want to customize glance internally and\nstill allow users to do the same with their own functions — glance_custom_internal.lm","title":"Avoid namespace conflict when we want to customize glance internally and\nstill allow users to do the same with their own functions — glance_custom_internal.lm","text":"Avoid namespace conflict want customize glance internally still allow users functions","code":""},{"path":"https://vincentarelbundock.github.io/modelsummary/dev/reference/glance_custom_internal.lm.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Avoid namespace conflict when we want to customize glance internally and\nstill allow users to do the same with their own functions — glance_custom_internal.lm","text":"","code":"# S3 method for lm glance_custom_internal(x, vcov_type = NULL, gof = NULL, ...)"},{"path":"https://vincentarelbundock.github.io/modelsummary/dev/reference/gof_map.html","id":null,"dir":"Reference","previous_headings":"","what":"Data.frame used to clean up and format goodness-of-fit statistics — gof_map","title":"Data.frame used to clean up and format goodness-of-fit statistics — gof_map","text":"default, data frame passed 'gof_map' argument 'modelsummary' function. Users can modify data frame customize list statistics display format. See example .","code":""},{"path":"https://vincentarelbundock.github.io/modelsummary/dev/reference/gof_map.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Data.frame used to clean up and format goodness-of-fit statistics — gof_map","text":"","code":"gof_map"},{"path":"https://vincentarelbundock.github.io/modelsummary/dev/reference/gof_map.html","id":"format","dir":"Reference","previous_headings":"","what":"Format","title":"Data.frame used to clean up and format goodness-of-fit statistics — gof_map","text":"data.frame 4 columns character data: raw, clean, fmt, omit","code":""},{"path":"https://vincentarelbundock.github.io/modelsummary/dev/reference/gof_map.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Data.frame used to clean up and format goodness-of-fit statistics — gof_map","text":"","code":"if (identical(Sys.getenv(\"pkgdown\"), \"true\")) { library(modelsummary) mod <- lm(wt ~ drat, data = mtcars) gm <- modelsummary::gof_map gm$omit[gm$raw == 'deviance'] <- FALSE gm$fmt[gm$raw == 'r.squared'] <- \"%.5f\" modelsummary(mod, gof_map = gm) } #> Error: Assertion failed. One of the following must apply: #> * checkmate::check_numeric(fmt): Must be of type 'numeric', not #> * 'character' #> * checkmate::check_class(fmt): Must inherit from class 'fmt_factory', #> * but has class 'character' #> * checkmate::check_function(fmt): Must be a function, not 'character' #> * checkmate::check_string(fmt): Must comply to pattern '%' #> * checkmate::check_null(fmt): Must be NULL"},{"path":"https://vincentarelbundock.github.io/modelsummary/dev/reference/hush.html","id":null,"dir":"Reference","previous_headings":"","what":"Execute code silently — hush","title":"Execute code silently — hush","text":"Execute code silently","code":""},{"path":"https://vincentarelbundock.github.io/modelsummary/dev/reference/hush.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Execute code silently — hush","text":"","code":"hush(code)"},{"path":"https://vincentarelbundock.github.io/modelsummary/dev/reference/labelSubset.html","id":null,"dir":"Reference","previous_headings":"","what":"Add a label to a logical vector. — labelSubset","title":"Add a label to a logical vector. — labelSubset","text":"objects imported packages. Follow links see documentation. tables labelSubset","code":""},{"path":"https://vincentarelbundock.github.io/modelsummary/dev/reference/map_estimates.html","id":null,"dir":"Reference","previous_headings":"","what":"rename and reorder estimates from a single model\n(before merging to collapse) — map_estimates","title":"rename and reorder estimates from a single model\n(before merging to collapse) — map_estimates","text":"rename reorder estimates single model (merging collapse)","code":""},{"path":"https://vincentarelbundock.github.io/modelsummary/dev/reference/map_estimates.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"rename and reorder estimates from a single model\n(before merging to collapse) — map_estimates","text":"","code":"map_estimates(estimates, coef_rename, coef_map, coef_omit, group_map)"},{"path":"https://vincentarelbundock.github.io/modelsummary/dev/reference/map_gof.html","id":null,"dir":"Reference","previous_headings":"","what":"Internal function to subset, rename and re-order gof statistics — map_gof","title":"Internal function to subset, rename and re-order gof statistics — map_gof","text":"Internal function subset, rename re-order gof statistics","code":""},{"path":"https://vincentarelbundock.github.io/modelsummary/dev/reference/map_gof.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Internal function to subset, rename and re-order gof statistics — map_gof","text":"","code":"map_gof(gof, gof_omit, gof_map)"},{"path":"https://vincentarelbundock.github.io/modelsummary/dev/reference/modelplot.html","id":null,"dir":"Reference","previous_headings":"","what":"Model Summary Plots with Estimates and Confidence Intervals — modelplot","title":"Model Summary Plots with Estimates and Confidence Intervals — modelplot","text":"Dot-Whisker plot coefficient estimates confidence intervals. information, see Details Examples sections , vignettes modelsummary website: https://vincentarelbundock.github.io/modelsummary/ modelplot Vignette.","code":""},{"path":"https://vincentarelbundock.github.io/modelsummary/dev/reference/modelplot.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Model Summary Plots with Estimates and Confidence Intervals — modelplot","text":"","code":"modelplot( models, conf_level = 0.95, coef_map = NULL, coef_omit = NULL, coef_rename = NULL, vcov = NULL, exponentiate = FALSE, add_rows = NULL, facet = FALSE, draw = TRUE, background = NULL, ... )"},{"path":"https://vincentarelbundock.github.io/modelsummary/dev/reference/modelplot.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Model Summary Plots with Estimates and Confidence Intervals — modelplot","text":"models model, (named) list models, nested list models. Single model: modelsummary(model) Unnamed list models: modelsummary(list(model1, model2)) Models labelled automatically. default label style can altered setting global option. See . Named list models: modelsummary(list(\"\"=model1, \"B\"=model2)) Models labelled using list names. Nested list models: using shape=\"rbind\" argument, models can nested list models display \"panels\" \"stacks\" regression models. See shape argument documentation examples . conf_level numeric value 0 1. confidence level use confidence intervals. Setting argument NULL extract confidence intervals, can faster models. coef_map character vector. Subset, rename, reorder coefficients. Coefficients omitted vector omitted table. order vector determines order table. coef_map can named unnamed character vector. coef_map named vector, values define labels must appear table, names identify original term names stored model object: c(\"hp:mpg\"=\"HPxM/G\"). See Examples section . coef_omit integer vector regular expression identify coefficients omit (keep) table. Positive integers determine coefficients omit. Negative integers determine coefficients keep. regular expression can used omit coefficients, perl-compatible \"negative lookaheads\" can used specify coefficients keep table. Examples: c(2, 3, 5): omits second, third, fifth coefficients. c(-2, -3, -5): negative values keep second, third, fifth coefficients. \"ei\": omit coefficients matching \"ei\" substring. \"^Volume$\": omit \"Volume\" coefficient. \"ei|rc\": omit coefficients matching either \"ei\" \"rc\" substrings. \"^(?!Vol)\": keep coefficients starting \"Vol\" (inverse match using negative lookahead). \"^(?!.*ei)\": keep coefficients matching \"ei\" substring. \"^(?!.*ei|.*pt)\": keep coefficients matching either \"ei\" \"pt\" substrings. See Examples section complete code. coef_rename logical, named unnamed character vector, function Logical: TRUE renames variables based \"label\" attribute column. See Example section . Unnamed character vector length equal number coefficients final table, coef_omit applied. Named character vector: Values refer variable names appear table. Names refer original term names stored model object. Ex: c(\"hp:mpg\"=\"hp X mpg\") Function: Accepts character vector model's term names returns named vector like one described . modelsummary package supplies coef_rename() function can common cleaning tasks: modelsummary(model, coef_rename = coef_rename) vcov robust standard errors manual statistics. vcov argument accepts six types input (see 'Details' 'Examples' sections ): NULL returns default uncertainty estimates model object string, vector, (named) list strings. \"iid\", \"classical\", \"constant\" aliases NULL, returns model's default uncertainty estimates. strings \"HC\", \"HC0\", \"HC1\" (alias: \"stata\"), \"HC2\", \"HC3\" (alias: \"robust\"), \"HC4\", \"HC4m\", \"HC5\", \"HAC\", \"NeweyWest\", \"Andrews\", \"panel-corrected\", \"outer-product\", \"weave\" use variance-covariance matrices computed using functions sandwich package, equivalent method. behavior functions can (sometimes must) altered passing arguments sandwich directly modelsummary ellipsis (...), safer define custom functions described next bullet. function (named) list functions return variance-covariance matrices row column names equal names coefficient estimates (e.g., stats::vcov, sandwich::vcovHC, function(x) vcovPC(x, cluster=\"country\")). formula (named) list formulas cluster variable(s) right-hand side (e.g., ~clusterid). named list length(models) variance-covariance matrices row column names equal names coefficient estimates. named list length(models) vectors names equal names coefficient estimates. See 'Examples' section . Warning: since list vectors can include arbitrary strings numbers, modelsummary automatically calculate p values. stars argument may thus use incorrect significance thresholds vcov list vectors. exponentiate TRUE, FALSE, logical vector length equal number models. TRUE, estimate, conf.low, conf.high statistics exponentiated, std.error transformed exp(estimate)*std.error. add_rows data.frame (tibble) number columns main table. default, rows appended bottom table. can define \"position\" attribute integers set row positions. See Examples section . facet TRUE FALSE. 'models' argument includes several model objects, TRUE draws terms separate facets, FALSE draws terms side--side (dodged). draw TRUE returns 'ggplot2' object, FALSE returns data.frame used draw plot. background list 'ggplot2' geoms add background plot. especially useful display annotations \"behind\" 'geom_pointrange' 'modelplot' draws. ... arguments passed three functions. See documentation functions lists available arguments. parameters::model_parameters extracts parameter estimates. Available arguments depend model type, include: standardize, centrality, dispersion, test, ci_method, prior, diagnostic, rope_range, power, cluster, etc. performance::model_performance extracts goodness--fit statistics. Available arguments depend model type, include: metrics, estimator, etc. kableExtra::kbl gt::gt draw tables, depending value output argument.","code":""},{"path":"https://vincentarelbundock.github.io/modelsummary/dev/reference/modelplot.html","id":"examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Model Summary Plots with Estimates and Confidence Intervals — modelplot","text":"","code":"library(modelsummary) # single model mod <- lm(hp ~ vs + drat, mtcars) modelplot(mod) # omit terms with string matches or regexes modelplot(mod, coef_omit = 'Interc') # rename, reorder and subset with 'coef_map' cm <- c('vs' = 'V-shape engine', 'drat' = 'Rear axle ratio') modelplot(mod, coef_map = cm) # several models models <- list() models[['Small model']] <- lm(hp ~ vs, mtcars) models[['Medium model']] <- lm(hp ~ vs + factor(cyl), mtcars) models[['Large model']] <- lm(hp ~ vs + drat + factor(cyl), mtcars) modelplot(models) # add_rows: add an empty reference category mod <- lm(hp ~ factor(cyl), mtcars) add_rows = data.frame( term = \"factory(cyl)4\", model = \"(1)\", estimate = NA) attr(add_rows, \"position\") = 3 modelplot(mod, add_rows = add_rows) # customize your plots with 'ggplot2' functions library(ggplot2) modelplot(models) + scale_color_brewer(type = 'qual') + theme_classic() # pass arguments to 'geom_pointrange' through the ... ellipsis modelplot(mod, color = 'red', size = 1, fatten = .5) # add geoms to the background, behind geom_pointrange b <- list(geom_vline(xintercept = 0, color = 'orange'), annotate(\"rect\", alpha = .1, xmin = -.5, xmax = .5, ymin = -Inf, ymax = Inf), geom_point(aes(y = term, x = estimate), alpha = .3, size = 10, color = 'red', shape = 'square')) modelplot(mod, background = b) # logistic regression example df <- as.data.frame(Titanic) mod_titanic <- glm( Survived ~ Class + Sex, family = binomial, weight = Freq, data = df ) # displaying odds ratio using a log scale modelplot(mod_titanic, exponentiate = TRUE) + scale_x_log10() + xlab(\"Odds Ratios and 95% confidence intervals\")"},{"path":"https://vincentarelbundock.github.io/modelsummary/dev/reference/modelplot.html","id":"references","dir":"Reference","previous_headings":"","what":"References","title":"Model Summary Plots with Estimates and Confidence Intervals — modelplot","text":"Arel-Bundock V (2022). “modelsummary: Data Model Summaries R.” Journal Statistical Software, 103(1), 1-23. doi:10.18637/jss.v103.i01 .'","code":""},{"path":"https://vincentarelbundock.github.io/modelsummary/dev/reference/modelsummary.html","id":null,"dir":"Reference","previous_headings":"","what":"Model Summary Tables — modelsummary","title":"Model Summary Tables — modelsummary","text":"Create beautiful customizable tables summarize several statistical models side--side. function supports dozens statistical models, can produce tables HTML, LaTeX, Word, Markdown, PDF, PowerPoint, Excel, RTF, JPG, PNG. appearance tables can customized extensively specifying output argument, using functions one supported table customization packages: kableExtra, gt, flextable, huxtable, DT. information, see Details Examples sections , vignettes modelsummary website: https://vincentarelbundock.github.io/modelsummary/ modelsummary Vignette includes dozens examples tables extensive customizations. Appearance Vignette shows modify look tables.","code":""},{"path":"https://vincentarelbundock.github.io/modelsummary/dev/reference/modelsummary.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Model Summary Tables — modelsummary","text":"","code":"modelsummary( models, output = \"default\", fmt = 3, estimate = \"estimate\", statistic = \"std.error\", vcov = NULL, conf_level = 0.95, exponentiate = FALSE, stars = FALSE, shape = term + statistic ~ model, coef_map = NULL, coef_omit = NULL, coef_rename = FALSE, gof_map = NULL, gof_omit = NULL, group_map = NULL, add_columns = NULL, add_rows = NULL, align = NULL, notes = NULL, title = NULL, escape = TRUE, ... )"},{"path":"https://vincentarelbundock.github.io/modelsummary/dev/reference/modelsummary.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Model Summary Tables — modelsummary","text":"models model, (named) list models, nested list models. Single model: modelsummary(model) Unnamed list models: modelsummary(list(model1, model2)) Models labelled automatically. default label style can altered setting global option. See . Named list models: modelsummary(list(\"\"=model1, \"B\"=model2)) Models labelled using list names. Nested list models: using shape=\"rbind\" argument, models can nested list models display \"panels\" \"stacks\" regression models. See shape argument documentation examples . output filename object type (character string) Supported filename extensions: .docx, .html, .tex, .md, .txt, .csv, .xlsx, .png, .jpg Supported object types: \"default\", \"html\", \"markdown\", \"latex\", \"latex_tabular\", \"data.frame\", \"gt\", \"kableExtra\", \"huxtable\", \"flextable\", \"DT\", \"jupyter\". \"modelsummary_list\" value produces lightweight object can saved fed back modelsummary function. \"default\" output format can set \"kableExtra\", \"gt\", \"flextable\", \"huxtable\", \"DT\", \"markdown\" user choose default value, packages listed tried sequence. Session-specific configuration: options(\"modelsummary_factory_default\" = \"gt\") Persistent configuration: config_modelsummary(output = \"markdown\") Warning: Users supply file name output argument intend customize table external packages. See 'Details' section. LaTeX compilation requires booktabs siunitx packages, siunitx can disabled replaced global options. See 'Details' section. fmt format numeric values: integer, user-supplied function, modelsummary function. Integer: Number decimal digits User-supplied functions: function accepts numeric vector returns character vector length. modelsummary functions: fmt = fmt_significant(2): Two significant digits (term-level) fmt = fmt_decimal(digits = 2, pdigits = 3): Decimal digits estimate p values fmt = fmt_sprintf(\"%.3f\"): See ?sprintf fmt = fmt_term(\"(Intercept)\" = 1, \"X\" = 2): Format terms differently fmt = fmt_statistic(\"estimate\" = 1, \"r.sqared\" = 6): Format statistics differently. fmt = fmt_identity(): unformatted raw values string: Note LaTeX output: ensure proper typography, numeric entries enclosed \\num{} command, requires siunitx package loaded LaTeX preamble. behavior can altered global options. See 'Details' section. estimate single string character vector length equal number models. Valid entries include column name data.frame produced get_estimates(model), strings curly braces compatible glue package format. Examples: \"estimate\" \"{estimate} ({std.error}){stars}\" \"{estimate} [{conf.low}, {conf.high}]\" statistic vector strings glue strings select uncertainty statistics report vertically estimate. NULL omits uncertainty statistics. \"conf.int\", \"std.error\", \"statistic\", \"p.value\", \"conf.low\", \"conf.high\", . column name produced get_estimates(model) glue package strings braces, without R functions, : \"{p.value} [{conf.low}, {conf.high}]\" \"Std.Error: {std.error}\" `\"exp(estimate) * std.error\" Numbers automatically rounded converted strings. apply functions numeric values, last glue example, users must set fmt=NULL. Parentheses added automatically unless string includes glue curly braces {}. statistics supported models. See column names get_estimates(model), visit website learn add custom statistics. vcov robust standard errors manual statistics. vcov argument accepts six types input (see 'Details' 'Examples' sections ): NULL returns default uncertainty estimates model object string, vector, (named) list strings. \"iid\", \"classical\", \"constant\" aliases NULL, returns model's default uncertainty estimates. strings \"HC\", \"HC0\", \"HC1\" (alias: \"stata\"), \"HC2\", \"HC3\" (alias: \"robust\"), \"HC4\", \"HC4m\", \"HC5\", \"HAC\", \"NeweyWest\", \"Andrews\", \"panel-corrected\", \"outer-product\", \"weave\" use variance-covariance matrices computed using functions sandwich package, equivalent method. behavior functions can (sometimes must) altered passing arguments sandwich directly modelsummary ellipsis (...), safer define custom functions described next bullet. function (named) list functions return variance-covariance matrices row column names equal names coefficient estimates (e.g., stats::vcov, sandwich::vcovHC, function(x) vcovPC(x, cluster=\"country\")). formula (named) list formulas cluster variable(s) right-hand side (e.g., ~clusterid). named list length(models) variance-covariance matrices row column names equal names coefficient estimates. named list length(models) vectors names equal names coefficient estimates. See 'Examples' section . Warning: since list vectors can include arbitrary strings numbers, modelsummary automatically calculate p values. stars argument may thus use incorrect significance thresholds vcov list vectors. conf_level numeric value 0 1. confidence level use confidence intervals. Setting argument NULL extract confidence intervals, can faster models. exponentiate TRUE, FALSE, logical vector length equal number models. TRUE, estimate, conf.low, conf.high statistics exponentiated, std.error transformed exp(estimate)*std.error. stars indicate statistical significance FALSE (default): significance stars. TRUE: +=.1, *=.05, **=.01, ***=0.001 Named numeric vector custom stars c('*' = .1, '+' = .05) Note: legend inserted bottom table estimate statistic arguments use \"glue strings\" {stars}. shape NULL, formula, string determines shape table. NULL: Default shape terms rows models columns. Formula: left side determines appears rows, right side determines appears columns. formula can include one group identifier(s) display related terms together, can useful models multivariate outcomes grouped coefficients (See examples section ). group identifier(s) must column names produced : get_estimates(model). group identifier(s) can combined term identifier single column using colon represent interaction. incomplete formula supplied (e.g., ~statistic), modelsummary tries complete automatically. Goodness--fit statistics appended bottom table model right hand side formula (.e., columns). Potential shape values include: term + statistic ~ model: default term ~ model + statistic: statistics separate columns model + statistic ~ term: models rows terms columns term + response + statistic ~ model: term group id separate columns term : response + statistic ~ model: term group id single column term ~ response String: \"rbind\" \"rcollapse\" bind rows two regression tables create \"panels\" \"stacks\" regression models. models argument must (potentially named) nested list models. Unnamed nested list 2 panels: list(list(model1, model2), list(model3, model4)) Named nested list 2 panels: list(\"Panel \" = list(model1, model2), \"Panel B\" = list(model3, model4)) Named panels named models: list(\"Panel \" = list(\"()\" = model1, \"(II)\" = model2), \"Panel B\" = list(\"()\" = model3, \"(II)\" = model4)) \"rbind\": Bind rows independent regression tables \"rcollapse\": Bind rows regression tables create panel bottom \"collapse\" goodness--fit statistics identical across models. coef_map character vector. Subset, rename, reorder coefficients. Coefficients omitted vector omitted table. order vector determines order table. coef_map can named unnamed character vector. coef_map named vector, values define labels must appear table, names identify original term names stored model object: c(\"hp:mpg\"=\"HPxM/G\"). See Examples section . coef_omit integer vector regular expression identify coefficients omit (keep) table. Positive integers determine coefficients omit. Negative integers determine coefficients keep. regular expression can used omit coefficients, perl-compatible \"negative lookaheads\" can used specify coefficients keep table. Examples: c(2, 3, 5): omits second, third, fifth coefficients. c(-2, -3, -5): negative values keep second, third, fifth coefficients. \"ei\": omit coefficients matching \"ei\" substring. \"^Volume$\": omit \"Volume\" coefficient. \"ei|rc\": omit coefficients matching either \"ei\" \"rc\" substrings. \"^(?!Vol)\": keep coefficients starting \"Vol\" (inverse match using negative lookahead). \"^(?!.*ei)\": keep coefficients matching \"ei\" substring. \"^(?!.*ei|.*pt)\": keep coefficients matching either \"ei\" \"pt\" substrings. See Examples section complete code. coef_rename logical, named unnamed character vector, function Logical: TRUE renames variables based \"label\" attribute column. See Example section . Unnamed character vector length equal number coefficients final table, coef_omit applied. Named character vector: Values refer variable names appear table. Names refer original term names stored model object. Ex: c(\"hp:mpg\"=\"hp X mpg\") Function: Accepts character vector model's term names returns named vector like one described . modelsummary package supplies coef_rename() function can common cleaning tasks: modelsummary(model, coef_rename = coef_rename) gof_map rename, reorder, omit goodness--fit statistics model information. argument accepts 4 types values: NULL (default): modelsummary::gof_map dictionary used formatting, unknown statistic included. character vector: \"\", \"none\", vector statistics c(\"rmse\", \"nobs\", \"r.squared\"). Elements correspond colnames data.frame produced get_gof(model). modelsummary::gof_map default dictionary used format rename statistics. NA: excludes statistics bottom part table. data.frame 3 columns named \"raw\", \"clean\", \"fmt\". Unknown statistics omitted. See 'Examples' section . list lists, includes 3 elements named \"raw\", \"clean\", \"fmt\". Unknown statistics omitted. See 'Examples section '. gof_omit string regular expression (perl-compatible) used determine statistics omit bottom section table. \"negative lookahead\" can used specify statistics keep table. Examples: \"IC\": omit statistics matching \"IC\" substring. \"BIC|AIC\": omit statistics matching \"AIC\" \"BIC\" substrings. \"^(?!.*IC)\": keep statistics matching \"IC\" substring. group_map named unnamed character vector. Subset, rename, reorder coefficient groups specified grouping variable specified shape argument formula. argument behaves like coef_map. add_columns data.frame (tibble) number rows #' main table. default, rows appended bottom table. can define \"position\" attribute integers set columns positions. See Examples section . add_rows data.frame (tibble) number columns main table. default, rows appended bottom table. can define \"position\" attribute integers set row positions. See Examples section . align string number characters equal number columns table (e.g., align = \"lcc\"). Valid characters: l, c, r, d. \"l\": left-aligned column \"c\": centered column \"r\": right-aligned column \"d\": dot-aligned column. LaTeX/PDF output, option requires least version 3.0.25 siunitx LaTeX package. commands must appear LaTeX preamble (added automatically compiling Rmarkdown documents PDF): \\usepackage{booktabs} \\usepackage{siunitx} \\newcolumntype{d}{S[ input-open-uncertainty=, input-close-uncertainty=, parse-numbers = false, table-align-text-pre=false, table-align-text-post=false ]} notes list vector notes append bottom table. title string escape boolean TRUE escapes substitutes LaTeX/HTML characters prevent file compiling/displaying. setting affect captions notes. ... arguments passed three functions. See documentation functions lists available arguments. parameters::model_parameters extracts parameter estimates. Available arguments depend model type, include: standardize, centrality, dispersion, test, ci_method, prior, diagnostic, rope_range, power, cluster, etc. performance::model_performance extracts goodness--fit statistics. Available arguments depend model type, include: metrics, estimator, etc. kableExtra::kbl gt::gt draw tables, depending value output argument.","code":""},{"path":"https://vincentarelbundock.github.io/modelsummary/dev/reference/modelsummary.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Model Summary Tables — modelsummary","text":"regression table format determined output argument.","code":""},{"path":[]},{"path":"https://vincentarelbundock.github.io/modelsummary/dev/reference/modelsummary.html","id":"output","dir":"Reference","previous_headings":"","what":"output","title":"Model Summary Tables — modelsummary","text":"modelsummary_list output lightweight format can used save model results, can fed back modelsummary later avoid extracting results . file name valid extension supplied output argument, table written immediately file. want customize table post-processing external package, need choose different output format saving mechanism. Unfortunately, approach differs package package: gt: set output=\"gt\", post-process table, use gt::gtsave function. kableExtra: set output destination format (e.g., \"latex\", \"html\", \"markdown\"), post-process table, use kableExtra::save_kable function.","code":""},{"path":"https://vincentarelbundock.github.io/modelsummary/dev/reference/modelsummary.html","id":"vcov","dir":"Reference","previous_headings":"","what":"vcov","title":"Model Summary Tables — modelsummary","text":"use string \"robust\" \"HC0\", model must supported sandwich package. includes objects : lm, glm, survreg, coxph, mlogit, polr, hurdle, zeroinfl, . NULL, \"classical\", \"iid\", \"constant\" aliases modify uncertainty estimates simply report default standard errors stored model object. One-sided formulas ~clusterid passed sandwich::vcovCL function. Matrices functions producing variance-covariance matrices first passed lmtest. work, modelsummary attempts take square root diagonal adjust \"std.error\", uncertainty estimates adjusted. Numeric vectors formatted according fmt placed brackets. Character vectors printed given, without parentheses. model type supported lmtest package, vcov argument try use package adjust uncertainty estimates, including \"std.error\", \"statistic\", \"p.value\", \"conf.int\". model supported lmtest, \"std.error\" adjusted , example, taking square root matrix's diagonal.","code":""},{"path":"https://vincentarelbundock.github.io/modelsummary/dev/reference/modelsummary.html","id":"global-options","dir":"Reference","previous_headings":"","what":"Global Options","title":"Model Summary Tables — modelsummary","text":"behavior modelsummary can modified setting global options. example: options(modelsummary_model_labels = \"roman\") rest section describes options .","code":""},{"path":"https://vincentarelbundock.github.io/modelsummary/dev/reference/modelsummary.html","id":"model-labels-default-column-names","dir":"Reference","previous_headings":"","what":"Model labels: default column names","title":"Model Summary Tables — modelsummary","text":"global option changes style default column headers: options(modelsummary_model_labels = \"roman\") options(modelsummary_panel_labels = \"roman\") supported styles : \"model\", \"panel\", \"arabic\", \"letters\", \"roman\", \"(arabic)\", \"(letters)\", \"(roman)\"\" panel-specific option used shape=\"rbind\"","code":""},{"path":"https://vincentarelbundock.github.io/modelsummary/dev/reference/modelsummary.html","id":"table-making-packages","dir":"Reference","previous_headings":"","what":"Table-making packages","title":"Model Summary Tables — modelsummary","text":"modelsummary supports 4 table-making packages: kableExtra, gt, flextable, huxtable, DT. packages overlapping functionalities. example, 3 packages can export LaTeX. change default backend used specific file format, can use options function: options(modelsummary_factory_html = 'kableExtra') options(modelsummary_factory_latex = 'gt') options(modelsummary_factory_word = 'huxtable') options(modelsummary_factory_png = 'gt')","code":""},{"path":"https://vincentarelbundock.github.io/modelsummary/dev/reference/modelsummary.html","id":"table-themes","dir":"Reference","previous_headings":"","what":"Table themes","title":"Model Summary Tables — modelsummary","text":"Change look tables automated replicable way, using modelsummary theming functionality. See vignette: https://vincentarelbundock.github.io/modelsummary/articles/appearance.html modelsummary_theme_gt modelsummary_theme_kableExtra modelsummary_theme_huxtable modelsummary_theme_flextable modelsummary_theme_dataframe","code":""},{"path":"https://vincentarelbundock.github.io/modelsummary/dev/reference/modelsummary.html","id":"model-extraction-functions","dir":"Reference","previous_headings":"","what":"Model extraction functions","title":"Model Summary Tables — modelsummary","text":"modelsummary can use two sets packages extract information statistical models: easystats family (performance parameters) broom. default, uses easystats first falls back broom case failure. can change order priorities include goodness--fit extracted packages setting: options(modelsummary_get = \"broom\") options(modelsummary_get = \"easystats\") options(modelsummary_get = \"\")","code":""},{"path":"https://vincentarelbundock.github.io/modelsummary/dev/reference/modelsummary.html","id":"formatting-numeric-entries","dir":"Reference","previous_headings":"","what":"Formatting numeric entries","title":"Model Summary Tables — modelsummary","text":"default, LaTeX tables enclose numeric entries \\num{} command siunitx package. prevent behavior, enclose numbers dollar signs (LaTeX math mode), users can call: options(modelsummary_format_numeric_latex = \"plain\") options(modelsummary_format_numeric_latex = \"mathmode\") similar option can used display numerical entries using MathJax HTML tables: options(modelsummary_format_numeric_html = \"mathjax\")","code":""},{"path":"https://vincentarelbundock.github.io/modelsummary/dev/reference/modelsummary.html","id":"parallel-computation","dir":"Reference","previous_headings":"","what":"Parallel computation","title":"Model Summary Tables — modelsummary","text":"can take long time compute extract summary statistics certain models (e.g., Bayesian). cases, users can parallelize process. Since parallelization occurs model level, speedup available tables single model. Users mac linux can launch parallel computation using built-parallel package. need supply mc.cores argument pushed forward parallel::mclapply function: users can also use future.apply package parallelize model summaries. example, use 4 cores extract results: Note \"multicore\" plan parallelizes mac linux. Windows users can use plan(multisession) instead. However, note first time modelsummary() called multisession can fair bit longer, extra costs passing data loading required packages workers. Subsequent calls modelsummary() often much faster. users reported difficult reproduce errors using future package packages. future parallelization modelsummary can disabled calling: options(\"modelsummary_future\" = FALSE)","code":"modelsummary(model_list, mc.cores = 5) library(future.apply) plan(multicore, workers = 4) options(\"modelsummary_future\" = TRUE) modelsummary(model_list)"},{"path":"https://vincentarelbundock.github.io/modelsummary/dev/reference/modelsummary.html","id":"examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Model Summary Tables — modelsummary","text":"","code":"library(modelsummary) # load data and estimate models utils::data(trees) models <- list() models[['Bivariate']] <- lm(Girth ~ Height, data = trees) models[['Multivariate']] <- lm(Girth ~ Height + Volume, data = trees) # simple table modelsummary(models) # statistic modelsummary(models, statistic = NULL) modelsummary(models, statistic = 'p.value') modelsummary(models, statistic = 'statistic') modelsummary(models, statistic = 'conf.int', conf_level = 0.99) modelsummary(models, statistic = c(\"t = {statistic}\", \"se = {std.error}\", \"conf.int\")) # estimate modelsummary(models, statistic = NULL, estimate = \"{estimate} [{conf.low}, {conf.high}]\") modelsummary(models, estimate = c(\"{estimate}{stars}\", \"{estimate} ({std.error})\")) # vcov modelsummary(models, vcov = \"robust\") modelsummary(models, vcov = list(\"classical\", \"stata\")) modelsummary(models, vcov = sandwich::vcovHC) modelsummary(models, vcov = list(stats::vcov, sandwich::vcovHC)) modelsummary(models, vcov = list(c(\"(Intercept)\"=\"\", \"Height\"=\"!\"), c(\"(Intercept)\"=\"\", \"Height\"=\"!\", \"Volume\"=\"!!\"))) # vcov with custom names modelsummary( models, vcov = list(\"Stata Corp\" = \"stata\", \"Newey Lewis & the News\" = \"NeweyWest\")) # fmt mod <- lm(mpg ~ hp + drat + qsec, data = mtcars) modelsummary(mod, fmt = 3) modelsummary(mod, fmt = fmt_significant(3)) modelsummary(mod, fmt = NULL) modelsummary(mod, fmt = fmt_decimal(4)) modelsummary(mod, fmt = fmt_sprintf(\"%.5f\")) modelsummary(mod, fmt = fmt_statistic(estimate = 4, conf.int = 1), statistic = \"conf.int\") modelsummary(mod, fmt = fmt_term(hp = 4, drat = 1, default = 2)) m <- lm(mpg ~ I(hp * 1000) + drat, data = mtcars) f <- function(x) format(x, digits = 3, nsmall = 2, scientific = FALSE, trim = TRUE) modelsummary(m, fmt = f, gof_map = NA) # coef_rename modelsummary(models, coef_rename = c('Volume' = 'Large', 'Height' = 'Tall')) modelsummary(models, coef_rename = toupper) modelsummary(models, coef_rename = coef_rename) # coef_rename = TRUE for variable labels datlab <- mtcars datlab$cyl <- factor(datlab$cyl) attr(datlab$hp, \"label\") <- \"Horsepower\" attr(datlab$cyl, \"label\") <- \"Cylinders\" modlab <- lm(mpg ~ hp * drat + cyl, data = datlab) modelsummary(modlab, coef_rename = TRUE) # coef_rename: unnamed vector of length equal to the number of terms in the final table m <- lm(hp ~ mpg + factor(cyl), data = mtcars) modelsummary(m, coef_omit = -(3:4), coef_rename = c(\"Cyl 6\", \"Cyl 8\")) # coef_map modelsummary(models, coef_map = c('Volume' = 'Large', 'Height' = 'Tall')) modelsummary(models, coef_map = c('Volume', 'Height')) # coef_omit: omit the first and second coefficients modelsummary(models, coef_omit = 1:2) # coef_omit: omit coefficients matching one substring modelsummary(models, coef_omit = \"ei\", gof_omit = \".*\") # coef_omit: omit a specific coefficient modelsummary(models, coef_omit = \"^Volume$\", gof_omit = \".*\") # coef_omit: omit coefficients matching either one of two substring #modelsummary(models, coef_omit = \"ei|rc\", gof_omit = \".*\") # coef_omit: keep coefficients starting with a substring (using a negative lookahead) #modelsummary(models, coef_omit = \"^(?!Vol)\", gof_omit = \".*\") # coef_omit: keep coefficients matching a substring modelsummary(models, coef_omit = \"^(?!.*ei|.*pt)\", gof_omit = \".*\") # shape: multinomial model library(nnet) multi <- multinom(factor(cyl) ~ mpg + hp, data = mtcars, trace = FALSE) # shape: term names and group ids in rows, models in columns modelsummary(multi, shape = response ~ model) # shape: term names and group ids in rows in a single column modelsummary(multi, shape = term : response ~ model) # shape: term names in rows and group ids in columns modelsummary(multi, shape = term ~ response:model) # shape = \"rcollapse\" panels <- list( \"Panel A: MPG\" = list( \"A\" = lm(mpg ~ hp, data = mtcars), \"B\" = lm(mpg ~ hp + factor(gear), data = mtcars)), \"Panel B: Displacement\" = list( \"A\" = lm(disp ~ hp, data = mtcars), \"C\" = lm(disp ~ hp + factor(gear), data = mtcars)) ) modelsummary( panels, shape = \"rbind\", gof_map = c(\"nobs\", \"r.squared\")) # title modelsummary(models, title = 'This is the title') # title with LaTeX label (for numbering and referencing) modelsummary(models, title = 'This is the title \\\\label{tab:description}') # add_rows rows <- tibble::tribble(~term, ~Bivariate, ~Multivariate, 'Empty row', '-', '-', 'Another empty row', '?', '?') attr(rows, 'position') <- c(1, 3) modelsummary(models, add_rows = rows) # notes modelsummary(models, notes = list('A first note', 'A second note')) # gof_map: tribble library(tibble) gm <- tribble( ~raw, ~clean, ~fmt, \"r.squared\", \"R Squared\", 5) modelsummary(models, gof_map = gm)"},{"path":"https://vincentarelbundock.github.io/modelsummary/dev/reference/modelsummary.html","id":"references","dir":"Reference","previous_headings":"","what":"References","title":"Model Summary Tables — modelsummary","text":"Arel-Bundock V (2022). “modelsummary: Data Model Summaries R.” Journal Statistical Software, 103(1), 1-23. doi:10.18637/jss.v103.i01 .'","code":""},{"path":"https://vincentarelbundock.github.io/modelsummary/dev/reference/modelsummary_wide.html","id":null,"dir":"Reference","previous_headings":"","what":"Superseded function — modelsummary_wide","title":"Superseded function — modelsummary_wide","text":"function superseded shape argument modelsummary function.","code":""},{"path":"https://vincentarelbundock.github.io/modelsummary/dev/reference/modelsummary_wide.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Superseded function — modelsummary_wide","text":"","code":"modelsummary_wide(...)"},{"path":"https://vincentarelbundock.github.io/modelsummary/dev/reference/msummary.html","id":null,"dir":"Reference","previous_headings":"","what":"msummary() is a shortcut to modelsummary() — msummary","title":"msummary() is a shortcut to modelsummary() — msummary","text":"Create beautiful customizable tables summarize several statistical models side--side. function supports dozens statistical models, can produce tables HTML, LaTeX, Word, Markdown, PDF, PowerPoint, Excel, RTF, JPG, PNG. appearance tables can customized extensively specifying output argument, using functions one supported table customization packages: kableExtra, gt, flextable, huxtable, DT. information, see Details Examples sections , vignettes modelsummary website: https://vincentarelbundock.github.io/modelsummary/ modelsummary Vignette includes dozens examples tables extensive customizations. Appearance Vignette shows modify look tables.","code":""},{"path":"https://vincentarelbundock.github.io/modelsummary/dev/reference/msummary.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"msummary() is a shortcut to modelsummary() — msummary","text":"","code":"msummary( models, output = \"default\", fmt = 3, estimate = \"estimate\", statistic = \"std.error\", vcov = NULL, conf_level = 0.95, exponentiate = FALSE, stars = FALSE, shape = term + statistic ~ model, coef_map = NULL, coef_omit = NULL, coef_rename = FALSE, gof_map = NULL, gof_omit = NULL, group_map = NULL, add_columns = NULL, add_rows = NULL, align = NULL, notes = NULL, title = NULL, escape = TRUE, ... )"},{"path":"https://vincentarelbundock.github.io/modelsummary/dev/reference/msummary.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"msummary() is a shortcut to modelsummary() — msummary","text":"models model, (named) list models, nested list models. Single model: modelsummary(model) Unnamed list models: modelsummary(list(model1, model2)) Models labelled automatically. default label style can altered setting global option. See . Named list models: modelsummary(list(\"\"=model1, \"B\"=model2)) Models labelled using list names. Nested list models: using shape=\"rbind\" argument, models can nested list models display \"panels\" \"stacks\" regression models. See shape argument documentation examples . output filename object type (character string) Supported filename extensions: .docx, .html, .tex, .md, .txt, .csv, .xlsx, .png, .jpg Supported object types: \"default\", \"html\", \"markdown\", \"latex\", \"latex_tabular\", \"data.frame\", \"gt\", \"kableExtra\", \"huxtable\", \"flextable\", \"DT\", \"jupyter\". \"modelsummary_list\" value produces lightweight object can saved fed back modelsummary function. \"default\" output format can set \"kableExtra\", \"gt\", \"flextable\", \"huxtable\", \"DT\", \"markdown\" user choose default value, packages listed tried sequence. Session-specific configuration: options(\"modelsummary_factory_default\" = \"gt\") Persistent configuration: config_modelsummary(output = \"markdown\") Warning: Users supply file name output argument intend customize table external packages. See 'Details' section. LaTeX compilation requires booktabs siunitx packages, siunitx can disabled replaced global options. See 'Details' section. fmt format numeric values: integer, user-supplied function, modelsummary function. Integer: Number decimal digits User-supplied functions: function accepts numeric vector returns character vector length. modelsummary functions: fmt = fmt_significant(2): Two significant digits (term-level) fmt = fmt_decimal(digits = 2, pdigits = 3): Decimal digits estimate p values fmt = fmt_sprintf(\"%.3f\"): See ?sprintf fmt = fmt_term(\"(Intercept)\" = 1, \"X\" = 2): Format terms differently fmt = fmt_statistic(\"estimate\" = 1, \"r.sqared\" = 6): Format statistics differently. fmt = fmt_identity(): unformatted raw values string: Note LaTeX output: ensure proper typography, numeric entries enclosed \\num{} command, requires siunitx package loaded LaTeX preamble. behavior can altered global options. See 'Details' section. estimate single string character vector length equal number models. Valid entries include column name data.frame produced get_estimates(model), strings curly braces compatible glue package format. Examples: \"estimate\" \"{estimate} ({std.error}){stars}\" \"{estimate} [{conf.low}, {conf.high}]\" statistic vector strings glue strings select uncertainty statistics report vertically estimate. NULL omits uncertainty statistics. \"conf.int\", \"std.error\", \"statistic\", \"p.value\", \"conf.low\", \"conf.high\", . column name produced get_estimates(model) glue package strings braces, without R functions, : \"{p.value} [{conf.low}, {conf.high}]\" \"Std.Error: {std.error}\" `\"exp(estimate) * std.error\" Numbers automatically rounded converted strings. apply functions numeric values, last glue example, users must set fmt=NULL. Parentheses added automatically unless string includes glue curly braces {}. statistics supported models. See column names get_estimates(model), visit website learn add custom statistics. vcov robust standard errors manual statistics. vcov argument accepts six types input (see 'Details' 'Examples' sections ): NULL returns default uncertainty estimates model object string, vector, (named) list strings. \"iid\", \"classical\", \"constant\" aliases NULL, returns model's default uncertainty estimates. strings \"HC\", \"HC0\", \"HC1\" (alias: \"stata\"), \"HC2\", \"HC3\" (alias: \"robust\"), \"HC4\", \"HC4m\", \"HC5\", \"HAC\", \"NeweyWest\", \"Andrews\", \"panel-corrected\", \"outer-product\", \"weave\" use variance-covariance matrices computed using functions sandwich package, equivalent method. behavior functions can (sometimes must) altered passing arguments sandwich directly modelsummary ellipsis (...), safer define custom functions described next bullet. function (named) list functions return variance-covariance matrices row column names equal names coefficient estimates (e.g., stats::vcov, sandwich::vcovHC, function(x) vcovPC(x, cluster=\"country\")). formula (named) list formulas cluster variable(s) right-hand side (e.g., ~clusterid). named list length(models) variance-covariance matrices row column names equal names coefficient estimates. named list length(models) vectors names equal names coefficient estimates. See 'Examples' section . Warning: since list vectors can include arbitrary strings numbers, modelsummary automatically calculate p values. stars argument may thus use incorrect significance thresholds vcov list vectors. conf_level numeric value 0 1. confidence level use confidence intervals. Setting argument NULL extract confidence intervals, can faster models. exponentiate TRUE, FALSE, logical vector length equal number models. TRUE, estimate, conf.low, conf.high statistics exponentiated, std.error transformed exp(estimate)*std.error. stars indicate statistical significance FALSE (default): significance stars. TRUE: +=.1, *=.05, **=.01, ***=0.001 Named numeric vector custom stars c('*' = .1, '+' = .05) Note: legend inserted bottom table estimate statistic arguments use \"glue strings\" {stars}. shape NULL, formula, string determines shape table. NULL: Default shape terms rows models columns. Formula: left side determines appears rows, right side determines appears columns. formula can include one group identifier(s) display related terms together, can useful models multivariate outcomes grouped coefficients (See examples section ). group identifier(s) must column names produced : get_estimates(model). group identifier(s) can combined term identifier single column using colon represent interaction. incomplete formula supplied (e.g., ~statistic), modelsummary tries complete automatically. Goodness--fit statistics appended bottom table model right hand side formula (.e., columns). Potential shape values include: term + statistic ~ model: default term ~ model + statistic: statistics separate columns model + statistic ~ term: models rows terms columns term + response + statistic ~ model: term group id separate columns term : response + statistic ~ model: term group id single column term ~ response String: \"rbind\" \"rcollapse\" bind rows two regression tables create \"panels\" \"stacks\" regression models. models argument must (potentially named) nested list models. Unnamed nested list 2 panels: list(list(model1, model2), list(model3, model4)) Named nested list 2 panels: list(\"Panel \" = list(model1, model2), \"Panel B\" = list(model3, model4)) Named panels named models: list(\"Panel \" = list(\"()\" = model1, \"(II)\" = model2), \"Panel B\" = list(\"()\" = model3, \"(II)\" = model4)) \"rbind\": Bind rows independent regression tables \"rcollapse\": Bind rows regression tables create panel bottom \"collapse\" goodness--fit statistics identical across models. coef_map character vector. Subset, rename, reorder coefficients. Coefficients omitted vector omitted table. order vector determines order table. coef_map can named unnamed character vector. coef_map named vector, values define labels must appear table, names identify original term names stored model object: c(\"hp:mpg\"=\"HPxM/G\"). See Examples section . coef_omit integer vector regular expression identify coefficients omit (keep) table. Positive integers determine coefficients omit. Negative integers determine coefficients keep. regular expression can used omit coefficients, perl-compatible \"negative lookaheads\" can used specify coefficients keep table. Examples: c(2, 3, 5): omits second, third, fifth coefficients. c(-2, -3, -5): negative values keep second, third, fifth coefficients. \"ei\": omit coefficients matching \"ei\" substring. \"^Volume$\": omit \"Volume\" coefficient. \"ei|rc\": omit coefficients matching either \"ei\" \"rc\" substrings. \"^(?!Vol)\": keep coefficients starting \"Vol\" (inverse match using negative lookahead). \"^(?!.*ei)\": keep coefficients matching \"ei\" substring. \"^(?!.*ei|.*pt)\": keep coefficients matching either \"ei\" \"pt\" substrings. See Examples section complete code. coef_rename logical, named unnamed character vector, function Logical: TRUE renames variables based \"label\" attribute column. See Example section . Unnamed character vector length equal number coefficients final table, coef_omit applied. Named character vector: Values refer variable names appear table. Names refer original term names stored model object. Ex: c(\"hp:mpg\"=\"hp X mpg\") Function: Accepts character vector model's term names returns named vector like one described . modelsummary package supplies coef_rename() function can common cleaning tasks: modelsummary(model, coef_rename = coef_rename) gof_map rename, reorder, omit goodness--fit statistics model information. argument accepts 4 types values: NULL (default): modelsummary::gof_map dictionary used formatting, unknown statistic included. character vector: \"\", \"none\", vector statistics c(\"rmse\", \"nobs\", \"r.squared\"). Elements correspond colnames data.frame produced get_gof(model). modelsummary::gof_map default dictionary used format rename statistics. NA: excludes statistics bottom part table. data.frame 3 columns named \"raw\", \"clean\", \"fmt\". Unknown statistics omitted. See 'Examples' section . list lists, includes 3 elements named \"raw\", \"clean\", \"fmt\". Unknown statistics omitted. See 'Examples section '. gof_omit string regular expression (perl-compatible) used determine statistics omit bottom section table. \"negative lookahead\" can used specify statistics keep table. Examples: \"IC\": omit statistics matching \"IC\" substring. \"BIC|AIC\": omit statistics matching \"AIC\" \"BIC\" substrings. \"^(?!.*IC)\": keep statistics matching \"IC\" substring. group_map named unnamed character vector. Subset, rename, reorder coefficient groups specified grouping variable specified shape argument formula. argument behaves like coef_map. add_columns data.frame (tibble) number rows #' main table. default, rows appended bottom table. can define \"position\" attribute integers set columns positions. See Examples section . add_rows data.frame (tibble) number columns main table. default, rows appended bottom table. can define \"position\" attribute integers set row positions. See Examples section . align string number characters equal number columns table (e.g., align = \"lcc\"). Valid characters: l, c, r, d. \"l\": left-aligned column \"c\": centered column \"r\": right-aligned column \"d\": dot-aligned column. LaTeX/PDF output, option requires least version 3.0.25 siunitx LaTeX package. commands must appear LaTeX preamble (added automatically compiling Rmarkdown documents PDF): \\usepackage{booktabs} \\usepackage{siunitx} \\newcolumntype{d}{S[ input-open-uncertainty=, input-close-uncertainty=, parse-numbers = false, table-align-text-pre=false, table-align-text-post=false ]} notes list vector notes append bottom table. title string escape boolean TRUE escapes substitutes LaTeX/HTML characters prevent file compiling/displaying. setting affect captions notes. ... arguments passed three functions. See documentation functions lists available arguments. parameters::model_parameters extracts parameter estimates. Available arguments depend model type, include: standardize, centrality, dispersion, test, ci_method, prior, diagnostic, rope_range, power, cluster, etc. performance::model_performance extracts goodness--fit statistics. Available arguments depend model type, include: metrics, estimator, etc. kableExtra::kbl gt::gt draw tables, depending value output argument.","code":""},{"path":"https://vincentarelbundock.github.io/modelsummary/dev/reference/msummary.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"msummary() is a shortcut to modelsummary() — msummary","text":"regression table format determined output argument.","code":""},{"path":[]},{"path":"https://vincentarelbundock.github.io/modelsummary/dev/reference/msummary.html","id":"output","dir":"Reference","previous_headings":"","what":"output","title":"msummary() is a shortcut to modelsummary() — msummary","text":"modelsummary_list output lightweight format can used save model results, can fed back modelsummary later avoid extracting results . file name valid extension supplied output argument, table written immediately file. want customize table post-processing external package, need choose different output format saving mechanism. Unfortunately, approach differs package package: gt: set output=\"gt\", post-process table, use gt::gtsave function. kableExtra: set output destination format (e.g., \"latex\", \"html\", \"markdown\"), post-process table, use kableExtra::save_kable function.","code":""},{"path":"https://vincentarelbundock.github.io/modelsummary/dev/reference/msummary.html","id":"vcov","dir":"Reference","previous_headings":"","what":"vcov","title":"msummary() is a shortcut to modelsummary() — msummary","text":"use string \"robust\" \"HC0\", model must supported sandwich package. includes objects : lm, glm, survreg, coxph, mlogit, polr, hurdle, zeroinfl, . NULL, \"classical\", \"iid\", \"constant\" aliases modify uncertainty estimates simply report default standard errors stored model object. One-sided formulas ~clusterid passed sandwich::vcovCL function. Matrices functions producing variance-covariance matrices first passed lmtest. work, modelsummary attempts take square root diagonal adjust \"std.error\", uncertainty estimates adjusted. Numeric vectors formatted according fmt placed brackets. Character vectors printed given, without parentheses. model type supported lmtest package, vcov argument try use package adjust uncertainty estimates, including \"std.error\", \"statistic\", \"p.value\", \"conf.int\". model supported lmtest, \"std.error\" adjusted , example, taking square root matrix's diagonal.","code":""},{"path":"https://vincentarelbundock.github.io/modelsummary/dev/reference/msummary.html","id":"global-options","dir":"Reference","previous_headings":"","what":"Global Options","title":"msummary() is a shortcut to modelsummary() — msummary","text":"behavior modelsummary can modified setting global options. example: options(modelsummary_model_labels = \"roman\") rest section describes options .","code":""},{"path":"https://vincentarelbundock.github.io/modelsummary/dev/reference/msummary.html","id":"model-labels-default-column-names","dir":"Reference","previous_headings":"","what":"Model labels: default column names","title":"msummary() is a shortcut to modelsummary() — msummary","text":"global option changes style default column headers: options(modelsummary_model_labels = \"roman\") options(modelsummary_panel_labels = \"roman\") supported styles : \"model\", \"panel\", \"arabic\", \"letters\", \"roman\", \"(arabic)\", \"(letters)\", \"(roman)\"\" panel-specific option used shape=\"rbind\"","code":""},{"path":"https://vincentarelbundock.github.io/modelsummary/dev/reference/msummary.html","id":"table-making-packages","dir":"Reference","previous_headings":"","what":"Table-making packages","title":"msummary() is a shortcut to modelsummary() — msummary","text":"modelsummary supports 4 table-making packages: kableExtra, gt, flextable, huxtable, DT. packages overlapping functionalities. example, 3 packages can export LaTeX. change default backend used specific file format, can use options function: options(modelsummary_factory_html = 'kableExtra') options(modelsummary_factory_latex = 'gt') options(modelsummary_factory_word = 'huxtable') options(modelsummary_factory_png = 'gt')","code":""},{"path":"https://vincentarelbundock.github.io/modelsummary/dev/reference/msummary.html","id":"table-themes","dir":"Reference","previous_headings":"","what":"Table themes","title":"msummary() is a shortcut to modelsummary() — msummary","text":"Change look tables automated replicable way, using modelsummary theming functionality. See vignette: https://vincentarelbundock.github.io/modelsummary/articles/appearance.html modelsummary_theme_gt modelsummary_theme_kableExtra modelsummary_theme_huxtable modelsummary_theme_flextable modelsummary_theme_dataframe","code":""},{"path":"https://vincentarelbundock.github.io/modelsummary/dev/reference/msummary.html","id":"model-extraction-functions","dir":"Reference","previous_headings":"","what":"Model extraction functions","title":"msummary() is a shortcut to modelsummary() — msummary","text":"modelsummary can use two sets packages extract information statistical models: easystats family (performance parameters) broom. default, uses easystats first falls back broom case failure. can change order priorities include goodness--fit extracted packages setting: options(modelsummary_get = \"broom\") options(modelsummary_get = \"easystats\") options(modelsummary_get = \"\")","code":""},{"path":"https://vincentarelbundock.github.io/modelsummary/dev/reference/msummary.html","id":"formatting-numeric-entries","dir":"Reference","previous_headings":"","what":"Formatting numeric entries","title":"msummary() is a shortcut to modelsummary() — msummary","text":"default, LaTeX tables enclose numeric entries \\num{} command siunitx package. prevent behavior, enclose numbers dollar signs (LaTeX math mode), users can call: options(modelsummary_format_numeric_latex = \"plain\") options(modelsummary_format_numeric_latex = \"mathmode\") similar option can used display numerical entries using MathJax HTML tables: options(modelsummary_format_numeric_html = \"mathjax\")","code":""},{"path":"https://vincentarelbundock.github.io/modelsummary/dev/reference/msummary.html","id":"parallel-computation","dir":"Reference","previous_headings":"","what":"Parallel computation","title":"msummary() is a shortcut to modelsummary() — msummary","text":"can take long time compute extract summary statistics certain models (e.g., Bayesian). cases, users can parallelize process. Since parallelization occurs model level, speedup available tables single model. Users mac linux can launch parallel computation using built-parallel package. need supply mc.cores argument pushed forward parallel::mclapply function: users can also use future.apply package parallelize model summaries. example, use 4 cores extract results: Note \"multicore\" plan parallelizes mac linux. Windows users can use plan(multisession) instead. However, note first time modelsummary() called multisession can fair bit longer, extra costs passing data loading required packages workers. Subsequent calls modelsummary() often much faster. users reported difficult reproduce errors using future package packages. future parallelization modelsummary can disabled calling: options(\"modelsummary_future\" = FALSE)","code":"modelsummary(model_list, mc.cores = 5) library(future.apply) plan(multicore, workers = 4) options(\"modelsummary_future\" = TRUE) modelsummary(model_list)"},{"path":"https://vincentarelbundock.github.io/modelsummary/dev/reference/msummary.html","id":"examples","dir":"Reference","previous_headings":"","what":"Examples","title":"msummary() is a shortcut to modelsummary() — msummary","text":"","code":"library(modelsummary) # load data and estimate models utils::data(trees) models <- list() models[['Bivariate']] <- lm(Girth ~ Height, data = trees) models[['Multivariate']] <- lm(Girth ~ Height + Volume, data = trees) # simple table modelsummary(models) # statistic modelsummary(models, statistic = NULL) modelsummary(models, statistic = 'p.value') modelsummary(models, statistic = 'statistic') modelsummary(models, statistic = 'conf.int', conf_level = 0.99) modelsummary(models, statistic = c(\"t = {statistic}\", \"se = {std.error}\", \"conf.int\")) # estimate modelsummary(models, statistic = NULL, estimate = \"{estimate} [{conf.low}, {conf.high}]\") modelsummary(models, estimate = c(\"{estimate}{stars}\", \"{estimate} ({std.error})\")) # vcov modelsummary(models, vcov = \"robust\") modelsummary(models, vcov = list(\"classical\", \"stata\")) modelsummary(models, vcov = sandwich::vcovHC) modelsummary(models, vcov = list(stats::vcov, sandwich::vcovHC)) modelsummary(models, vcov = list(c(\"(Intercept)\"=\"\", \"Height\"=\"!\"), c(\"(Intercept)\"=\"\", \"Height\"=\"!\", \"Volume\"=\"!!\"))) # vcov with custom names modelsummary( models, vcov = list(\"Stata Corp\" = \"stata\", \"Newey Lewis & the News\" = \"NeweyWest\")) # fmt mod <- lm(mpg ~ hp + drat + qsec, data = mtcars) modelsummary(mod, fmt = 3) modelsummary(mod, fmt = fmt_significant(3)) modelsummary(mod, fmt = NULL) modelsummary(mod, fmt = fmt_decimal(4)) modelsummary(mod, fmt = fmt_sprintf(\"%.5f\")) modelsummary(mod, fmt = fmt_statistic(estimate = 4, conf.int = 1), statistic = \"conf.int\") modelsummary(mod, fmt = fmt_term(hp = 4, drat = 1, default = 2)) m <- lm(mpg ~ I(hp * 1000) + drat, data = mtcars) f <- function(x) format(x, digits = 3, nsmall = 2, scientific = FALSE, trim = TRUE) modelsummary(m, fmt = f, gof_map = NA) # coef_rename modelsummary(models, coef_rename = c('Volume' = 'Large', 'Height' = 'Tall')) modelsummary(models, coef_rename = toupper) modelsummary(models, coef_rename = coef_rename) # coef_rename = TRUE for variable labels datlab <- mtcars datlab$cyl <- factor(datlab$cyl) attr(datlab$hp, \"label\") <- \"Horsepower\" attr(datlab$cyl, \"label\") <- \"Cylinders\" modlab <- lm(mpg ~ hp * drat + cyl, data = datlab) modelsummary(modlab, coef_rename = TRUE) # coef_rename: unnamed vector of length equal to the number of terms in the final table m <- lm(hp ~ mpg + factor(cyl), data = mtcars) modelsummary(m, coef_omit = -(3:4), coef_rename = c(\"Cyl 6\", \"Cyl 8\")) # coef_map modelsummary(models, coef_map = c('Volume' = 'Large', 'Height' = 'Tall')) modelsummary(models, coef_map = c('Volume', 'Height')) # coef_omit: omit the first and second coefficients modelsummary(models, coef_omit = 1:2) # coef_omit: omit coefficients matching one substring modelsummary(models, coef_omit = \"ei\", gof_omit = \".*\") # coef_omit: omit a specific coefficient modelsummary(models, coef_omit = \"^Volume$\", gof_omit = \".*\") # coef_omit: omit coefficients matching either one of two substring #modelsummary(models, coef_omit = \"ei|rc\", gof_omit = \".*\") # coef_omit: keep coefficients starting with a substring (using a negative lookahead) #modelsummary(models, coef_omit = \"^(?!Vol)\", gof_omit = \".*\") # coef_omit: keep coefficients matching a substring modelsummary(models, coef_omit = \"^(?!.*ei|.*pt)\", gof_omit = \".*\") # shape: multinomial model library(nnet) multi <- multinom(factor(cyl) ~ mpg + hp, data = mtcars, trace = FALSE) # shape: term names and group ids in rows, models in columns modelsummary(multi, shape = response ~ model) # shape: term names and group ids in rows in a single column modelsummary(multi, shape = term : response ~ model) # shape: term names in rows and group ids in columns modelsummary(multi, shape = term ~ response:model) # shape = \"rcollapse\" panels <- list( \"Panel A: MPG\" = list( \"A\" = lm(mpg ~ hp, data = mtcars), \"B\" = lm(mpg ~ hp + factor(gear), data = mtcars)), \"Panel B: Displacement\" = list( \"A\" = lm(disp ~ hp, data = mtcars), \"C\" = lm(disp ~ hp + factor(gear), data = mtcars)) ) modelsummary( panels, shape = \"rbind\", gof_map = c(\"nobs\", \"r.squared\")) # title modelsummary(models, title = 'This is the title') # title with LaTeX label (for numbering and referencing) modelsummary(models, title = 'This is the title \\\\label{tab:description}') # add_rows rows <- tibble::tribble(~term, ~Bivariate, ~Multivariate, 'Empty row', '-', '-', 'Another empty row', '?', '?') attr(rows, 'position') <- c(1, 3) modelsummary(models, add_rows = rows) # notes modelsummary(models, notes = list('A first note', 'A second note')) # gof_map: tribble library(tibble) gm <- tribble( ~raw, ~clean, ~fmt, \"r.squared\", \"R Squared\", 5) modelsummary(models, gof_map = gm)"},{"path":"https://vincentarelbundock.github.io/modelsummary/dev/reference/msummary.html","id":"references","dir":"Reference","previous_headings":"","what":"References","title":"msummary() is a shortcut to modelsummary() — msummary","text":"Arel-Bundock V (2022). “modelsummary: Data Model Summaries R.” Journal Statistical Software, 103(1), 1-23. doi:10.18637/jss.v103.i01 .'","code":""},{"path":"https://vincentarelbundock.github.io/modelsummary/dev/reference/reexports.html","id":null,"dir":"Reference","previous_headings":"","what":"tidy generic — reexports","title":"tidy generic — reexports","text":"objects imported packages. Follow links see documentation. generics glance, tidy","code":""},{"path":"https://vincentarelbundock.github.io/modelsummary/dev/reference/rowLabels.html","id":null,"dir":"Reference","previous_headings":"","what":"Retrieve or modify the row or column labels. — rowLabels","title":"Retrieve or modify the row or column labels. — rowLabels","text":"objects imported packages. Follow links see documentation. tables rowLabels","code":""},{"path":"https://vincentarelbundock.github.io/modelsummary/dev/reference/supported_models.html","id":null,"dir":"Reference","previous_headings":"","what":"List of model objects from which modelsummary can extract estimates and\nstatistics — supported_models","title":"List of model objects from which modelsummary can extract estimates and\nstatistics — supported_models","text":"List model objects modelsummary can extract estimates statistics","code":""},{"path":"https://vincentarelbundock.github.io/modelsummary/dev/reference/supported_models.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"List of model objects from which modelsummary can extract estimates and\nstatistics — supported_models","text":"","code":"supported_models()"},{"path":"https://vincentarelbundock.github.io/modelsummary/dev/reference/tidy_custom.html","id":null,"dir":"Reference","previous_headings":"","what":"Extract custom information from a model object and turn it into a tidy\ndata.frame or tibble — tidy_custom","title":"Extract custom information from a model object and turn it into a tidy\ndata.frame or tibble — tidy_custom","text":"customize output model class lm, can define method called tidy_custom.lm returns data.frame column called \"term\", columns want use \"estimate\" \"statistic\" modelsummary() call. output method must similar result tidy(model).","code":""},{"path":"https://vincentarelbundock.github.io/modelsummary/dev/reference/tidy_custom.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Extract custom information from a model object and turn it into a tidy\ndata.frame or tibble — tidy_custom","text":"","code":"tidy_custom(x)"},{"path":"https://vincentarelbundock.github.io/modelsummary/dev/reference/tidy_custom.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Extract custom information from a model object and turn it into a tidy\ndata.frame or tibble — tidy_custom","text":"x object converted tidy data.frame tibble.","code":""},{"path":"https://vincentarelbundock.github.io/modelsummary/dev/reference/tidy_custom.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Extract custom information from a model object and turn it into a tidy\ndata.frame or tibble — tidy_custom","text":"data.frame tibble information model components.","code":""},{"path":"https://vincentarelbundock.github.io/modelsummary/dev/reference/tidy_custom_internal.default.html","id":null,"dir":"Reference","previous_headings":"","what":"Avoid namespace conflict when we want to customize glance internally and\nstill allow users to do the same with their own functions — tidy_custom_internal.default","title":"Avoid namespace conflict when we want to customize glance internally and\nstill allow users to do the same with their own functions — tidy_custom_internal.default","text":"Avoid namespace conflict want customize glance internally still allow users functions","code":""},{"path":"https://vincentarelbundock.github.io/modelsummary/dev/reference/tidy_custom_internal.default.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Avoid namespace conflict when we want to customize glance internally and\nstill allow users to do the same with their own functions — tidy_custom_internal.default","text":"","code":"# S3 method for default tidy_custom_internal(x, ...)"},{"path":"https://vincentarelbundock.github.io/modelsummary/dev/reference/tidy_custom_internal.html","id":null,"dir":"Reference","previous_headings":"","what":"Avoid namespace conflict when we want to customize glance internally and\nstill allow users to do the same with their own functions — tidy_custom_internal","title":"Avoid namespace conflict when we want to customize glance internally and\nstill allow users to do the same with their own functions — tidy_custom_internal","text":"Avoid namespace conflict want customize glance internally still allow users functions","code":""},{"path":"https://vincentarelbundock.github.io/modelsummary/dev/reference/tidy_custom_internal.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Avoid namespace conflict when we want to customize glance internally and\nstill allow users to do the same with their own functions — tidy_custom_internal","text":"","code":"tidy_custom_internal(x, ...)"},{"path":"https://vincentarelbundock.github.io/modelsummary/dev/reference/update_modelsummary.html","id":null,"dir":"Reference","previous_headings":"","what":"Update modelsummary and its dependencies — update_modelsummary","title":"Update modelsummary and its dependencies — update_modelsummary","text":"Update modelsummary dependencies latest R-Universe CRAN versions. R session needs restarted install.","code":""},{"path":"https://vincentarelbundock.github.io/modelsummary/dev/reference/update_modelsummary.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Update modelsummary and its dependencies — update_modelsummary","text":"","code":"update_modelsummary(source = \"development\")"},{"path":"https://vincentarelbundock.github.io/modelsummary/dev/reference/update_modelsummary.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Update modelsummary and its dependencies — update_modelsummary","text":"source one two strings: \"development\" \"cran\"","code":""},{"path":"https://vincentarelbundock.github.io/modelsummary/dev/news/index.html","id":"modelsummary-141-development","dir":"Changelog","previous_headings":"","what":"modelsummary 1.4.1 (development)","title":"modelsummary 1.4.1 (development)","text":"CRAN release: 2023-05-19 New: Minimal support Typst output, auto-detection Quarto documents. strip argument dvnames. s.value statistic now available whenever p.value available. See Greenland (2019). Bugs: GOF term names get escaped LaTeX. Thanks @shreyasgm reviving Issue #546.","code":""},{"path":"https://vincentarelbundock.github.io/modelsummary/dev/news/index.html","id":"modelsummary-141","dir":"Changelog","previous_headings":"","what":"modelsummary 1.4.1","title":"modelsummary 1.4.1","text":"CRAN release: 2023-05-19 New: fmt_sci() can now used fmt argument rounding scientific notation. Bugs: Group separators respect add_rows shape=\"rbind\". Thanks @lrose1 Report #626. Bad column horizontal models shape grouped estimates. Thanks @iago-pssjd Report #631. coef_rename=TRUE bug grouped estimates. Thanks @iago-pssjd Report #631. Upstream issue #881 parameters meant vcov longer used confidence intervals.","code":""},{"path":"https://vincentarelbundock.github.io/modelsummary/dev/news/index.html","id":"modelsummary-140","dir":"Changelog","previous_headings":"","what":"modelsummary 1.4.0","title":"modelsummary 1.4.0","text":"CRAN release: 2023-04-26 Built-support markdown tables. Package longer depends kableExtra. Recommends additional install formats. Persistent configuration default output format: config_modelsummary(factory_default = \"gt\") shape = \"rcollapse\" shape = \"rbind\" glance_custom() can drop GOF assigning NA: https://stackoverflow.com/questions/75215355/assigning-different-coefficient-names--goodness--fit-statistics--differen statistic available, modelsummary prints empty cell instead returning error. “\\label{tab:something}” works title even escape=TRUE Multiple fixest_multi objects supported. options(modelsummary_future = FALSE) disables future parallelism. Bug fixes: statistic=NULL now respected shape=\"rbind\". Thanks Panos Mavros report #620. get_estimates() supports vcov string shortcuts formulas. Thanks @ethans-carl report #605. Quarto Rmarkdown documents include situnix header automatically decimal alignement align=\"ddd\" escape now respected modelsummary shape=\"rbind\". Thanks @chickymonkeys report #622.","code":""},{"path":"https://vincentarelbundock.github.io/modelsummary/dev/news/index.html","id":"modelsummary-130","dir":"Changelog","previous_headings":"","what":"modelsummary 1.3.0","title":"modelsummary 1.3.0","text":"CRAN release: 2023-01-05 Breaking change: default column label style modelsummary() changed “Model 1” “(1)”. benefits : labels longer English default; use less horizontal space; eliminate “Model” redundancy. Unfortunately, break code edge cases users rely column names manipulate tables. old behavior can restored calling: options(modelsummary_model_labels=\"model\") New features: shape=\"rbind\" stack multiple regression tables create “panels” labelled groups models. fmt = fmt_decimal(2): decimal digits fmt = fmt_decimal(digits = 2, pdigits = 4): decimal digits p value-specific setting fmt = fmt_sprintf(\"%.3f\"): sprintf() decimal fmt = fmt_sprintf(\"%.3e\"): sprintf() scientific fmt = fmt_significant(3): significant digits fmt = fmt_statistic(\"estimate\" = 2, \"std.error\" = 3): statistic-specific formatting fmt = fmt_term(\"(Intercept)\" = 2, \"hp\" = 3): term-specific formatting fmt = fmt_identity(): raw values Set style global option: options(modelsummary_model_labels = \"roman\") Supported styles: “model”, “arabic”, “letters”, “roman”, “(arabic)”, “(letters)”, “(roman)”” modelplot(draw = FALSE) now returns p.value column. allows conditional aesthetics (see modelplot vignette). Better integration marginaleffects package. Bugs: fixest models returns useless “group.x” “group.y” columns. Isse #591. Thanks Adam Altmejd report.","code":""},{"path":"https://vincentarelbundock.github.io/modelsummary/dev/news/index.html","id":"modelsummary-120","dir":"Changelog","previous_headings":"","what":"modelsummary 1.2.0","title":"modelsummary 1.2.0","text":"CRAN release: 2022-11-26 Breaking change: shape output=\"dataframe\" arguments, always used group column. Now, column name variable shape formula (“response”, “component”, etc.). New features: shape can include multiple groups. coef_rename can unnamed vector length equal number terms final table, obtained coef_map coef_omit applied models merged. coef_omit accepts numeric indices. Positive values: coefficients omit. Negative values: coefficients keep. datasummary_skim: Increased maximum number variables 250. Quarto notebooks compile Word Markdown automatically. Bug fixes: Order notes preserved output format (Issue #577)","code":""},{"path":"https://vincentarelbundock.github.io/modelsummary/dev/news/index.html","id":"modelsummary-110","dir":"Changelog","previous_headings":"","what":"modelsummary 1.1.0","title":"modelsummary 1.1.0","text":"CRAN release: 2022-10-20 Breaking change: Requires siunitx version 3.0.25 LaTeX package. title argument now respects escape argument kableExtra output formats. can break tables users manually escaped titles. New features: “d” accepted decimal-alignment align argument output formats. modelsummary(mod, align = \"ld\") New update_modelsummary() function makes easy install dev versions modelsummary dependencies (mostly useful Vincent people report bugs). Rounding: display least one significant digit default. Automatic renaming haven labels modelsummary(), datasummary(), datasummary_skim() Allow output = \"filename.csv\" Allow output = \"filename.xlsx\" add_columns argument supported modelsummary() datasummary_balance supports stars argument. Allow stars confidence intervals align = \"d\" column. Bug fixes: locales, HTML minus sign created problems output. use “known” locales. Many minor bug fixes","code":""},{"path":"https://vincentarelbundock.github.io/modelsummary/dev/news/index.html","id":"modelsummary-102","dir":"Changelog","previous_headings":"","what":"modelsummary 1.0.2","title":"modelsummary 1.0.2","text":"CRAN release: 2022-07-17 Minor release fix CRAN failure","code":""},{"path":"https://vincentarelbundock.github.io/modelsummary/dev/news/index.html","id":"modelsummary-101","dir":"Changelog","previous_headings":"","what":"modelsummary 1.0.1","title":"modelsummary 1.0.1","text":"CRAN release: 2022-07-13 shape argument accepts interactions colon “:” character. combines two columns one, can useful display terms group names single column. Parallelization using parallel::mclapply. See ?modelsummary modelsummary longer computes confidence intervals necessary, can save time. Also see: conf_level=NULL Added log likelihood GOF lm glm models. Removed extraneous warnings Bug fixes","code":""},{"path":"https://vincentarelbundock.github.io/modelsummary/dev/news/index.html","id":"modelsummary-100","dir":"Changelog","previous_headings":"","what":"modelsummary 1.0.0","title":"modelsummary 1.0.0","text":"CRAN release: 2022-06-29 first major release accompanies publication article Journal Statistical Software: Arel-Bundock, Vincent (2022). “modelsummary: Data Model Summaries R.” Journal Statistical Software, 103(1), 1-23. doi:10.18637/jss.v103.i01 https://doi.org/10.18637/jss.v103.i01.’ like modelsummary, please cite JSS article tell friends . Minor changes: gof_map=\"\" includes available statistics. gof_map=\"none\" excludes statistics. Bug fixes","code":""},{"path":"https://vincentarelbundock.github.io/modelsummary/dev/news/index.html","id":"modelsummary-0111","dir":"Changelog","previous_headings":"","what":"modelsummary 0.11.1","title":"modelsummary 0.11.1","text":"CRAN release: 2022-06-11 Better printout term names mixed-effects models {brms} {stanreg} models now extracted diagnostic=NULL test=NULL default speed.","code":""},{"path":"https://vincentarelbundock.github.io/modelsummary/dev/news/index.html","id":"modelsummary-0110","dir":"Changelog","previous_headings":"","what":"modelsummary 0.11.0","title":"modelsummary 0.11.0","text":"CRAN release: 2022-06-06 Breaking changes: modelsummary_wide longer available. Use shape argument modelsummary instead. modelsummary now uses easystats packages (performance parameters) extract estimates goodness--fit statistics instead broom. can reverted setting global option: options(modelsummary_get=\"broom\"). change aims (1) increase consistency across models, (2) improve developers’ ability push bug fixes upstream necessary, (3) improve support mixed effects, bayesian, GAM models. two main drawbacks : () set printed statistics may slightly different previous versions modelsummary (b) group identifiers used shape formula also different certain models (e.g., nnet::multinom, y.level becomes response). New features: ~ statistic: statistics shown horizontally distinct columns. model ~ term: models rows terms columns. term + y.level + statistic ~ model: grouped coefficients multivariate outcome nnet::multinom y.level ~ model: partial match previous formula modelsummary(mod, fmt = list(estimate = 2, std.error = 1, rmse = 4)) modelsummary(model, fmt = NULL, estimate = \"{log(estimate)}\") Update breaking changes fixest 0.10.4 Bug fixes: group_map rename issue Residual standard error mistakenly labelled “RMSE” lm models. datasummary_skim output jpg now works escape fixes","code":""},{"path":"https://vincentarelbundock.github.io/modelsummary/dev/news/index.html","id":"modelsummary-0100","dir":"Changelog","previous_headings":"","what":"modelsummary 0.10.0","title":"modelsummary 0.10.0","text":"CRAN release: 2022-04-14 New exponentiate argument modelsummary() modelplot() gof_map accepts vector c(\"rmse\", \"nobs\", \"r.squared\") Drop rlang dependency Bug fixes","code":""},{"path":"https://vincentarelbundock.github.io/modelsummary/dev/news/index.html","id":"modelsummary-096","dir":"Changelog","previous_headings":"","what":"modelsummary 0.9.6","title":"modelsummary 0.9.6","text":"CRAN release: 2022-02-25 datasummary_balance: Accepts ~ 1 formula summarize data. Misc: documentation improvements RMSE included default models class lm","code":""},{"path":"https://vincentarelbundock.github.io/modelsummary/dev/news/index.html","id":"modelsummary-095","dir":"Changelog","previous_headings":"","what":"modelsummary 0.9.5","title":"modelsummary 0.9.5","text":"CRAN release: 2022-01-10 modelsummary: vcov strings like HC1 Robust now case-insensitive gof_map now accepts data.frame tibble fmt list-column includes functions (see Examples docs) R2 longer computed default bayesian mixed effects models. informative one-time warning printed metrics argument. datasummary_skim: Histograms now work Jupyter Bugfix: harmless error message longer printed kableExtra factory: col.names argument can now passed kableExtra::kbl … ellipsis. Misc: Many small improvements vignettes docs output = \"github_document\" now supported","code":""},{"path":"https://vincentarelbundock.github.io/modelsummary/dev/news/index.html","id":"modelsummary-094","dir":"Changelog","previous_headings":"","what":"modelsummary 0.9.4","title":"modelsummary 0.9.4","text":"CRAN release: 2021-11-05 Bug fix: siunitx rounding NA","code":""},{"path":"https://vincentarelbundock.github.io/modelsummary/dev/news/index.html","id":"modelsummary-093","dir":"Changelog","previous_headings":"","what":"modelsummary 0.9.3","title":"modelsummary 0.9.3","text":"CRAN release: 2021-11-02 modelsummary: F statistic takes account vcov argument Support group = group ~ model + term datasummary_balance: Weighted means standard deviations now supported. Counts percentages , raise warning. Misc: Bugfix: rounding LaTeX w/ siunitx NaN entries. output=‘jupyter’ longer prints extraneous TRUE notebook","code":""},{"path":"https://vincentarelbundock.github.io/modelsummary/dev/news/index.html","id":"modelsummary-092","dir":"Changelog","previous_headings":"","what":"modelsummary 0.9.2","title":"modelsummary 0.9.2","text":"CRAN release: 2021-09-29 modelsummary: Improved vcov argument handling fixest models (#357 @grantmcdermott) Fix display fixest::() variables interactions (#361 @grantmcdermott) Consistent display clustered SEs (#356, #363 #366 @grantmcdermott) datasummary_correlation: add_rows add_columns arguments now available . Misc: Global options output factories renamed: modelsummary_factory_default, modelsummary_factory_html, etc. Hot fix change R-devel behavior intersect Bug fixes: datasummary_balance: escape variable names escape=TRUE Blogdown LaTeX dependency bug output HTML","code":""},{"path":"https://vincentarelbundock.github.io/modelsummary/dev/news/index.html","id":"modelsummary-091","dir":"Changelog","previous_headings":"","what":"modelsummary 0.9.1","title":"modelsummary 0.9.1","text":"CRAN release: 2021-08-12 Breaking change: Support dcolumn dot-aligned columns deprecated. Use “d” align argument instead. changes: LaTeX output: Numeric entries wrapped \\num{} function siunitx package default. produces much nicer formatting. can disabled global option. See ?modelsummary align argument accepts “d” column dot-alignment using siunitx LaTeX package: align=\"ldd\". HTML tables display proper minus signs. New escape argument table-building functions. LaTeX output accepts threeparttable=TRUE argument ... dependency tidyr modelsummary: group: order terms formula determines order rows/columns modelsummary_wide: Note: function eventually deprecated Bugfix statistic=NULL. modelplot: Preserves order models user-supplied list datasummary_crosstab: statistic=NULL produces basic crosstab datasummary_crosstab: Default alignment “lrrrrr” consistent datasummary_* functions","code":""},{"path":"https://vincentarelbundock.github.io/modelsummary/dev/news/index.html","id":"modelsummary-081","dir":"Changelog","previous_headings":"","what":"modelsummary 0.8.1","title":"modelsummary 0.8.1","text":"CRAN release: 2021-06-17 modelsummary: Disable stars footnote options(\"modelsummary_stars_note\" = FALSE) longtable=TRUE works LaTeX output Interactions “:” longer converted “x” coef_map coef_rename used. group = model ~ term + group now supported. datasummary_skim: datasummary_skim(\"categorical\") keeps NA default. Users can convert variables factors calling datasummary_skim exclude NA. : Improved warnings bad calls: modelsummary(model1, model2) gt titles use new caption argument gt 0.3.0 function Bug fix: Overaggressive tests glue strings prevented functions inside {}","code":""},{"path":"https://vincentarelbundock.github.io/modelsummary/dev/news/index.html","id":"modelsummary-080","dir":"Changelog","previous_headings":"","what":"modelsummary 0.8.0","title":"modelsummary 0.8.0","text":"CRAN release: 2021-05-21 Breaking change: default significance markers stars=TRUE updated consistent default output base R (e.g., summary.lm). new significance thresholds : “+” p < 0.1, “” p < 0.05, ”” p < 0.01, ”” p < 0.001 datasummary_crosstab: New function produce cross-tabulations datasummary: N smart enough return either number elements subset number non-missing observations variable datasummary_balance: Keeps NAs factor variables default. Users can convert variables factor() function omit NAs automatically. modelsummary: themes can set using global options (experimental) new vcov options: “bootstrap”, “HAC”, “NeweyWest”, “Andrews”, “panel-corrected”, “weave”, “outer-product” valid get_gof (glance) now optional. … pushed sandwich, allows things like: modelsummary(model, vcov = \"bootstrap\", R = 1000, cluster = \"firm\") : Jupyter notebook support via output=\"jupyter\" Bug fixes","code":""},{"path":"https://vincentarelbundock.github.io/modelsummary/dev/news/index.html","id":"modelsummary-070","dir":"Changelog","previous_headings":"","what":"modelsummary 0.7.0","title":"modelsummary 0.7.0","text":"CRAN release: 2021-04-19 modelsummary: new arguments modelsummary: group group_map grouped parameters (e.g., outcome levels multinomial logit components gamlss model). dvnames() makes easy get dependent variable column titles (thanks @NickCH-K) output=\"modelsummary_list\" save lightweight list-based representation table can saved fed modelsummary get full table. vcov adds row note type standard errors. modelsummary accepts single model multiple vcovs. get_gof forwards … model_performance coef_map accepts unnamed vectors easy subsetting fixest::fixest_multi support options(modelsummary_get) set order extraction functions use hood (broom vs. easystats vs. ) metrics argument performance::model_performance available via modelsummary’s … ellipsis limit GOF statistics Bayesian models. users can omit stars legend note using glue strings: estimate=\"{estimate}{stars}\" output=“html” can use gt setting options(modelsummary_factory_html=\"gt\") datasummary_correlation: passes ... forward new function: datasummary_correlation_format datasummary_correlation’s method argument accepts functions “pearspear” (thanks @joachim-gassen) datasummary: datasummary functions rounding accept …, big.mark, etc. datasummary_skim: now works haven_labeled numeric faster tables bayesian models. Bug fixes lints","code":""},{"path":"https://vincentarelbundock.github.io/modelsummary/dev/news/index.html","id":"modelsummary-066","dir":"Changelog","previous_headings":"","what":"modelsummary 0.6.6","title":"modelsummary 0.6.6","text":"CRAN release: 2021-02-16 new output format: latex_tabular tidy_custom allows partial term matches modelsummary(coef_rename) accepts functions new function coef_rename use modelsummary(coef_rename=coef_rename) modelplot accepts add_rows add reference categories informative error message estimate statistic available bug fixes","code":""},{"path":"https://vincentarelbundock.github.io/modelsummary/dev/news/index.html","id":"modelsummary-065","dir":"Changelog","previous_headings":"","what":"modelsummary 0.6.5","title":"modelsummary 0.6.5","text":"CRAN release: 2021-01-07 statistic_override becomes vcov vcov accepts shortcuts: “robust”, “stata”, “HC0”, etc. vcov accepts formulas clustered SEs: ~group modelsummary_wide new “stacking” argument html horizontal rule separate estimates form gof gof_map accepts list lists. needs 3 columns. support officedown Rmd estimate accepts vector per model estimates options(modelsummary_default) can markdown, html, latex bug: passing arguments … bug: stars rounding","code":""},{"path":"https://vincentarelbundock.github.io/modelsummary/dev/news/index.html","id":"modelsummary-064","dir":"Changelog","previous_headings":"","what":"modelsummary 0.6.4","title":"modelsummary 0.6.4","text":"CRAN release: 2020-12-15 glue format estimate statistic easystats support model info extraction deprecate statistic_vertical deprecate extract_models. Use modelsummary(output=“dataframe”) instead. modelplot pushes … modelsummary(output=“dataframe”) datasummary_skim(type=“dataset”) gof_map omits default datasummary_balance uses row percentages statistic_override require list statistic_override accepts single model N function well formatted N datasummary Bug fixes","code":""},{"path":"https://vincentarelbundock.github.io/modelsummary/dev/news/index.html","id":"modelsummary-063","dir":"Changelog","previous_headings":"","what":"modelsummary 0.6.3","title":"modelsummary 0.6.3","text":"CRAN release: 2020-10-24 new function: modelsummary_wide coef_omit gof_omit use grepl(perl=TRUE) fmt accepts integer, string function respects options(OutDec=“,”) align argument modelsummary align liberal accept dcolumn alignment glance_custom methods lfe fixest bug fixes","code":""},{"path":"https://vincentarelbundock.github.io/modelsummary/dev/news/index.html","id":"modelsummary-062","dir":"Changelog","previous_headings":"","what":"modelsummary 0.6.2","title":"modelsummary 0.6.2","text":"CRAN release: 2020-09-29 new argument: coef_rename new function: datasummary_df preserve term order modelsummary refactor datasummary_balance datasummary_skim uses svg histograms instead unicode removed 5 dependencies pass … kableExtra::kbl customization test improvements internal code style bug fixes","code":""},{"path":"https://vincentarelbundock.github.io/modelsummary/dev/news/index.html","id":"modelsummary-061","dir":"Changelog","previous_headings":"","what":"modelsummary 0.6.1","title":"modelsummary 0.6.1","text":"CRAN release: 2020-09-04 bug fixes","code":""},{"path":"https://vincentarelbundock.github.io/modelsummary/dev/news/index.html","id":"modelsummary-060","dir":"Changelog","previous_headings":"","what":"modelsummary 0.6.0","title":"modelsummary 0.6.0","text":"CRAN release: 2020-09-02 default HTML output factory now kableExtra interaction “:” gsubbed “0d7” dependencies: removed 1 depends, 3 imports, 3 suggests word_document knitr works ---box bug fixes","code":""},{"path":"https://vincentarelbundock.github.io/modelsummary/dev/news/index.html","id":"modelsummary-051","dir":"Changelog","previous_headings":"","what":"modelsummary 0.5.1","title":"modelsummary 0.5.1","text":"CRAN release: 2020-08-02 glance_custom.fixest ships modelsummary","code":""},{"path":"https://vincentarelbundock.github.io/modelsummary/dev/news/index.html","id":"modelsummary-050","dir":"Changelog","previous_headings":"","what":"modelsummary 0.5.0","title":"modelsummary 0.5.0","text":"CRAN release: 2020-07-05 datasummary datasummary_skim datasummary_balance datasummary_correlation modelplot allow duplicate model names bug: can’t use coef_map multiple statistics (thanks @sbw78) bug: wrong number stars w/ statistic=‘p.value’ (thanks @torfason) output=‘data.frame’. extract longer documented.","code":""},{"path":"https://vincentarelbundock.github.io/modelsummary/dev/news/index.html","id":"modelsummary-041","dir":"Changelog","previous_headings":"","what":"modelsummary 0.4.1","title":"modelsummary 0.4.1","text":"CRAN release: 2020-06-17 add_rows now accepts data.frame “position” “section” columns add_rows_location deprecated bug sanity_output prevented overwriting files","code":""},{"path":"https://vincentarelbundock.github.io/modelsummary/dev/news/index.html","id":"modelsummary-040","dir":"Changelog","previous_headings":"","what":"modelsummary 0.4.0","title":"modelsummary 0.4.0","text":"CRAN release: 2020-06-13 huxtable support flextable support estimate argument fixest tidiers website vignette improvements gof_map additions glance_custom tidy_custom","code":""},{"path":"https://vincentarelbundock.github.io/modelsummary/dev/news/index.html","id":"modelsummary-030","dir":"Changelog","previous_headings":"","what":"modelsummary 0.3.0","title":"modelsummary 0.3.0","text":"CRAN release: 2020-05-26 ---box Rmarkdown compilation HTML, PDF, RTF kableExtra output format LaTeX Markdown Support threeparttable, colors, many LaTeX options Deprecated arguments: filename, subtitle Deprecated functions: clean_latex, knit_latex pkgdown website doc improvements mitools tidiers New tests","code":""},{"path":"https://vincentarelbundock.github.io/modelsummary/dev/news/index.html","id":"modelsummary-021","dir":"Changelog","previous_headings":"","what":"modelsummary 0.2.1","title":"modelsummary 0.2.1","text":"CRAN release: 2020-04-30 Convenience function render markdown row/column labels bug: breakage GOF omitted Clean manual @keywords internal bug: tidyr import","code":""},{"path":"https://vincentarelbundock.github.io/modelsummary/dev/news/index.html","id":"modelsummary-020","dir":"Changelog","previous_headings":"","what":"modelsummary 0.2.0","title":"modelsummary 0.2.0","text":"CRAN release: 2020-04-05 gt now available CRAN new latex_env argument knit_latex clean_latex bug gof omitted bug statistic_override functions bug caused upstream changes tab_style bug caused upstream changes filename=‘rtf’ Allow multiple rows uncertainty estimates per coefficient Preserve add_rows order Display uncertainty estimates next coefficient statistic_vertical = FALSE Better clean_latex function Can display R2 confidence intervals mice-imputed lm-models Internal functions @keywords internal avoid inclusion docs Statistic override accepts pre-formatted character vectors","code":""},{"path":"https://vincentarelbundock.github.io/modelsummary/dev/news/index.html","id":"modelsummary-010","dir":"Changelog","previous_headings":"","what":"modelsummary 0.1.0","title":"modelsummary 0.1.0","text":"CRAN release: 2019-07-15 Initial release (gt still needs installed github)","code":""}]
+[{"path":"https://vincentarelbundock.github.io/modelsummary/dev/LICENSE.html","id":null,"dir":"","previous_headings":"","what":"GNU General Public License","title":"GNU General Public License","text":"Version 3, 29 June 2007Copyright © 2007 Free Software Foundation, Inc. Everyone permitted copy distribute verbatim copies license document, changing allowed.","code":""},{"path":"https://vincentarelbundock.github.io/modelsummary/dev/LICENSE.html","id":"preamble","dir":"","previous_headings":"","what":"Preamble","title":"GNU General Public License","text":"GNU General Public License free, copyleft license software kinds works. licenses software practical works designed take away freedom share change works. contrast, GNU General Public License intended guarantee freedom share change versions program–make sure remains free software users. , Free Software Foundation, use GNU General Public License software; applies also work released way authors. can apply programs, . speak free software, referring freedom, price. General Public Licenses designed make sure freedom distribute copies free software (charge wish), receive source code can get want , can change software use pieces new free programs, know can things. protect rights, need prevent others denying rights asking surrender rights. Therefore, certain responsibilities distribute copies software, modify : responsibilities respect freedom others. example, distribute copies program, whether gratis fee, must pass recipients freedoms received. must make sure , , receive can get source code. must show terms know rights. Developers use GNU GPL protect rights two steps: (1) assert copyright software, (2) offer License giving legal permission copy, distribute /modify . developers’ authors’ protection, GPL clearly explains warranty free software. users’ authors’ sake, GPL requires modified versions marked changed, problems attributed erroneously authors previous versions. devices designed deny users access install run modified versions software inside , although manufacturer can . fundamentally incompatible aim protecting users’ freedom change software. systematic pattern abuse occurs area products individuals use, precisely unacceptable. Therefore, designed version GPL prohibit practice products. problems arise substantially domains, stand ready extend provision domains future versions GPL, needed protect freedom users. Finally, every program threatened constantly software patents. States allow patents restrict development use software general-purpose computers, , wish avoid special danger patents applied free program make effectively proprietary. prevent , GPL assures patents used render program non-free. precise terms conditions copying, distribution modification follow.","code":""},{"path":[]},{"path":"https://vincentarelbundock.github.io/modelsummary/dev/LICENSE.html","id":"id_0-definitions","dir":"","previous_headings":"TERMS AND CONDITIONS","what":"0. Definitions","title":"GNU General Public License","text":"“License” refers version 3 GNU General Public License. “Copyright” also means copyright-like laws apply kinds works, semiconductor masks. “Program” refers copyrightable work licensed License. licensee addressed “”. “Licensees” “recipients” may individuals organizations. “modify” work means copy adapt part work fashion requiring copyright permission, making exact copy. resulting work called “modified version” earlier work work “based ” earlier work. “covered work” means either unmodified Program work based Program. “propagate” work means anything , without permission, make directly secondarily liable infringement applicable copyright law, except executing computer modifying private copy. Propagation includes copying, distribution (without modification), making available public, countries activities well. “convey” work means kind propagation enables parties make receive copies. Mere interaction user computer network, transfer copy, conveying. interactive user interface displays “Appropriate Legal Notices” extent includes convenient prominently visible feature (1) displays appropriate copyright notice, (2) tells user warranty work (except extent warranties provided), licensees may convey work License, view copy License. interface presents list user commands options, menu, prominent item list meets criterion.","code":""},{"path":"https://vincentarelbundock.github.io/modelsummary/dev/LICENSE.html","id":"id_1-source-code","dir":"","previous_headings":"TERMS AND CONDITIONS","what":"1. Source Code","title":"GNU General Public License","text":"“source code” work means preferred form work making modifications . “Object code” means non-source form work. “Standard Interface” means interface either official standard defined recognized standards body, , case interfaces specified particular programming language, one widely used among developers working language. “System Libraries” executable work include anything, work whole, () included normal form packaging Major Component, part Major Component, (b) serves enable use work Major Component, implement Standard Interface implementation available public source code form. “Major Component”, context, means major essential component (kernel, window system, ) specific operating system () executable work runs, compiler used produce work, object code interpreter used run . “Corresponding Source” work object code form means source code needed generate, install, (executable work) run object code modify work, including scripts control activities. However, include work’s System Libraries, general-purpose tools generally available free programs used unmodified performing activities part work. example, Corresponding Source includes interface definition files associated source files work, source code shared libraries dynamically linked subprograms work specifically designed require, intimate data communication control flow subprograms parts work. Corresponding Source need include anything users can regenerate automatically parts Corresponding Source. Corresponding Source work source code form work.","code":""},{"path":"https://vincentarelbundock.github.io/modelsummary/dev/LICENSE.html","id":"id_2-basic-permissions","dir":"","previous_headings":"TERMS AND CONDITIONS","what":"2. Basic Permissions","title":"GNU General Public License","text":"rights granted License granted term copyright Program, irrevocable provided stated conditions met. License explicitly affirms unlimited permission run unmodified Program. output running covered work covered License output, given content, constitutes covered work. License acknowledges rights fair use equivalent, provided copyright law. may make, run propagate covered works convey, without conditions long license otherwise remains force. may convey covered works others sole purpose make modifications exclusively , provide facilities running works, provided comply terms License conveying material control copyright. thus making running covered works must exclusively behalf, direction control, terms prohibit making copies copyrighted material outside relationship . Conveying circumstances permitted solely conditions stated . Sublicensing allowed; section 10 makes unnecessary.","code":""},{"path":"https://vincentarelbundock.github.io/modelsummary/dev/LICENSE.html","id":"id_3-protecting-users-legal-rights-from-anti-circumvention-law","dir":"","previous_headings":"TERMS AND CONDITIONS","what":"3. Protecting Users’ Legal Rights From Anti-Circumvention Law","title":"GNU General Public License","text":"covered work shall deemed part effective technological measure applicable law fulfilling obligations article 11 WIPO copyright treaty adopted 20 December 1996, similar laws prohibiting restricting circumvention measures. convey covered work, waive legal power forbid circumvention technological measures extent circumvention effected exercising rights License respect covered work, disclaim intention limit operation modification work means enforcing, work’s users, third parties’ legal rights forbid circumvention technological measures.","code":""},{"path":"https://vincentarelbundock.github.io/modelsummary/dev/LICENSE.html","id":"id_4-conveying-verbatim-copies","dir":"","previous_headings":"TERMS AND CONDITIONS","what":"4. Conveying Verbatim Copies","title":"GNU General Public License","text":"may convey verbatim copies Program’s source code receive , medium, provided conspicuously appropriately publish copy appropriate copyright notice; keep intact notices stating License non-permissive terms added accord section 7 apply code; keep intact notices absence warranty; give recipients copy License along Program. may charge price price copy convey, may offer support warranty protection fee.","code":""},{"path":"https://vincentarelbundock.github.io/modelsummary/dev/LICENSE.html","id":"id_5-conveying-modified-source-versions","dir":"","previous_headings":"TERMS AND CONDITIONS","what":"5. Conveying Modified Source Versions","title":"GNU General Public License","text":"may convey work based Program, modifications produce Program, form source code terms section 4, provided also meet conditions: ) work must carry prominent notices stating modified , giving relevant date. b) work must carry prominent notices stating released License conditions added section 7. requirement modifies requirement section 4 “keep intact notices”. c) must license entire work, whole, License anyone comes possession copy. License therefore apply, along applicable section 7 additional terms, whole work, parts, regardless packaged. License gives permission license work way, invalidate permission separately received . d) work interactive user interfaces, must display Appropriate Legal Notices; however, Program interactive interfaces display Appropriate Legal Notices, work need make . compilation covered work separate independent works, nature extensions covered work, combined form larger program, volume storage distribution medium, called “aggregate” compilation resulting copyright used limit access legal rights compilation’s users beyond individual works permit. Inclusion covered work aggregate cause License apply parts aggregate.","code":""},{"path":"https://vincentarelbundock.github.io/modelsummary/dev/LICENSE.html","id":"id_6-conveying-non-source-forms","dir":"","previous_headings":"TERMS AND CONDITIONS","what":"6. Conveying Non-Source Forms","title":"GNU General Public License","text":"may convey covered work object code form terms sections 4 5, provided also convey machine-readable Corresponding Source terms License, one ways: ) Convey object code , embodied , physical product (including physical distribution medium), accompanied Corresponding Source fixed durable physical medium customarily used software interchange. b) Convey object code , embodied , physical product (including physical distribution medium), accompanied written offer, valid least three years valid long offer spare parts customer support product model, give anyone possesses object code either (1) copy Corresponding Source software product covered License, durable physical medium customarily used software interchange, price reasonable cost physically performing conveying source, (2) access copy Corresponding Source network server charge. c) Convey individual copies object code copy written offer provide Corresponding Source. alternative allowed occasionally noncommercially, received object code offer, accord subsection 6b. d) Convey object code offering access designated place (gratis charge), offer equivalent access Corresponding Source way place charge. need require recipients copy Corresponding Source along object code. place copy object code network server, Corresponding Source may different server (operated third party) supports equivalent copying facilities, provided maintain clear directions next object code saying find Corresponding Source. Regardless server hosts Corresponding Source, remain obligated ensure available long needed satisfy requirements. e) Convey object code using peer--peer transmission, provided inform peers object code Corresponding Source work offered general public charge subsection 6d. separable portion object code, whose source code excluded Corresponding Source System Library, need included conveying object code work. “User Product” either (1) “consumer product”, means tangible personal property normally used personal, family, household purposes, (2) anything designed sold incorporation dwelling. determining whether product consumer product, doubtful cases shall resolved favor coverage. particular product received particular user, “normally used” refers typical common use class product, regardless status particular user way particular user actually uses, expects expected use, product. product consumer product regardless whether product substantial commercial, industrial non-consumer uses, unless uses represent significant mode use product. “Installation Information” User Product means methods, procedures, authorization keys, information required install execute modified versions covered work User Product modified version Corresponding Source. information must suffice ensure continued functioning modified object code case prevented interfered solely modification made. convey object code work section , , specifically use , User Product, conveying occurs part transaction right possession use User Product transferred recipient perpetuity fixed term (regardless transaction characterized), Corresponding Source conveyed section must accompanied Installation Information. requirement apply neither third party retains ability install modified object code User Product (example, work installed ROM). requirement provide Installation Information include requirement continue provide support service, warranty, updates work modified installed recipient, User Product modified installed. Access network may denied modification materially adversely affects operation network violates rules protocols communication across network. Corresponding Source conveyed, Installation Information provided, accord section must format publicly documented (implementation available public source code form), must require special password key unpacking, reading copying.","code":""},{"path":"https://vincentarelbundock.github.io/modelsummary/dev/LICENSE.html","id":"id_7-additional-terms","dir":"","previous_headings":"TERMS AND CONDITIONS","what":"7. Additional Terms","title":"GNU General Public License","text":"“Additional permissions” terms supplement terms License making exceptions one conditions. Additional permissions applicable entire Program shall treated though included License, extent valid applicable law. additional permissions apply part Program, part may used separately permissions, entire Program remains governed License without regard additional permissions. convey copy covered work, may option remove additional permissions copy, part . (Additional permissions may written require removal certain cases modify work.) may place additional permissions material, added covered work, can give appropriate copyright permission. Notwithstanding provision License, material add covered work, may (authorized copyright holders material) supplement terms License terms: ) Disclaiming warranty limiting liability differently terms sections 15 16 License; b) Requiring preservation specified reasonable legal notices author attributions material Appropriate Legal Notices displayed works containing ; c) Prohibiting misrepresentation origin material, requiring modified versions material marked reasonable ways different original version; d) Limiting use publicity purposes names licensors authors material; e) Declining grant rights trademark law use trade names, trademarks, service marks; f) Requiring indemnification licensors authors material anyone conveys material (modified versions ) contractual assumptions liability recipient, liability contractual assumptions directly impose licensors authors. non-permissive additional terms considered “restrictions” within meaning section 10. Program received , part , contains notice stating governed License along term restriction, may remove term. license document contains restriction permits relicensing conveying License, may add covered work material governed terms license document, provided restriction survive relicensing conveying. add terms covered work accord section, must place, relevant source files, statement additional terms apply files, notice indicating find applicable terms. Additional terms, permissive non-permissive, may stated form separately written license, stated exceptions; requirements apply either way.","code":""},{"path":"https://vincentarelbundock.github.io/modelsummary/dev/LICENSE.html","id":"id_8-termination","dir":"","previous_headings":"TERMS AND CONDITIONS","what":"8. Termination","title":"GNU General Public License","text":"may propagate modify covered work except expressly provided License. attempt otherwise propagate modify void, automatically terminate rights License (including patent licenses granted third paragraph section 11). However, cease violation License, license particular copyright holder reinstated () provisionally, unless copyright holder explicitly finally terminates license, (b) permanently, copyright holder fails notify violation reasonable means prior 60 days cessation. Moreover, license particular copyright holder reinstated permanently copyright holder notifies violation reasonable means, first time received notice violation License (work) copyright holder, cure violation prior 30 days receipt notice. Termination rights section terminate licenses parties received copies rights License. rights terminated permanently reinstated, qualify receive new licenses material section 10.","code":""},{"path":"https://vincentarelbundock.github.io/modelsummary/dev/LICENSE.html","id":"id_9-acceptance-not-required-for-having-copies","dir":"","previous_headings":"TERMS AND CONDITIONS","what":"9. Acceptance Not Required for Having Copies","title":"GNU General Public License","text":"required accept License order receive run copy Program. Ancillary propagation covered work occurring solely consequence using peer--peer transmission receive copy likewise require acceptance. However, nothing License grants permission propagate modify covered work. actions infringe copyright accept License. Therefore, modifying propagating covered work, indicate acceptance License .","code":""},{"path":"https://vincentarelbundock.github.io/modelsummary/dev/LICENSE.html","id":"id_10-automatic-licensing-of-downstream-recipients","dir":"","previous_headings":"TERMS AND CONDITIONS","what":"10. Automatic Licensing of Downstream Recipients","title":"GNU General Public License","text":"time convey covered work, recipient automatically receives license original licensors, run, modify propagate work, subject License. responsible enforcing compliance third parties License. “entity transaction” transaction transferring control organization, substantially assets one, subdividing organization, merging organizations. propagation covered work results entity transaction, party transaction receives copy work also receives whatever licenses work party’s predecessor interest give previous paragraph, plus right possession Corresponding Source work predecessor interest, predecessor can get reasonable efforts. may impose restrictions exercise rights granted affirmed License. example, may impose license fee, royalty, charge exercise rights granted License, may initiate litigation (including cross-claim counterclaim lawsuit) alleging patent claim infringed making, using, selling, offering sale, importing Program portion .","code":""},{"path":"https://vincentarelbundock.github.io/modelsummary/dev/LICENSE.html","id":"id_11-patents","dir":"","previous_headings":"TERMS AND CONDITIONS","what":"11. Patents","title":"GNU General Public License","text":"“contributor” copyright holder authorizes use License Program work Program based. work thus licensed called contributor’s “contributor version”. contributor’s “essential patent claims” patent claims owned controlled contributor, whether already acquired hereafter acquired, infringed manner, permitted License, making, using, selling contributor version, include claims infringed consequence modification contributor version. purposes definition, “control” includes right grant patent sublicenses manner consistent requirements License. contributor grants non-exclusive, worldwide, royalty-free patent license contributor’s essential patent claims, make, use, sell, offer sale, import otherwise run, modify propagate contents contributor version. following three paragraphs, “patent license” express agreement commitment, however denominated, enforce patent (express permission practice patent covenant sue patent infringement). “grant” patent license party means make agreement commitment enforce patent party. convey covered work, knowingly relying patent license, Corresponding Source work available anyone copy, free charge terms License, publicly available network server readily accessible means, must either (1) cause Corresponding Source available, (2) arrange deprive benefit patent license particular work, (3) arrange, manner consistent requirements License, extend patent license downstream recipients. “Knowingly relying” means actual knowledge , patent license, conveying covered work country, recipient’s use covered work country, infringe one identifiable patents country reason believe valid. , pursuant connection single transaction arrangement, convey, propagate procuring conveyance , covered work, grant patent license parties receiving covered work authorizing use, propagate, modify convey specific copy covered work, patent license grant automatically extended recipients covered work works based . patent license “discriminatory” include within scope coverage, prohibits exercise , conditioned non-exercise one rights specifically granted License. may convey covered work party arrangement third party business distributing software, make payment third party based extent activity conveying work, third party grants, parties receive covered work , discriminatory patent license () connection copies covered work conveyed (copies made copies), (b) primarily connection specific products compilations contain covered work, unless entered arrangement, patent license granted, prior 28 March 2007. Nothing License shall construed excluding limiting implied license defenses infringement may otherwise available applicable patent law.","code":""},{"path":"https://vincentarelbundock.github.io/modelsummary/dev/LICENSE.html","id":"id_12-no-surrender-of-others-freedom","dir":"","previous_headings":"TERMS AND CONDITIONS","what":"12. No Surrender of Others’ Freedom","title":"GNU General Public License","text":"conditions imposed (whether court order, agreement otherwise) contradict conditions License, excuse conditions License. convey covered work satisfy simultaneously obligations License pertinent obligations, consequence may convey . example, agree terms obligate collect royalty conveying convey Program, way satisfy terms License refrain entirely conveying Program.","code":""},{"path":"https://vincentarelbundock.github.io/modelsummary/dev/LICENSE.html","id":"id_13-use-with-the-gnu-affero-general-public-license","dir":"","previous_headings":"TERMS AND CONDITIONS","what":"13. Use with the GNU Affero General Public License","title":"GNU General Public License","text":"Notwithstanding provision License, permission link combine covered work work licensed version 3 GNU Affero General Public License single combined work, convey resulting work. terms License continue apply part covered work, special requirements GNU Affero General Public License, section 13, concerning interaction network apply combination .","code":""},{"path":"https://vincentarelbundock.github.io/modelsummary/dev/LICENSE.html","id":"id_14-revised-versions-of-this-license","dir":"","previous_headings":"TERMS AND CONDITIONS","what":"14. Revised Versions of this License","title":"GNU General Public License","text":"Free Software Foundation may publish revised /new versions GNU General Public License time time. new versions similar spirit present version, may differ detail address new problems concerns. version given distinguishing version number. Program specifies certain numbered version GNU General Public License “later version” applies , option following terms conditions either numbered version later version published Free Software Foundation. Program specify version number GNU General Public License, may choose version ever published Free Software Foundation. Program specifies proxy can decide future versions GNU General Public License can used, proxy’s public statement acceptance version permanently authorizes choose version Program. Later license versions may give additional different permissions. However, additional obligations imposed author copyright holder result choosing follow later version.","code":""},{"path":"https://vincentarelbundock.github.io/modelsummary/dev/LICENSE.html","id":"id_15-disclaimer-of-warranty","dir":"","previous_headings":"TERMS AND CONDITIONS","what":"15. Disclaimer of Warranty","title":"GNU General Public License","text":"WARRANTY PROGRAM, EXTENT PERMITTED APPLICABLE LAW. EXCEPT OTHERWISE STATED WRITING COPYRIGHT HOLDERS /PARTIES PROVIDE PROGRAM “” WITHOUT WARRANTY KIND, EITHER EXPRESSED IMPLIED, INCLUDING, LIMITED , IMPLIED WARRANTIES MERCHANTABILITY FITNESS PARTICULAR PURPOSE. ENTIRE RISK QUALITY PERFORMANCE PROGRAM . PROGRAM PROVE DEFECTIVE, ASSUME COST NECESSARY SERVICING, REPAIR CORRECTION.","code":""},{"path":"https://vincentarelbundock.github.io/modelsummary/dev/LICENSE.html","id":"id_16-limitation-of-liability","dir":"","previous_headings":"TERMS AND CONDITIONS","what":"16. Limitation of Liability","title":"GNU General Public License","text":"EVENT UNLESS REQUIRED APPLICABLE LAW AGREED WRITING COPYRIGHT HOLDER, PARTY MODIFIES /CONVEYS PROGRAM PERMITTED , LIABLE DAMAGES, INCLUDING GENERAL, SPECIAL, INCIDENTAL CONSEQUENTIAL DAMAGES ARISING USE INABILITY USE PROGRAM (INCLUDING LIMITED LOSS DATA DATA RENDERED INACCURATE LOSSES SUSTAINED THIRD PARTIES FAILURE PROGRAM OPERATE PROGRAMS), EVEN HOLDER PARTY ADVISED POSSIBILITY DAMAGES.","code":""},{"path":"https://vincentarelbundock.github.io/modelsummary/dev/LICENSE.html","id":"id_17-interpretation-of-sections-15-and-16","dir":"","previous_headings":"TERMS AND CONDITIONS","what":"17. Interpretation of Sections 15 and 16","title":"GNU General Public License","text":"disclaimer warranty limitation liability provided given local legal effect according terms, reviewing courts shall apply local law closely approximates absolute waiver civil liability connection Program, unless warranty assumption liability accompanies copy Program return fee. END TERMS CONDITIONS","code":""},{"path":"https://vincentarelbundock.github.io/modelsummary/dev/LICENSE.html","id":"how-to-apply-these-terms-to-your-new-programs","dir":"","previous_headings":"","what":"How to Apply These Terms to Your New Programs","title":"GNU General Public License","text":"develop new program, want greatest possible use public, best way achieve make free software everyone can redistribute change terms. , attach following notices program. safest attach start source file effectively state exclusion warranty; file least “copyright” line pointer full notice found. Also add information contact electronic paper mail. program terminal interaction, make output short notice like starts interactive mode: hypothetical commands show w show c show appropriate parts General Public License. course, program’s commands might different; GUI interface, use “box”. also get employer (work programmer) school, , sign “copyright disclaimer” program, necessary. information , apply follow GNU GPL, see . GNU General Public License permit incorporating program proprietary programs. program subroutine library, may consider useful permit linking proprietary applications library. want , use GNU Lesser General Public License instead License. first, please read .","code":" Copyright (C) 2019 Vincent Arel-Bundock This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program. If not, see . modelsummary Copyright (C) 2019 Vincent Arel-Bundock This program comes with ABSOLUTELY NO WARRANTY; for details type 'show w'. This is free software, and you are welcome to redistribute it under certain conditions; type 'show c' for details."},{"path":"https://vincentarelbundock.github.io/modelsummary/dev/articles/appearance.html","id":"gt","dir":"Articles","previous_headings":"","what":"gt","title":"Customizing the look of your table","text":"illustrate customize tables using gt package use following functions gt package: tab_spanner creates labels group columns. tab_footnote adds footnote matching marking specific cell. tab_style can modify text color rows, columns, cells. produce “cleaner” look, also use modelsummary’s stars, coef_map, gof_omit, title arguments. Note order access gt functions, must first load library. modelsummary table customized gt gt website offers many examples. possibilities endless. instance, gt allows embed images tables using text_transform local_image functions: modelsummary table customized gt","code":"library(gt) # build table with `modelsummary` cm <- c( '(Intercept)' = 'Constant', 'Literacy' = 'Literacy (%)', 'Clergy' = 'Priests/capita') cap <- 'A modelsummary table customized with gt' tab <- modelsummary(models, output = \"gt\", coef_map = cm, stars = TRUE, title = cap, gof_omit = 'IC|Log|Adj') # customize table with `gt` tab %>% # column labels tab_spanner(label = 'Donations', columns = 2:3) %>% tab_spanner(label = 'Crimes (persons)', columns = 4:5) %>% tab_spanner(label = 'Crimes (property)', columns = 6) %>% # footnote tab_footnote(footnote = md(\"A very **important** variable.\"), locations = cells_body(rows = 3, columns = 1)) %>% # text and background color tab_style(style = cell_text(color = 'red'), locations = cells_body(rows = 3)) %>% tab_style(style = cell_fill(color = 'lightblue'), locations = cells_body(rows = 5)) f <- function(x) web_image(url = \"https://user-images.githubusercontent.com/987057/82732352-b9aabf00-9cda-11ea-92a6-26750cf097d0.png\", height = 80) tab %>% text_transform(locations = cells_body(columns = 2:6, rows = 1), fn = f)"},{"path":"https://vincentarelbundock.github.io/modelsummary/dev/articles/appearance.html","id":"kableextra","dir":"Articles","previous_headings":"","what":"kableExtra","title":"Customizing the look of your table","text":"now illustrate customize tables using functions kableExtra package: add_header_above creates labels group columns. add_footnote adds footnote matching marking specific cell. row_spec can modify text color rows, columns, cells. use code , specify output='kableExtra' modelsummary() call: modelsummary table customized kableExtra kableExtra functions can used produce LaTeX / PDF tables one:","code":"library(kableExtra) # build table with `modelsummary` cm <- c( '(Intercept)' = 'Constant', 'Literacy' = 'Literacy (%)', 'Clergy' = 'Priests/capita') cap <- 'A modelsummary table customized with kableExtra' tab <- modelsummary(models, output = 'kableExtra', coef_map = cm, stars = TRUE, title = cap, gof_omit = 'IC|Log|Adj') # customize table with `kableExtra` tab %>% # column labels add_header_above(c(\" \" = 1, \"Donations\" = 2, \"Crimes (person)\" = 2, \"Crimes (property)\" = 1)) %>% # text and background color row_spec(3, color = 'red') %>% row_spec(5, background = 'lightblue')"},{"path":"https://vincentarelbundock.github.io/modelsummary/dev/articles/appearance.html","id":"flextable","dir":"Articles","previous_headings":"","what":"flextable","title":"Customizing the look of your table","text":"now illustrate customize tables using functions flextable package: color modify color text bg modify color background autofit sets column width sensible values. use code , specify output='flextable' modelsummary() call: modelsummary table customized flextable OLS 1 Poisson 1 OLS 2 Poisson 2 OLS 3 Constant 8759.068*** 8.986*** 20357.309*** 9.708*** 11243.544*** (1559.363) (0.004) (2020.980) (0.003) (1011.240) Literacy (%) -42.886 -0.006*** -15.358 0.000*** -68.507*** (36.362) (0.000) (47.127) (0.000) (18.029) Priests/capita 0.002*** 0.004*** -16.376 (0.000) (0.000) (12.522) Num.Obs. 86 86 86 86 86 R2 0.016 0.001 0.152 F 1.391 4170.610 0.106 7905.811 7.441 RMSE 5753.14 5727.27 7456.23 7233.22 2793.43 + p < 0.1, * p < 0.05, ** p < 0.01, *** p < 0.001","code":"library(flextable) #> #> Attaching package: 'flextable' #> The following objects are masked from 'package:kableExtra': #> #> as_image, footnote # build table with `modelsummary` cm <- c( '(Intercept)' = 'Constant', 'Literacy' = 'Literacy (%)', 'Clergy' = 'Priests/capita') cap <- 'A modelsummary table customized with flextable' tab <- modelsummary(models, output = 'flextable', coef_map = cm, stars = TRUE, title = cap, gof_omit = 'IC|Log|Adj') # customize table with `flextable` tab %>% # text and background color color(3, color = 'red') %>% bg(5, bg = 'lightblue') %>% # column widths autofit()"},{"path":"https://vincentarelbundock.github.io/modelsummary/dev/articles/appearance.html","id":"huxtable","dir":"Articles","previous_headings":"","what":"huxtable","title":"Customizing the look of your table","text":"now illustrate customize tables using functions huxtable package: set_text_color change color entries use code , specify output='huxtable' modelsummary() call: modelsummary table customized huxtable","code":"library(huxtable) # build table with `modelsummary` cm <- c( '(Intercept)' = 'Constant', 'Literacy' = 'Literacy (%)', 'Clergy' = 'Priests/capita') cap <- 'A modelsummary table customized with huxtable' tab <- modelsummary(models, output = 'huxtable', coef_map = cm, stars = TRUE, title = cap, gof_omit = 'IC|Log|Adj') # customize table with `huxtable` tab %>% # text color set_text_color(row = 4, col = 1:ncol(.), value = 'red')"},{"path":"https://vincentarelbundock.github.io/modelsummary/dev/articles/appearance.html","id":"themes","dir":"Articles","previous_headings":"","what":"Themes","title":"Customizing the look of your table","text":"want apply post-processing functions tables, can use modelsummary’s theming functionality. , first create function post-process table. function must accept table first argument, include ellipsis (...). Optionally, theming function can also accept hrule argument vector row positions insert horizontal rule, output_format allows output format-specific customization. inspiration, may want consult default modelsummary themes themes.R file Github repository. theming function created, assign global option called modelsummary_theme_kableExtra, modelsummary_theme_gt, modelsummary_theme_flextable, modelsummary_theme_huxtable. example, want add row striping gt tables: Restore default theme:","code":"library(gt) # The ... ellipsis is required! custom_theme <- function(x, ...) { x %>% gt::opt_row_striping(row_striping = TRUE) } options(\"modelsummary_theme_gt\" = custom_theme) mod <- lm(mpg ~ hp + drat, mtcars) modelsummary(mod, output = \"gt\") url <- 'https://vincentarelbundock.github.io/Rdatasets/csv/palmerpenguins/penguins.csv' penguins <- read.csv(url) datasummary_crosstab(island ~ sex * species, output = \"gt\", data = penguins) options(\"modelsummary_theme_gt\" = NULL)"},{"path":"https://vincentarelbundock.github.io/modelsummary/dev/articles/appearance.html","id":"themes-data-frame","dir":"Articles","previous_headings":"Themes","what":"Themes: Data Frame","title":"Customizing the look of your table","text":"particularly flexible strategy apply theme dataframe output format. illustrate, recall setting output=\"dataframe\" produces data frame lot extraneous meta information. produce nice table, process output bit: Imagine want create table using DT package, table-drawing backend currently supported modelsummary. , can create theming function: Restore default theme:","code":"mod <- lm(mpg ~ hp + drat, mtcars) modelsummary(mod, output = \"dataframe\") library(DT) theme_df <- function(tab) { out <- tab out$term[out$statistic == \"modelsummary_tmp2\"] <- \" \" out$part <- out$statistic <- NULL colnames(out)[1] <- \" \" datatable(out, rownames = FALSE, options = list(pageLength = 30)) } options(\"modelsummary_theme_dataframe\" = theme_df) modelsummary(mod, output = \"dataframe\") options(\"modelsummary_theme_dataframe\" = NULL)"},{"path":"https://vincentarelbundock.github.io/modelsummary/dev/articles/appearance.html","id":"variable-labels","dir":"Articles","previous_headings":"","what":"Variable labels","title":"Customizing the look of your table","text":"packages like haven can assign attributes columns dataset use labels. functions modelsummary can display labels automatically. example:","code":"library(haven) dat <- mtcars dat$am <- haven::labelled(dat$am, label = \"Transmission\") dat$mpg <- haven::labelled(dat$mpg, label = \"Miles per Gallon\") mod <- lm(hp ~ mpg + am, dat = dat) modelsummary(mod, coef_rename = TRUE) datasummary_skim(dat[, c(\"mpg\", \"am\", \"drat\")]) #> Warning: The histogram argument is only supported for (a) output types \"default\", #> \"html\", or \"kableExtra\"; (b) writing to file paths with extensions #> \".html\", \".jpg\", or \".png\"; and (c) Rmarkdown or knitr documents #> compiled to PDF or HTML. Use `histogram=FALSE` to silence this warning."},{"path":"https://vincentarelbundock.github.io/modelsummary/dev/articles/appearance.html","id":"warning-saving-to-file","dir":"Articles","previous_headings":"","what":"Warning: Saving to file","title":"Customizing the look of your table","text":"users supply file name output argument, table written immediately file. means users post-process customize resulting table using functions gt, kableExtra, huxtable, flextable. users specify filename output argument, modelsummary() call final one chain. OK: OK: save customized table, apply customization functions need saving using gt::gtsave, kableExtra::save_kable, appropriate helper function package using customize table. example, add color column spanners gt package: procedure slightly different kableExtra, package needs know final output format immediately table created. instance, want produce, customize, save LaTeX table:","code":"modelsummary(models, output = 'table.html') modelsummary(models, output = 'table.html') %>% tab_spanner(label = 'Literacy', columns = c('OLS 1', 'Poisson 1')) library(gt) tab <- modelsummary(models, output = \"gt\") %>% tab_spanner(label = 'Donations', columns = 2:3) %>% tab_spanner(label = 'Crimes (persons)', columns = 4:5) %>% tab_spanner(label = 'Crimes (property)', columns = 6) gt::gtsave(tab, filename = \"table.html\") library(kableExtra) tab <- modelsummary(models, output = 'latex') %>% add_header_above(c(\" \" = 1, \"Donations\" = 2, \"Crimes (person)\" = 2, \"Crimes (property)\" = 1)) kableExtra::save_kable(tab, file = \"table.tex\")"},{"path":"https://vincentarelbundock.github.io/modelsummary/dev/articles/appearance.html","id":"dt","dir":"Articles","previous_headings":"","what":"DT","title":"Customizing the look of your table","text":"DT package interface JavasScript DataTables library. can create DT table using output argument, pass arguments modelsummary() passed forward DT::datatable customize output table. example, let’s use fixest package estimate multiple linear regression models, DT package create table “frozen” first column:","code":"library(fixest) models <- feols(c(mpg, hp) ~ csw0(cyl, drat, am, vs, wt, carb, qsec, gear), data = mtcars) modelsummary( models, output = \"DT\", extensions = \"FixedColumns\", height = 50, options = list(pageLength = 50, scrollX = TRUE, fixedColumns = list(leftColumns = 1)))"},{"path":"https://vincentarelbundock.github.io/modelsummary/dev/articles/datasummary.html","id":"background","dir":"Articles","previous_headings":"","what":"Background","title":"`datasummary`: Crosstabs, frequencies, correlations, balance (a.k.a. ","text":"datasummary built around fantastic tables package R. thin “wrapper” adds convenience functions arguments; user-interface consistent modelsummary; cleaner html output; ability export tables formats, including gt tables, flextable objects, Microsoft Word documents. datasummary general-purpose table-making tool. allows us build (nearly) summary table want using simple 2-sided formulae. example, expression x + y ~ mean + sd, left-hand side formula identifies variables statistics display rows, right-hand side defines columns. , see variables statistics can “nested” * operator produce tables like ones . addition datasummary, modelsummary package includes “family” companion functions named datasummary_*. functions facilitate production standard, commonly used tables. family currently includes: datasummary(): Flexible function create custom tables using 2-sided formulae. datasummary_balance(): Group characteristics (e.g., control vs. treatment) datasummary_correlation(): Table correlations. datasummary_skim(): Quick summary dataset. datasummary_df(): Create table dataframe. datasummary_crosstab(): Cross tabulations categorical variables. next three sections, illustrate use datasummary_balance, datasummary_correlation, datasummary_skim, datasummary_crosstab. , dive datasummary highlight ease flexibility.","code":""},{"path":"https://vincentarelbundock.github.io/modelsummary/dev/articles/datasummary.html","id":"datasummary_skim","dir":"Articles","previous_headings":"","what":"datasummary_skim","title":"`datasummary`: Crosstabs, frequencies, correlations, balance (a.k.a. ","text":"first datasummary companion function called datasummary_skim. heavily inspired one favorite data exploration tools R: skimr package. goal function give us quick look data. illustrate, download data cool new palmerpenguins package Alison Presmanes Hill Allison Horst. data collected Palmer Station Antarctica Gorman, Williams & Fraser (2014), include 3 categorical variables 4 numeric variables. summarize numeric variables dataset, type: summarize categorical variables dataset, type: Later tutorial, become clear datasummary_skim just convenience “template” built around datasummary, since can achieve identical results latter. example, produce text-version tables , can type: Note histogram argument datasummary_skim function FALSE default, printing histograms work computers. issues option, try changing computer’s locale, try using different display font. datasummary_skim function currently allow users summarize continuous categorical variables together single table, datasummary_balance function described next section can .","code":"library(modelsummary) library(tidyverse) url <- 'https://vincentarelbundock.github.io/Rdatasets/csv/palmerpenguins/penguins.csv' penguins <- read.csv(url) datasummary_skim(penguins) datasummary_skim(penguins, type = \"categorical\") datasummary(All(penguins) ~ Mean + SD + Histogram, data = penguins, output = 'markdown') | | Mean| SD| Histogram| |:-----------------|-------:|------:|----------:| |bill_length_mm | 43.92| 5.46| ▁▅▆▆▆▇▇▂▁| |bill_depth_mm | 17.15| 1.97| ▃▄▄▄▇▆▇▅▂▁| |flipper_length_mm | 200.92| 14.06| ▂▅▇▄▁▄▄▂▁| |body_mass_g | 4201.75| 801.95| ▁▄▇▅▄▄▃▃▂▁|"},{"path":"https://vincentarelbundock.github.io/modelsummary/dev/articles/datasummary.html","id":"datasummary_balance","dir":"Articles","previous_headings":"","what":"datasummary_balance","title":"`datasummary`: Crosstabs, frequencies, correlations, balance (a.k.a. ","text":"expressions “balance table” “Table 1” refer type table often printed opening pages scientific peer-reviewed article. Typically, table includes basic descriptive statistics different subsets study population. instance, analysts may want compare socio-demographic characteristics members “control” “treatment” groups randomized control trial, flipper lengths male female penguins. addition, balance tables often include difference means tests. illustrate build balance table using datasummary_balance function, download data job training experiment studies Lalonde (1986). , clean data renaming recoding variables. Now, execute datasummary_balance function. estimatr package installed, datasummary_balance calculate difference means test statistics. Note dataset includes columns called “blocks”, “clusters”, “weights”, information automatically taken consideration estimatr calculating difference means associated statistics. Users can also use ~ 1 formula indicate want summarize data instead splitting analysis across subgroups:","code":"# Download and read data training <- 'https://vincentarelbundock.github.io/Rdatasets/csv/Ecdat/Treatment.csv' training <- read.csv(training) # Rename and recode variables training <- training %>% mutate(`Earnings Before` = re75 / 1000, `Earnings After` = re78 / 1000, Treatment = ifelse(treat == TRUE, 'Treatment', 'Control'), Married = ifelse(married == TRUE, 'Yes', 'No')) %>% select(`Earnings Before`, `Earnings After`, Treatment, Ethnicity = ethn, Age = age, Education = educ, Married) caption <- 'Descriptive statistics about participants in a job training experiment. The earnings are displayed in 1000s of USD. This table was created using the \"datasummary\" function from the \"modelsummary\" package for R.' reference <- 'Source: Lalonde (1986) American Economic Review.' library(modelsummary) datasummary_balance(~Treatment, data = training, title = caption, notes = reference) datasummary_balance(~ 1, data = training)"},{"path":"https://vincentarelbundock.github.io/modelsummary/dev/articles/datasummary.html","id":"datasummary_correlation","dir":"Articles","previous_headings":"","what":"datasummary_correlation","title":"`datasummary`: Crosstabs, frequencies, correlations, balance (a.k.a. ","text":"datasummary_correlation accepts dataframe tibble, identifies numeric variables, calculates correlation variables: values displayed table equivalent obtained calling: cor(x, use='pairwise.complete.obs').","code":"datasummary_correlation(mtcars)"},{"path":"https://vincentarelbundock.github.io/modelsummary/dev/articles/datasummary.html","id":"datasummary_crosstab","dir":"Articles","previous_headings":"","what":"datasummary_crosstab","title":"`datasummary`: Crosstabs, frequencies, correlations, balance (a.k.a. ","text":"cross tabulation often useful explore association two categorical variables. can create multi-level crosstabs specifying interactions using * operator: default, cell counts row percentages shown cell, row column totals calculated. show cell percentages column percentages, drop row column totals, adjust statistic argument. argument accepts formula follows datasummary “language”. understand exactly works, may find useful skip datasummary tutorial next section. Example: See ?datasummary_crosstab details.","code":"library(modelsummary) url <- 'https://vincentarelbundock.github.io/Rdatasets/csv/palmerpenguins/penguins.csv' penguins <- read.csv(url) datasummary_crosstab(species ~ sex, data = penguins) datasummary_crosstab(species ~ sex * island, data = penguins) datasummary_crosstab(species ~ sex, statistic = 1 ~ Percent(\"col\"), data = penguins)"},{"path":"https://vincentarelbundock.github.io/modelsummary/dev/articles/datasummary.html","id":"datasummary","dir":"Articles","previous_headings":"","what":"datasummary","title":"`datasummary`: Crosstabs, frequencies, correlations, balance (a.k.a. ","text":"datasummary tables specified using 2-sided formula, divided tilde ~. left-hand side describes rows; right-hand side describes columns. illustrate works, using palmerpenguins dataset: display flipper_length_mm variable row mean column, type: flip rows columns, flip left right-hand sides formula:","code":"datasummary(flipper_length_mm ~ Mean, data = penguins) datasummary(Mean ~ flipper_length_mm, data = penguins)"},{"path":"https://vincentarelbundock.github.io/modelsummary/dev/articles/datasummary.html","id":"custom-summary-functions","dir":"Articles","previous_headings":"datasummary","what":"Custom summary functions","title":"`datasummary`: Crosstabs, frequencies, correlations, balance (a.k.a. ","text":"Mean function shortcut supplied modelsummary, equivalent mean(x,na.rm=TRUE). Since flipper_length_mm variable includes missing observation, using mean formula (default na.rm=FALSE) produce missing/empty cell: modelsummary supplies functions: Mean, SD, Min, Max, Median, P0, P25, P50, P75, P100, Histogram, (see package documentation). Users also free create use custom summaries. R function takes vector produces single value acceptable. example, Range functions return numerical value, MinMax returns string:","code":"datasummary(flipper_length_mm ~ mean, data = penguins) Range <- function(x) max(x, na.rm = TRUE) - min(x, na.rm = TRUE) datasummary(flipper_length_mm ~ Range, data = penguins) MinMax <- function(x) paste0('[', min(x, na.rm = TRUE), ', ', max(x, na.rm = TRUE), ']') datasummary(flipper_length_mm ~ MinMax, data = penguins)"},{"path":"https://vincentarelbundock.github.io/modelsummary/dev/articles/datasummary.html","id":"concatenating-with","dir":"Articles","previous_headings":"datasummary","what":"Concatenating with +","title":"`datasummary`: Crosstabs, frequencies, correlations, balance (a.k.a. ","text":"include rows columns, use + sign: Sometimes, can cumbersome list variables separated + signs. () function useful shortcut: default, selects numeric variables. behavior can changed modifying function’s arguments. See ?details.","code":"datasummary(flipper_length_mm + body_mass_g ~ Mean + SD, data = penguins) datasummary(All(penguins) ~ Mean + SD, data = penguins)"},{"path":"https://vincentarelbundock.github.io/modelsummary/dev/articles/datasummary.html","id":"nesting-with","dir":"Articles","previous_headings":"datasummary","what":"Nesting with *","title":"`datasummary`: Crosstabs, frequencies, correlations, balance (a.k.a. ","text":"datasummary can nest variables statistics inside categorical variables using * symbol. applying * operator factor, character, logical variables, columns rows automatically nested. instance, want display separate means value variable sex, use mean * sex: can use parentheses nest several terms inside one another, using call form: x * (y + z). example nested columns: example nested rows: order terms enter formula determines order labels displayed. example, shows island sex: shows sex island values: default, datasummary omits column headers single value/label across columns, except header sits just data. header want see displayed, may want reorder terms formula. show headers, set sparse_header=FALSE: using sparse_header=FALSE, often useful insert Heading() * table formula, order rename omit labels manually. Type ?tables::Heading details examples.","code":"datasummary(flipper_length_mm + body_mass_g ~ mean * sex, data = penguins) datasummary(body_mass_g ~ sex * (mean + sd), data = penguins) datasummary(sex * (body_mass_g + flipper_length_mm) ~ mean + sd, data = penguins) datasummary(flipper_length_mm + body_mass_g ~ mean * island * sex, data = penguins) datasummary(flipper_length_mm + body_mass_g ~ mean * sex * island, data = penguins) datasummary(flipper_length_mm + body_mass_g ~ mean * sex * island, data = penguins, sparse_header = FALSE)"},{"path":"https://vincentarelbundock.github.io/modelsummary/dev/articles/datasummary.html","id":"renaming-with","dir":"Articles","previous_headings":"datasummary","what":"Renaming with =","title":"`datasummary`: Crosstabs, frequencies, correlations, balance (a.k.a. ","text":"Personally, prefer rename variables values drawing tables, using backticks variable names include whitespace. example, However, thanks tables package, datasummary offers two additional mechanisms rename. First, can wrap term parentheses use equal = sign: (NewName=OldName): Second, can use Heading() function: Heading function also nearData argument can useful cases rows nested others . Compare last row two tables:","code":"tmp <- penguins %>% select(`Flipper length (mm)` = flipper_length_mm, `Body mass (g)` = body_mass_g) datasummary(`Flipper length (mm)` + `Body mass (g)` ~ Mean + SD, data = tmp) datasummary((`Flipper length (mm)` = flipper_length_mm) + (`Body mass (g)` = body_mass_g) ~ island * ((Avg. = Mean) + (Std.Dev. = SD)), data = penguins) datasummary(Heading(\"Flipper length (mm)\") * flipper_length_mm + Heading(\"Body mass (g)\") * body_mass_g ~ island * (Mean + SD), data = penguins) datasummary(sex * (flipper_length_mm + bill_length_mm) + Heading(\"Body mass (g)\") * body_mass_g ~ Mean + SD, data = penguins) datasummary(sex * (flipper_length_mm + bill_length_mm) + Heading(\"Body mass (g)\", nearData=FALSE) * body_mass_g ~ Mean + SD, data = penguins)"},{"path":"https://vincentarelbundock.github.io/modelsummary/dev/articles/datasummary.html","id":"counts-and-percentages","dir":"Articles","previous_headings":"datasummary","what":"Counts and Percentages","title":"`datasummary`: Crosstabs, frequencies, correlations, balance (a.k.a. ","text":"tables package allows datasummary use neat tricks produce frequency tables: Add N right-hand side equation. Add Percent() right-hand side calculate percentage observations cell. Add 1 left-hand side include row total number observations: Note Percent() function accepts denom argument determine percentages calculated row column-wise, take account cells.","code":"datasummary(species * sex + 1 ~ N + Percent(), data = penguins)"},{"path":"https://vincentarelbundock.github.io/modelsummary/dev/articles/datasummary.html","id":"weighted-percentages","dir":"Articles","previous_headings":"datasummary","what":"Weighted percentages","title":"`datasummary`: Crosstabs, frequencies, correlations, balance (a.k.a. ","text":"Percent() pseudo-function also accepts fn argument, must function accepts two vectors: x values current cell, y values whole dataset. default fn : code takes number elements cell length(x) divides number total elements length(y). Now, let’s say want display percentages weighted one variables dataset. can often useful survey weights, example. , use arbitrary column weights called flipper_length_mm: cell now sum weights cell, divided total sum weights column.","code":"datasummary(species * sex + 1 ~ N + Percent(fn = function(x, y) 100 * length(x) / length(y)), output = \"markdown\", data = penguins) wtpct <- function(x, y) sum(x, na.rm = TRUE) / sum(y, na.rm = TRUE) * 100 datasummary(species * sex + 1 ~ N + flipper_length_mm * Percent(fn = wtpct), output = \"markdown\", data = penguins)"},{"path":"https://vincentarelbundock.github.io/modelsummary/dev/articles/datasummary.html","id":"custom-percentages","dir":"Articles","previous_headings":"datasummary","what":"Custom percentages","title":"`datasummary`: Crosstabs, frequencies, correlations, balance (a.k.a. ","text":"another simple illustration Percent function mechanism action, combine counts percentages simple nice label:","code":"dat <- mtcars dat$cyl <- as.factor(dat$cyl) fn <- function(x, y) { out <- sprintf( \"%s (%.1f%%)\", length(x), length(x) / length(y) * 100) } datasummary( cyl ~ Percent(fn = fn), data = dat)"},{"path":"https://vincentarelbundock.github.io/modelsummary/dev/articles/datasummary.html","id":"factor","dir":"Articles","previous_headings":"datasummary","what":"Factor","title":"`datasummary`: Crosstabs, frequencies, correlations, balance (a.k.a. ","text":"* nesting operator used works automatically factor, character, logical variables. Sometimes, convenient use types variables, binary numeric variables. case, can wrap variable name inside call Factor(). allows us treat variable factor, without modify original data. example, mtcars data, binary numeric variable call . nest statistics within categories typing:","code":"datasummary(mpg + hp ~ Factor(am) * (mean + sd), data = mtcars)"},{"path":"https://vincentarelbundock.github.io/modelsummary/dev/articles/datasummary.html","id":"arguments-na-rmtrue","dir":"Articles","previous_headings":"datasummary","what":"Arguments: na.rm=TRUE","title":"`datasummary`: Crosstabs, frequencies, correlations, balance (a.k.a. ","text":"can pass argument summary function including call Arguments(). instance, missing values flipper_length_mm variable penguins dataset. Therefore, standard mean function produce result, default argument na.rm=FALSE. can change calling: Notice empty cell (NA) normal mean function, mean call Arguments(na.rm=TRUE) produced numeric result. can pass arguments multiple functions using parentheses: Note shortcut functions modelsummary supplies use na.rm=TRUE default, can use directly without arguments, even missing values:","code":"datasummary(flipper_length_mm ~ mean + mean*Arguments(na.rm=TRUE), data = penguins) datasummary(flipper_length_mm ~ (mean + sd) * Arguments(na.rm=TRUE), data = penguins) datasummary(flipper_length_mm ~ Mean + Var + P75 + Range, data = penguins)"},{"path":"https://vincentarelbundock.github.io/modelsummary/dev/articles/datasummary.html","id":"arguments-weighted-mean","dir":"Articles","previous_headings":"datasummary","what":"Arguments: Weighted Mean","title":"`datasummary`: Crosstabs, frequencies, correlations, balance (a.k.a. ","text":"can use Arguments mechanism various things, calculating weighted means: produces results : different results :","code":"newdata <- data.frame( x = rnorm(20), w = rnorm(20), y = rnorm(20)) datasummary(x + y ~ weighted.mean * Arguments(w = w), data = newdata, output = \"markdown\") weighted.mean(newdata$x, newdata$w) ## [1] -4.055779 weighted.mean(newdata$y, newdata$w) ## [1] -3.436137 mean(newdata$x) ## [1] 0.0008349621 mean(newdata$y) ## [1] 0.1249095"},{"path":"https://vincentarelbundock.github.io/modelsummary/dev/articles/datasummary.html","id":"empty-cells","dir":"Articles","previous_headings":"datasummary","what":"Empty cells","title":"`datasummary`: Crosstabs, frequencies, correlations, balance (a.k.a. ","text":"Sometimes, nest much dataset large/diverse enough, end empty cells. case, add *DropEmpty() formula:","code":"datasummary(island * species * body_mass_g ~ sex * (Mean + SD), data = penguins) datasummary(island * species * body_mass_g ~ sex * (Mean + SD) * DropEmpty(), data = penguins)"},{"path":"https://vincentarelbundock.github.io/modelsummary/dev/articles/datasummary.html","id":"logical-subsets","dir":"Articles","previous_headings":"datasummary","what":"Logical subsets","title":"`datasummary`: Crosstabs, frequencies, correlations, balance (a.k.a. ","text":"Cool stuff possible logical subsets: See tables package documentation details examples.","code":"datasummary((bill_length_mm > 44.5) + (bill_length_mm <= 44.5) ~ Mean * flipper_length_mm, data = penguins)"},{"path":"https://vincentarelbundock.github.io/modelsummary/dev/articles/datasummary.html","id":"output","dir":"Articles","previous_headings":"","what":"output","title":"`datasummary`: Crosstabs, frequencies, correlations, balance (a.k.a. ","text":"functions datasummary_* family accept output argument. Tables can saved several file formats: can returned human-readable data.frames, markdown, html, LaTeX code console: datasummary can return objects compatible gt, kableExtra, flextable, huxtable, DT table creation customization packages: Please note hierarchical “nested” column labels available output formats: kableExtra, gt, html, rtf, LaTeX. saving tables formats, nested labels combined “flat” header.","code":"f <- flipper_length_mm ~ island * (mean + sd) datasummary(f, data = penguins, output = 'table.html') datasummary(f, data = penguins, output = 'table.tex') datasummary(f, data = penguins, output = 'table.docx') datasummary(f, data = penguins, output = 'table.pptx') datasummary(f, data = penguins, output = 'table.md') datasummary(f, data = penguins, output = 'table.rtf') datasummary(f, data = penguins, output = 'table.jpg') datasummary(f, data = penguins, output = 'table.png') datasummary(f, data = penguins, output = 'data.frame') datasummary(f, data = penguins, output = 'markdown') datasummary(f, data = penguins, output = 'html') datasummary(f, data = penguins, output = 'latex') datasummary(f, data = penguins, output = 'gt') datasummary(f, data = penguins, output = 'kableExtra') datasummary(f, data = penguins, output = 'flextable') datasummary(f, data = penguins, output = 'huxtable') datasummary(f, data = penguins, output = 'DT')"},{"path":"https://vincentarelbundock.github.io/modelsummary/dev/articles/datasummary.html","id":"fmt","dir":"Articles","previous_headings":"","what":"fmt","title":"`datasummary`: Crosstabs, frequencies, correlations, balance (a.k.a. ","text":"fmt argument allows us set printing format numeric values. accepts single number representing number digits period, string passed sprintf function. instance, setting fmt=\"%.4f\" keep 4 digits dot (see ?sprintf options): can set formatting term--term basis using Arguments function used handle missing values previous section. shortcut functions ship modelsummary (e.g., Mean, SD, Median, P25) include fmt argument: want datasummary format numbers, want keep numerical values instead formatted strings, set fmt=NULL. can useful post-processing tables packages like gt, allow us transform cells based numerical content (gt table omitted PDF output): Please note N() function supplied upstream tables package, fmt argument. Fortunately, easy override built-function use custom formatting:","code":"datasummary(flipper_length_mm ~ Mean + SD, fmt = 4, data = penguins) datasummary(flipper_length_mm ~ Mean * Arguments(fmt = \"%.4f\") + SD * Arguments(fmt = \"%.1f\"), data = penguins) library(gt) datasummary(All(mtcars) ~ Mean + SD, data = mtcars, fmt = NULL, output = 'gt') %>% tab_style(style = cell_fill(color = \"pink\"), locations = cells_body(rows = Mean > 10, columns = 2)) tmp <- data.frame(X = sample(letters[1:3], 1e6, replace = TRUE)) N <- \\(x) format(length(x), big.mark = \",\") datasummary(X ~ N, data = tmp)"},{"path":"https://vincentarelbundock.github.io/modelsummary/dev/articles/datasummary.html","id":"title-notes","dir":"Articles","previous_headings":"","what":"title, notes","title":"`datasummary`: Crosstabs, frequencies, correlations, balance (a.k.a. ","text":"datasummary includes title notes arguments modelsummary: Statistics famous Palmer Penguins.","code":"datasummary(All(penguins) ~ Mean + SD, data = penguins, title = 'Statistics about the famous Palmer Penguins.', notes = c('A note at the bottom of the table.'))"},{"path":"https://vincentarelbundock.github.io/modelsummary/dev/articles/datasummary.html","id":"align","dir":"Articles","previous_headings":"","what":"align","title":"`datasummary`: Crosstabs, frequencies, correlations, balance (a.k.a. ","text":"can align columns using align argument. align string length equal number columns, includes letters “l”, “c”, “r”:","code":"datasummary(flipper_length_mm + bill_length_mm ~ Mean + SD + Range, data = penguins, align = 'lrcl')"},{"path":"https://vincentarelbundock.github.io/modelsummary/dev/articles/datasummary.html","id":"add_rows","dir":"Articles","previous_headings":"","what":"add_rows","title":"`datasummary`: Crosstabs, frequencies, correlations, balance (a.k.a. ","text":"","code":"new_rows <- data.frame('Does', 2, 'plus', 2, 'equals', 5, '?') datasummary(flipper_length_mm + body_mass_g ~ species * (Mean + SD), data = penguins, add_rows = new_rows)"},{"path":"https://vincentarelbundock.github.io/modelsummary/dev/articles/datasummary.html","id":"add_columns","dir":"Articles","previous_headings":"","what":"add_columns","title":"`datasummary`: Crosstabs, frequencies, correlations, balance (a.k.a. ","text":"","code":"new_cols <- data.frame('New Stat' = runif(2)) datasummary(flipper_length_mm + body_mass_g ~ species * (Mean + SD), data = penguins, add_columns = new_cols)"},{"path":"https://vincentarelbundock.github.io/modelsummary/dev/articles/datasummary.html","id":"histograms","dir":"Articles","previous_headings":"","what":"Histograms","title":"`datasummary`: Crosstabs, frequencies, correlations, balance (a.k.a. ","text":"datasummary family functions allow users display -line spark-style histograms describe distribution variables. example, datasummary_skim produces histogram: histograms table actually SVG image, produced kableExtra package. reason, histogram appear users use different output backend, gt, flextable, huxtable. datasummary function incredibly flexible, include histogram option default. simple example one can customize output datasummary. proceed 4 steps: Normalize variables store list Create table datasummary, making sure include 2 “empty” columns. example, use simple function called emptycol fill columns empty strings. Add histograms boxplots using functions kableExtra package. want simpler solution, can try Histogram function works datasummary automatically comes bundled modelsummary. downside function uses Unicode characters create histogram. kind histogram may display well certain typefaces operating systems (Windows!).","code":"tmp <- mtcars[, c(\"mpg\", \"hp\")] datasummary_skim(tmp) ## Warning: The histogram argument is only supported for (a) output types \"default\", \"html\", or \"kableExtra\"; (b) ## writing to file paths with extensions \".html\", \".jpg\", or \".png\"; and (c) Rmarkdown or knitr documents ## compiled to PDF or HTML. Use `histogram=FALSE` to silence this warning. tmp <- mtcars[, c(\"mpg\", \"hp\")] # create a list with individual variables # remove missing and rescale tmp_list <- lapply(tmp, na.omit) tmp_list <- lapply(tmp_list, scale) # create a table with `datasummary` # add a histogram with column_spec and spec_hist # add a boxplot with colun_spec and spec_box emptycol = function(x) \" \" datasummary(mpg + hp ~ Mean + SD + Heading(\"Boxplot\") * emptycol + Heading(\"Histogram\") * emptycol, output = \"kableExtra\", data = tmp) %>% kableExtra::column_spec(column = 4, image = spec_boxplot(tmp_list)) %>% kableExtra::column_spec(column = 5, image = spec_hist(tmp_list)) datasummary(mpg + hp ~ Mean + SD + Histogram, data = tmp)"},{"path":"https://vincentarelbundock.github.io/modelsummary/dev/articles/datasummary.html","id":"missing-values","dir":"Articles","previous_headings":"","what":"Missing values","title":"`datasummary`: Crosstabs, frequencies, correlations, balance (a.k.a. ","text":"least 3 distinct issues can arise related missing values.","code":""},{"path":"https://vincentarelbundock.github.io/modelsummary/dev/articles/datasummary.html","id":"functions-and-na-rm","dir":"Articles","previous_headings":"Missing values","what":"Functions and na.rm","title":"`datasummary`: Crosstabs, frequencies, correlations, balance (a.k.a. ","text":"empty cell can appear table statistical function returns NA instead numeric value. cases, : Make sure statistical function (e.g., mean sd) uses na.rm=TRUE default Use Arguments strategy set na.rm=TRUE (see Arguments section vignette). Use convenience function supplied modelsummary, na.rm TRUE default: Mean, SD, P25, etc.","code":""},{"path":"https://vincentarelbundock.github.io/modelsummary/dev/articles/datasummary.html","id":"empty-crosstab-cells","dir":"Articles","previous_headings":"Missing values","what":"Empty crosstab cells","title":"`datasummary`: Crosstabs, frequencies, correlations, balance (a.k.a. ","text":"empty cell can appear table crosstab deeply nested, observations given combination covariates. cases, can use * DropEmpty pseudo-function. See “Empty cells” section vignette examples.","code":""},{"path":"https://vincentarelbundock.github.io/modelsummary/dev/articles/datasummary.html","id":"factors","dir":"Articles","previous_headings":"Missing values","what":"Factors","title":"`datasummary`: Crosstabs, frequencies, correlations, balance (a.k.a. ","text":"default, factor function R assign distinct factor level missing values: factor function’s exclude argument set NA default. ensure NAs appear table, make sure set exclude=NULL create factor. Internally, datasummary_balance datasummary_crosstab functions convert logical character variables factor exclude=NULL argument. means NAs appear table distinct rows/columns. want NAs appear table, convert factors ahead time. example:","code":"mycars <- mtcars[, c(\"cyl\", \"mpg\", \"hp\", \"vs\")] mycars$cyl[c(1, 3, 6, 8)] <- NA mycars$cyl_nona <- factor(mycars$cyl) mycars$cyl_na <- factor(mycars$cyl, exclude = NULL) datasummary_crosstab(cyl_nona ~ vs, data = mycars) datasummary_crosstab(cyl_na ~ vs, data = mycars)"},{"path":"https://vincentarelbundock.github.io/modelsummary/dev/articles/datasummary.html","id":"appearance","dir":"Articles","previous_headings":"","what":"Appearance","title":"`datasummary`: Crosstabs, frequencies, correlations, balance (a.k.a. ","text":"Appearance Vignette saw customize tables produced modelsummary function. customization possibilities also available functions datasummary_* family functions. Indeed, can customize tables produced datasummary using functions provided gt, kableExtra, flextable, huxtable, DT. instance, customize tables using kableExtra, can : customize table using gt package, can: Flipper lengths (mm) famous penguins Palmer Station, Antarctica.","code":"# Convert to `data.frame` to circumvent a `tibbles`-related bug in `All()` # https://github.com/vincentarelbundock/modelsummary/issues/395 penguins <- data.frame(penguins) datasummary(All(penguins) ~ sex * (Mean + SD), data = penguins, output = 'kableExtra') %>% kableExtra::row_spec(3, background = 'cyan', color = 'red') library(gt) adelie <- function(x) web_image('https://user-images.githubusercontent.com/987057/85402702-20b1d280-b52a-11ea-9950-f3a03133fd45.png', height = 100) gentoo <- function(x) web_image('https://user-images.githubusercontent.com/987057/85402718-27404a00-b52a-11ea-9ad3-dd7562f6438d.png', height = 100) chinstrap <- function(x) web_image('https://user-images.githubusercontent.com/987057/85402708-23acc300-b52a-11ea-9a77-de360a0d1f7d.png', height = 100) cap <- 'Flipper lengths (mm) of the famous penguins of Palmer Station, Antarctica.' f <- (`Species` = species) ~ (` ` = flipper_length_mm) * (`Distribution` = Histogram) + flipper_length_mm * sex * ((`Avg.` = Mean)*Arguments(fmt='%.0f') + (`Std. Dev.` = SD)*Arguments(fmt='%.1f')) datasummary(f, data = penguins, output = 'gt', title = cap, notes = 'Artwork by @allison_horst', sparse_header = TRUE) %>% text_transform(locations = cells_body(columns = 1, rows = 1), fn = adelie) %>% text_transform(locations = cells_body(columns = 1, rows = 2), fn = chinstrap) %>% text_transform(locations = cells_body(columns = 1, rows = 3), fn = gentoo) %>% tab_style(style = list(cell_text(color = \"#FF6700\", size = 'x-large')), locations = cells_body(rows = 1)) %>% tab_style(style = list(cell_text(color = \"#CD51D1\", size = 'x-large')), locations = cells_body(rows = 2)) %>% tab_style(style = list(cell_text(color = \"#007377\", size = 'x-large')), locations = cells_body(rows = 3)) %>% tab_options(table_body.hlines.width = 0, table.border.top.width = 0, table.border.bottom.width = 0) %>% cols_align('center', columns = 3:6)"},{"path":"https://vincentarelbundock.github.io/modelsummary/dev/articles/modelplot.html","id":"rename-reorder-subset","dir":"Articles","previous_headings":"","what":"Rename, reorder, subset","title":"`modelplot`: Plot model coefficients with confidence intervals","text":"modelplot uses mechanics modelsummary rename, reorder, subset estimates. First, can use coef_omit argument. omit coefficient matches string regular expression. omit intercept, example, can type: Second, can use coef_map argument. coef_map named character vector, names correspond original term names, values correspond names want assign. variable included coef_map excluded. Variables also drawn order coef_map:","code":"modelplot(mod, coef_omit = 'Interc') cm <- c('speciesChinstrap' = 'Chinstrap', 'speciesGentoo' = 'Gentoo', 'flipper_length_cm' = 'Flipper length (cm)') modelplot(mod, coef_map = cm)"},{"path":"https://vincentarelbundock.github.io/modelsummary/dev/articles/modelplot.html","id":"several-models","dir":"Articles","previous_headings":"","what":"Several models","title":"`modelplot`: Plot model coefficients with confidence intervals","text":"main modelsummary functions allows create table results several models side--side, storing (potentially named) list: modelplot works way: Instead displaying results “dodged” side--side lines, can also use facet:","code":"models <- list( \"Small model\" = lm(bill_length_cm ~ flipper_length_cm, data = dat), \"Medium model\" = lm(bill_length_cm ~ flipper_length_cm + body_mass_g, data = dat), \"Large model\" = lm(bill_length_cm ~ flipper_length_cm + body_mass_g + species, data = dat)) modelsummary(models, statistic = 'conf.int') modelplot(models, coef_omit = 'Interc') modelplot(models, facet = TRUE)"},{"path":"https://vincentarelbundock.github.io/modelsummary/dev/articles/modelplot.html","id":"customizing-plots","dir":"Articles","previous_headings":"","what":"Customizing plots","title":"`modelplot`: Plot model coefficients with confidence intervals","text":"graphs produced modelplot simple ggplot2 objects. can thus post-process using normal suite functions available objects type. , change axis labels, add title caption, use color scheme inspired Wes Anderson’s Darjeeling Limited: ggplot2, visual choices must made calling “geom”, rather post-processing functions. instance, size, color, fatten, linetype arguments must specified inside geom_pointrange function take effect. modelplot pass unknown argument geom_pointrange, users can simply call:","code":"library(wesanderson) library(ggplot2) modelplot(models) + labs(x = 'Coefficients', y = 'Term names', title = 'Linear regression models of \"Bill Length (cm)\"', caption = \"Data source: Gorman, Williams & Fraser (2014), packaged for R by @apreshill and @allison_horst\") + scale_color_manual(values = wes_palette('Darjeeling1')) modelplot(mod, size = 1, fatten = .7, color = 'darkgreen', linetype = 'dotted') + theme_classic()"},{"path":"https://vincentarelbundock.github.io/modelsummary/dev/articles/modelplot.html","id":"conditional-colors-and-shape","dir":"Articles","previous_headings":"Customizing plots","what":"Conditional colors and shape","title":"`modelplot`: Plot model coefficients with confidence intervals","text":"Note: section requires version modelsummary greater 1.2.0 development version. nice Stack Overflow answer, Allan Cameron shows can use aes() function ggplot2 add conditional aesthetics. example, want display statistically significant coefficients different color:","code":"library(ggplot2) mod <- lm(hp ~ factor(gear) + factor(cyl), data = mtcars) modelplot(mod, coef_rename = TRUE) + aes(color = ifelse(p.value < 0.001, \"Significant\", \"Not significant\")) + scale_color_manual(values = c(\"grey\", \"black\"))"},{"path":"https://vincentarelbundock.github.io/modelsummary/dev/articles/modelplot.html","id":"example-using-facets-to-compare-models","dir":"Articles","previous_headings":"Customizing plots","what":"Example: Using facets to compare models","title":"`modelplot`: Plot model coefficients with confidence intervals","text":"Customizing plots ggplot2 makes modelplot flexible. example, imagine want compare coefficients three models different dependent variables. First, load packages estimate models: , use dvnames function rename list names matching dependent variable model: calling modelplot draw=FALSE argument, see raw data used draw plot. , see model column: Finally, use model column identifier ggplot2’s facet_grid command display models side side:","code":"library(ggplot2) library(modelsummary) models <- list( lm(vs ~ carb + mpg + cyl, data = mtcars), lm(disp ~ carb + mpg + cyl, data = mtcars), lm(hp ~ carb + mpg + cyl, data = mtcars)) models <- dvnames(models) modelplot(models, draw = FALSE) ## term model estimate std.error conf.low conf.high ## 1 (Intercept) vs 2.41742511 0.67622094 1.03224931 3.80260091 ## 5 (Intercept) disp 112.57276339 114.86315481 -122.71374324 347.85927003 ## 9 (Intercept) hp -10.56116383 68.75946117 -151.40853516 130.28620751 ## 2 carb vs -0.06945116 0.03943402 -0.15022810 0.01132577 ## 6 carb disp -12.30144724 6.69827859 -26.02224894 1.41935446 ## 10 carb hp 17.75593287 4.00972816 9.54237706 25.96948867 ## 3 mpg vs -0.01513960 0.01716410 -0.05029868 0.02001947 ## 7 mpg disp -7.14964651 2.91550156 -13.12178072 -1.17751230 ## 11 mpg hp -1.00486469 1.74527956 -4.57990780 2.57017842 ## 4 cyl vs -0.23926135 0.05687969 -0.35577411 -0.12274859 ## 8 cyl disp 47.90105842 9.66160634 28.11015499 67.69196184 ## 12 cyl hp 20.60581208 5.78363747 8.75856779 32.45305638 ## p.value ## 1 1.296718e-03 ## 5 3.354494e-01 ## 9 8.790301e-01 ## 2 8.912324e-02 ## 6 7.692105e-02 ## 10 1.320972e-04 ## 3 3.852593e-01 ## 7 2.068858e-02 ## 11 5.693755e-01 ## 4 2.410214e-04 ## 8 3.111898e-05 ## 12 1.338485e-03 modelplot(models, color = \"black\") + facet_grid(~model)"},{"path":"https://vincentarelbundock.github.io/modelsummary/dev/articles/modelplot.html","id":"confidence-intervals-change-or-omit","dir":"Articles","previous_headings":"","what":"Confidence intervals: change or omit","title":"`modelplot`: Plot model coefficients with confidence intervals","text":"can change \\(\\alpha\\) level confidence intervals changing conf_level argument:","code":"modelplot(mod, conf_level = .99) modelplot(mod, conf_level = NULL)"},{"path":"https://vincentarelbundock.github.io/modelsummary/dev/articles/modelplot.html","id":"background-annotations","dir":"Articles","previous_headings":"","what":"Background annotations","title":"`modelplot`: Plot model coefficients with confidence intervals","text":"Sometimes, want display annotations plot, like draw annotations behind geom_pointrange displays estimates. Since modelplot draws geom_pointrange automatically, ggplot2 annotation add plot using + added top existing ones. add annotations background, can pass list ggplot2 “geoms”:","code":"library(ggplot2) b <- list(geom_vline(xintercept = 0, color = 'orange'), annotate(\"rect\", alpha = .1, xmin = -.5, xmax = .5, ymin = -Inf, ymax = Inf), geom_point(aes(y = term, x = estimate), alpha = .3, size = 10, color = 'red')) modelplot(mod, background = b)"},{"path":"https://vincentarelbundock.github.io/modelsummary/dev/articles/modelplot.html","id":"raw-data-more-customization","dir":"Articles","previous_headings":"","what":"Raw data & More customization","title":"`modelplot`: Plot model coefficients with confidence intervals","text":"like customize plots even modelplot allows, can obtain raw data used draw plots setting draw=FALSE: allows users use external tools powerful ggdist package. example, use purrr::map_dfr function call modelplot several times different confidence levels. , draw plot different confidence intervals drawn different thicknesses:","code":"modelplot(models, draw = FALSE) ## term model estimate std.error conf.low conf.high ## 1 (Intercept) vs 2.41742511 0.67622094 1.03224931 3.80260091 ## 5 (Intercept) disp 112.57276339 114.86315481 -122.71374324 347.85927003 ## 9 (Intercept) hp -10.56116383 68.75946117 -151.40853516 130.28620751 ## 2 carb vs -0.06945116 0.03943402 -0.15022810 0.01132577 ## 6 carb disp -12.30144724 6.69827859 -26.02224894 1.41935446 ## 10 carb hp 17.75593287 4.00972816 9.54237706 25.96948867 ## 3 mpg vs -0.01513960 0.01716410 -0.05029868 0.02001947 ## 7 mpg disp -7.14964651 2.91550156 -13.12178072 -1.17751230 ## 11 mpg hp -1.00486469 1.74527956 -4.57990780 2.57017842 ## 4 cyl vs -0.23926135 0.05687969 -0.35577411 -0.12274859 ## 8 cyl disp 47.90105842 9.66160634 28.11015499 67.69196184 ## 12 cyl hp 20.60581208 5.78363747 8.75856779 32.45305638 ## p.value ## 1 1.296718e-03 ## 5 3.354494e-01 ## 9 8.790301e-01 ## 2 8.912324e-02 ## 6 7.692105e-02 ## 10 1.320972e-04 ## 3 3.852593e-01 ## 7 2.068858e-02 ## 11 5.693755e-01 ## 4 2.410214e-04 ## 8 3.111898e-05 ## 12 1.338485e-03 library(tidyverse) library(modelsummary) library(ggdist) # fit models <- list( lm(mpg ~ am, mtcars), lm(mpg ~ am + cyl, mtcars)) # summarize dat <- map_dfr(c(.8, .9, .99), function(x) { modelplot(models, conf_level = x, draw = FALSE) %>% mutate(.width = x) }) # plot ggplot(dat, aes( y = term, x = estimate, xmin = conf.low, xmax = conf.high, color = model)) + ggdist::geom_pointinterval( position = \"dodge\", interval_size_range = c(1, 3), fatten_point = .1)"},{"path":"https://vincentarelbundock.github.io/modelsummary/dev/articles/modelsummary.html","id":"output-print-and-save","dir":"Articles","previous_headings":"","what":"output: print and save","title":"modelsummary: regression tables","text":"output argument determines type object returned modelsummary /file table written. want save table directly file, can type: want raw HTML, LaTeX, Markdown table, can type: customize appearance table using external tools like gt, kableExtra, flextable, huxtable, can type: Warning: file name supplied output argument, table written immediately file. want customize table post-processing external package, need choose different output format saving mechanism. Unfortunately, approach differs package package: gt: set output=\"gt\", post-process table, use gt::gtsave function. kableExtra: set output destination format (e.g., “latex”, “html”, “markdown”), post-process table, use kableExtra::save_kable function.","code":"modelsummary(models, output = \"table.docx\") modelsummary(models, output = \"table.html\") modelsummary(models, output = \"table.tex\") modelsummary(models, output = \"table.md\") modelsummary(models, output = \"table.txt\") modelsummary(models, output = \"table.png\") modelsummary(models, output = \"html\") modelsummary(models, output = \"latex\") modelsummary(models, output = \"markdown\") modelsummary(models, output = \"gt\") modelsummary(models, output = \"kableExtra\") modelsummary(models, output = \"flextable\") modelsummary(models, output = \"huxtable\")"},{"path":"https://vincentarelbundock.github.io/modelsummary/dev/articles/modelsummary.html","id":"fmt-round-and-format","dir":"Articles","previous_headings":"","what":"fmt: round and format","title":"modelsummary: regression tables","text":"fmt argument defines numeric values rounded presented table. argument accepts three types input: Integer: Number decimal digits User-supplied function: Accepts numeric vector returns character vector length. modelsummary function: fmt_decimal(), fmt_significant(), fmt_sprintf(), fmt_term(), fmt_statistic, fmt_identity() Examples: Custom formatting function big mark commas: many languages comma used decimal mark instead period. modelsummary respects global R OutDec option, can simply execute command tables adjusted automatically:","code":"mod <- lm(mpg ~ hp + drat + qsec, data = mtcars) # decimal digits modelsummary(mod, fmt = 3) # user-supplied function modelsummary(mod, fmt = function(x) round(x, 2)) # p values with different number of digits modelsummary(mod, fmt = fmt_decimal(1, 3), statistic = c(\"std.error\", \"p.value\")) # significant digits modelsummary(mod, fmt = fmt_significant(3)) # sprintf(): decimal digits modelsummary(mod, fmt = fmt_sprintf(\"%.5f\")) # sprintf(): scientific notation modelsummary(mod, fmt = fmt_sprintf(\"%.5e\")) # statistic-specific formatting modelsummary(mod, fmt = fmt_statistic(estimate = 4, conf.int = 1), statistic = \"conf.int\") # term-specific formatting modelsummary(mod, fmt = fmt_term(hp = 4, drat = 1, default = fmt_significant(2))) modelsummary(mod, fmt = NULL) modf <- lm(I(mpg * 100) ~ hp, mtcars) f <- function(x) formatC(x, digits = 2, big.mark = \",\", format = \"f\") modelsummary(modf, fmt = f, gof_map = NA) options(OutDec=\",\")"},{"path":"https://vincentarelbundock.github.io/modelsummary/dev/articles/modelsummary.html","id":"estimate","dir":"Articles","previous_headings":"","what":"estimate","title":"modelsummary: regression tables","text":"default, modelsummary prints coefficient estimate row. can customize changing estimate argument. example, produce table p values instead coefficient estimates: can also use glue string, using curly braces specify statistics want. example, displays estimate next confidence interval: Glue strings can also apply R functions estimates. However, since modelsummary rounds numbers transforms character default, must set fmt = NULL: can also use different estimates different models using vector strings:","code":"modelsummary(models, estimate = \"p.value\") modelsummary( models, fmt = 1, estimate = \"{estimate} [{conf.low}, {conf.high}]\", statistic = NULL, coef_omit = \"Intercept\") m <- glm(am ~ mpg, data = mtcars, family = binomial) modelsummary( m, fmt = NULL, estimate = \"{round(exp(estimate), 5)}\", statistic = \"{round(exp(estimate) * std.error, 3)}\") modelsummary( models, fmt = 1, estimate = c(\"estimate\", \"{estimate}{stars}\", \"{estimate} ({std.error})\", \"{estimate} ({std.error}){stars}\", \"{estimate} [{conf.low}, {conf.high}]\"), statistic = NULL, coef_omit = \"Intercept\")"},{"path":"https://vincentarelbundock.github.io/modelsummary/dev/articles/modelsummary.html","id":"statistic-se-t-p-ci-etc-","dir":"Articles","previous_headings":"","what":"statistic: SE, t, p, CI, etc.","title":"modelsummary: regression tables","text":"default, modelsummary prints coefficient’s standard error parentheses corresponding estimate. value uncertainty statistic determined statistic argument. statistic argument accepts column names produced get_estimates(model). example: can also display confidence intervals brackets setting statistic=\"conf.int\": Alternatively, can supply glue string get complicated results: can also display several different uncertainty estimates coefficient estimates using vector. example, Setting statistic=NULL omits statistics. can often useful , example, want display confidence intervals next coefficients:","code":"modelsummary(models, statistic = 'std.error') modelsummary(models, statistic = 'p.value') modelsummary(models, statistic = 'statistic') modelsummary(models, fmt = 1, statistic = 'conf.int', conf_level = .99) modelsummary(models, statistic = \"{std.error} ({p.value})\") modelsummary(models, gof_omit = \".*\", statistic = c(\"conf.int\", \"s.e. = {std.error}\", \"t = {statistic}\", \"p = {p.value}\")) modelsummary(models, gof_omit = \".*\", estimate = \"{estimate} [{conf.low}, {conf.high}]\", statistic = NULL)"},{"path":"https://vincentarelbundock.github.io/modelsummary/dev/articles/modelsummary.html","id":"vcov-robust-ses","dir":"Articles","previous_headings":"","what":"vcov: robust SEs","title":"modelsummary: regression tables","text":"can use clustered robust uncertainty estimates modifying vcov parameter. function accepts 5 different types input. can use string vector strings: variance-covariance matrices calculated using sandwich package. can pass arguments sandwich functions directly modelsummary function. instance, change number bootstrap replicates specify clustering variable call: can use one-sided formula list one-sided formulas use clustered standard errors: can specify function produces variance-covariance matrices: can supply list functions length model list: can supply list named variance-covariance matrices: can supply list named vectors:","code":"modelsummary(models, vcov = \"robust\") modelsummary(models, vcov = c(\"classical\", \"robust\", \"bootstrap\", \"stata\", \"HC4\")) modelsummary(mod, vcov = \"bootstrap\", R = 1000, cluster = \"country\") modelsummary(models, vcov = ~Region) library(sandwich) modelsummary(models, vcov = vcovHC) modelsummary(models, vcov = list(vcov, vcovHC, vcovHAC, vcovHC, vcov)) vcov_matrices <- lapply(models, vcovHC) modelsummary(models, vcov = vcov_matrices) vc <- list( `OLS 1` = c(`(Intercept)` = 2, Literacy = 3, Clergy = 4), `Poisson 1` = c(`(Intercept)` = 3, Literacy = -5, Commerce = 3), `OLS 2` = c(`(Intercept)` = 7, Literacy = -6, Clergy = 9), `Poisson 2` = c(`(Intercept)` = 4, Literacy = -7, Commerce = -9), `OLS 3` = c(`(Intercept)` = 1, Literacy = -5, Clergy = -2)) modelsummary(models, vcov = vc)"},{"path":"https://vincentarelbundock.github.io/modelsummary/dev/articles/modelsummary.html","id":"stars","dir":"Articles","previous_headings":"","what":"stars","title":"modelsummary: regression tables","text":"people like add “stars” model summary tables mark statistical significance. stars argument can take three types input: NULL omits stars special marks (default) TRUE uses default values: + p < 0.1, * p < 0.05, ** p < 0.01, *** p < 0.001 Named numeric vector custom stars. Whenever stars NULL, modelsummary adds note bottom table automatically. like add stars include note bottom table, can define display estimate manually using glue string, described estimate argument section documentation. Whenever stars string appears estimate statistic arguments, modelsummary assume want fine-grained control table, include note stars. want create stars description, can add custom notes notes argument.","code":"modelsummary(models) modelsummary(models, stars = TRUE) modelsummary(models, stars = c('+' = .1, '&' = .01)) modelsummary(models, estimate = \"{estimate}{stars}\", gof_omit = \".*\")"},{"path":"https://vincentarelbundock.github.io/modelsummary/dev/articles/modelsummary.html","id":"coef_omit","dir":"Articles","previous_headings":"","what":"coef_omit","title":"modelsummary: regression tables","text":"alternative mechanism subset coefficients use coef_omit argument, accepts vector integer regular expression. example, can omit first second coefficients follows: Negative indices determine coefficients keep: coef_omit string, fed grepl(x,perl=TRUE) detect variable names excluded table. Since coef_omit accepts regexes, can interesting things , specifying list variables modelsummary keep instead omit. , use negative lookahead. keep coefficients starting “Lit”, call: keep coefficients matching “y” substring: keep coefficients matching one two substrings:","code":"modelsummary(models, coef_omit = 1:2, gof_map = NA) modelsummary(models, coef_omit = c(-1, -2), gof_map = NA) modelsummary(models, coef_omit = \"Intercept|.*merce\", gof_map = NA) modelsummary(models, coef_omit = \"^(?!Lit)\", gof_map = NA) modelsummary(models, coef_omit = \"^(?!.*y)\", gof_map = NA) modelsummary(models, coef_omit = \"^(?!.*tercept|.*y)\", gof_map = NA)"},{"path":"https://vincentarelbundock.github.io/modelsummary/dev/articles/modelsummary.html","id":"coef_rename","dir":"Articles","previous_headings":"","what":"coef_rename","title":"modelsummary: regression tables","text":"modelsummary offers powerful innovative mechanisms rename, reorder, subset coefficients goodness--fit statistics. can rename coefficients using coef_rename argument. example, two models different explanatory variables, want variables name appear row, can : provide named character vector coef_rename, exact matches complete original term name replaced. complex modifications, can feed function returns named vector coef_rename argument. example, modelsummary ships function called coef_rename, executes common renaming tasks automatically. example also uses dvnames function extract name dependent variable model: course, can also define custom functions. instance, rename model interacted variables (e.g., “drat:mpg”), define custom rename_explanator function: Beware inadvertently replacing parts variable names! Making regex pattern specific possible (e.g., adding word boundaries) likely good idea. custom rename function also good place re-introduce replacement “:” “×” dealing interaction terms – modelsummary makes replacement coef_rename argument specified. Another possibility assign variable labels attributes data used fit model. , can automatically rename :","code":"x <- list(lm(hp ~ drat, mtcars), lm(hp ~ vs, mtcars)) modelsummary(x, coef_rename = c(\"drat\" = \"Explanator\", \"vs\" = \"Explanator\")) x <- list( lm(mpg ~ factor(cyl) + drat + disp, data = mtcars), lm(hp ~ factor(cyl) + drat + disp, data = mtcars) ) modelsummary(dvnames(x), coef_rename = coef_rename) y <- list( lm(hp ~ drat / mpg, mtcars), lm(hp ~ vs / mpg, mtcars) ) rename_explanator <- function(old_names) { new_names <- gsub(\"drat|vs\", \"Explanator\", old_names) setNames(new_names, old_names) } modelsummary(y, coef_rename = rename_explanator) datlab <- mtcars datlab$cyl <- factor(datlab$cyl) attr(datlab$cyl, \"label\") <- \"Cylinders\" attr(datlab$am, \"label\") <- \"Transmission\" modlab <- lm(mpg ~ cyl + am, data = datlab) modelsummary(modlab, coef_rename = TRUE)"},{"path":"https://vincentarelbundock.github.io/modelsummary/dev/articles/modelsummary.html","id":"coef_map-order-omit-rename","dir":"Articles","previous_headings":"","what":"coef_map: order, omit, rename","title":"modelsummary: regression tables","text":"coef_map argument named vector allows users rename, reorder, subset coefficient estimates. Values vector correspond “clean” variable name. Names vector correspond “raw” variable name. table sorted order terms presented coef_map. Coefficients included coef_map excluded table.","code":"cm <- c('Literacy' = 'Literacy (%)', 'Commerce' = 'Patents per capita', '(Intercept)' = 'Constant') modelsummary(models, coef_map = cm)"},{"path":"https://vincentarelbundock.github.io/modelsummary/dev/articles/modelsummary.html","id":"gof_omit-goodness-of-fit-and-model-characteristics","dir":"Articles","previous_headings":"","what":"gof_omit: goodness-of-fit and model characteristics","title":"modelsummary: regression tables","text":"gof_omit regular expression fed grepl(x,perl=TRUE) detect names statistics excluded table.","code":"modelsummary(models, gof_omit = 'DF|Deviance|R2|AIC|BIC')"},{"path":"https://vincentarelbundock.github.io/modelsummary/dev/articles/modelsummary.html","id":"gof_map","dir":"Articles","previous_headings":"","what":"gof_map","title":"modelsummary: regression tables","text":"gof_map argument can used rename, re-order, subset, format statistics displayed bottom section table (“goodness--fit”). first type values allowed character vector elements equal column names data.frame produced get_gof(model): powerful mechanism supply data.frame (tibble) gof_map argument. data.frame must include 3 columns: raw: string name column produced get_gof(model). clean: string “clean” name statistic want appear final table. fmt: string used round/format string question (e.g., \"%.3f\"). follows standards fmt argument ?modelsummary. can see example valid data frame typing modelsummary::gof_map. default data.frame modelsummary uses subset reorder goodness--fit statistics. can see, omit == TRUE quite number statistics. can include setting omit == FALSE: goodness--fit statistics printed table order gof_map data.frame. Notice subtle difference coef_map gof_map. one hand, coef_map works “white list”: coefficient explicitly entered omitted table. , gof_map works “black list”: statistics need explicitly marked omission. Another convenient way build gof_map argument use tribble function tibble package. example, insert special HTML code display superscript, use escape=FALSE argument:","code":"modelsummary(models, gof_map = c(\"nobs\", \"r.squared\")) gm <- modelsummary::gof_map gm$omit <- FALSE modelsummary(models, gof_map = gm) f <- function(x) format(round(x, 3), big.mark=\",\") gm <- list( list(\"raw\" = \"nobs\", \"clean\" = \"N\", \"fmt\" = f), list(\"raw\" = \"AIC\", \"clean\" = \"aic\", \"fmt\" = f)) modelsummary(models, gof_map = gm) gm <- tibble::tribble( ~raw, ~clean, ~fmt, \"nobs\", \"N\", 0, \"r.squared\", \"R2<\/sup>\", 2) modelsummary( models, statistic = NULL, gof_map = gm, escape = FALSE)"},{"path":"https://vincentarelbundock.github.io/modelsummary/dev/articles/modelsummary.html","id":"shape-pivot-groups-panels-and-stacks","dir":"Articles","previous_headings":"","what":"shape: pivot, groups, panels, and stacks","title":"modelsummary: regression tables","text":"section requires version 1.3.1 modelsummary. version available CRAN yet, can install development version following instructions website. shape argument accepts: formula determines structure table, can display “grouped” coefficients together (e.g., multivariate outcome mixed-effects models). strings “rbind” “rcollapse” stack multiple tables top present models distinct “panels”.","code":""},{"path":"https://vincentarelbundock.github.io/modelsummary/dev/articles/modelsummary.html","id":"formula","dir":"Articles","previous_headings":"shape: pivot, groups, panels, and stacks","what":"Formula","title":"modelsummary: regression tables","text":"left side formula represents rows right side represents columns. default formula term + statistic ~ model: can display statistics horizontally : order terms formula determines order headers table. shape partial matching try fill-incomplete formulas: models like multinomial logit GAMLSS produce “grouped” parameter estimates. display groups, can include group identifier shape formula. group identifier must one column names produced get_estimates(model). example, models produced nnet::multinom, group identifier called “response”: summarize results, can type: terms shape formula can course rearranged reshape table. example: version 1.0.1 package later, can combine term group identifier columns inserting interaction colon : instead + formula:","code":"m <- list( lm(mpg ~ hp, data = mtcars), lm(mpg ~ hp + drat, data = mtcars)) modelsummary(m, shape = term + statistic ~ model, gof_map = NA) modelsummary(m, shape = term ~ model + statistic, statistic = \"conf.int\", gof_map = NA) modelsummary(m, shape = term ~ statistic + model, statistic = \"conf.int\", gof_map = NA) modelsummary(m, shape = ~ statistic) library(nnet) dat_multinom <- mtcars dat_multinom$cyl <- sprintf(\"Cyl: %s\", dat_multinom$cyl) mod <- list( nnet::multinom(cyl ~ mpg, data = dat_multinom, trace = FALSE), nnet::multinom(cyl ~ mpg + drat, data = dat_multinom, trace = FALSE)) get_estimates(mod[[1]]) #> term estimate std.error conf.level conf.low conf.high statistic #> 1 (Intercept) 47.252432 34.975171 0.95 -24.390958 118.89582104 1.351028 #> 2 mpg -2.205418 1.637963 0.95 -5.560632 1.14979649 -1.346440 #> 3 (Intercept) 72.440246 37.175162 0.95 -3.709622 148.59011342 1.948619 #> 4 mpg -3.579991 1.774693 0.95 -7.215284 0.05530216 -2.017246 #> df.error p.value response s.value group #> 1 28 0.18750348 Cyl: 6 2.4 #> 2 28 0.18896007 Cyl: 6 2.4 #> 3 28 0.06142602 Cyl: 8 4.0 #> 4 28 0.05334849 Cyl: 8 4.2 modelsummary(mod, shape = term + response ~ statistic) modelsummary(mod, shape = model + term ~ response) library(marginaleffects) mod <- glm(am ~ mpg + factor(cyl), family = binomial, data = mtcars) mfx <- marginaleffects(mod) modelsummary(mfx, shape = term + contrast ~ model) modelsummary(mfx, shape = term : contrast ~ model)"},{"path":"https://vincentarelbundock.github.io/modelsummary/dev/articles/modelsummary.html","id":"string-rbind-or-rcollapse-panels-of-models-in-stacked-regression-tables","dir":"Articles","previous_headings":"shape: pivot, groups, panels, and stacks","what":"String (“rbind” or “rcollapse”): Panels of models in stacked regression tables","title":"modelsummary: regression tables","text":"Note: code section requires version 1.3.0 development version modelsummary. See website installation instructions. section shows “stack/bind” multiple regression tables top one another, display results several models side--side top--bottom. example, imagine want present 4 different models, half estimated using different outcome variable. using modelsummary, store models list. using modelsummary shape=\"rbind\" shape=\"rbind\", store models list lists: Like modelsummary(), can can name models panels naming elements nested list:","code":"gm <- c(\"r.squared\", \"nobs\", \"rmse\") panels <- list( list( lm(mpg ~ 1, data = mtcars), lm(mpg ~ qsec, data = mtcars) ), list( lm(hp ~ 1, data = mtcars), lm(hp ~ qsec, data = mtcars) ) ) modelsummary( panels, shape = \"rbind\", gof_map = gm) panels <- list( \"Outcome: mpg\" = list( \"(I)\" = lm(mpg ~ 1, data = mtcars), \"(II)\" = lm(mpg ~ qsec, data = mtcars) ), \"Outcome: hp\" = list( \"(I)\" = lm(hp ~ 1, data = mtcars), \"(II)\" = lm(hp ~ qsec, data = mtcars) ) ) modelsummary( panels, shape = \"rbind\", gof_map = gm)"},{"path":"https://vincentarelbundock.github.io/modelsummary/dev/articles/modelsummary.html","id":"fixest","dir":"Articles","previous_headings":"shape: pivot, groups, panels, and stacks > String (“rbind” or “rcollapse”): Panels of models in stacked regression tables","what":"fixest","title":"modelsummary: regression tables","text":"fixest package offers powerful tools estimate multiple models using concise syntax. fixest functions also convenient return named lists models easy subset manipulate using standard R functions like grepl. example, introduce regressors stepwise fashion, estimate models different subsets data, can : can use typical extension systems add information, mean dependent variable:","code":"# estimate 4 models library(fixest) mod <- feols( c(hp, mpg) ~ csw(qsec, drat) | gear, data = mtcars) # select models with different outcome variables panels <- list( \"Miles per gallon\" = mod[grepl(\"mpg\", names(mod))], \"Horsepower\" = mod[grepl(\"hp\", names(mod))] ) modelsummary( panels, shape = \"rcollapse\", gof_omit = \"IC|R2\") glance_custom.fixest <- function(x, ...) { dv <- insight::get_response(x) dv <- sprintf(\"%.2f\", mean(dv, na.rm = TRUE)) data.table::data.table(`Mean of DV` = dv) } modelsummary( panels, shape = \"rcollapse\", gof_omit = \"IC|R2\") rm(\"glance_custom.fixest\")"},{"path":"https://vincentarelbundock.github.io/modelsummary/dev/articles/modelsummary.html","id":"align-column-alignment","dir":"Articles","previous_headings":"","what":"align: column alignment","title":"modelsummary: regression tables","text":"default, modelsummary align first column (coefficient names) left, center results columns. change default, can use align argument, accepts string length number columns: Users produce PDF documents using Rmarkdown LaTeX can also align values decimal dot using character “d” align argument: table produced code compile, users must include following code LaTeX preamble:","code":"modelsummary(models, align=\"lrrrrr\") modelsummary(models, align=\"lddddd\") \\usepackage{booktabs} \\usepackage{siunitx} \\newcolumntype{d}{S[input-symbols = ()]}"},{"path":"https://vincentarelbundock.github.io/modelsummary/dev/articles/modelsummary.html","id":"notes-footers","dir":"Articles","previous_headings":"","what":"notes: footers","title":"modelsummary: regression tables","text":"Add notes bottom table:","code":"modelsummary(models, notes = list('Text of the first note.', 'Text of the second note.'))"},{"path":"https://vincentarelbundock.github.io/modelsummary/dev/articles/modelsummary.html","id":"title-captions","dir":"Articles","previous_headings":"","what":"title: captions","title":"modelsummary: regression tables","text":"can add title table follows:","code":"modelsummary(models, title = 'This is a title for my table.')"},{"path":"https://vincentarelbundock.github.io/modelsummary/dev/articles/modelsummary.html","id":"add_rows","dir":"Articles","previous_headings":"","what":"add_rows","title":"modelsummary: regression tables","text":"Use add_rows argument add rows manually table. example, let’s say estimate two models factor variables want insert () empty line identify category reference, (b) customized information bottom table: create data.frame number columns summary table. , define “position” attribute specify new rows inserted table. Finally, pass data.frame add_rows argument:","code":"models <- list() models[['OLS']] <- lm(mpg ~ factor(cyl), mtcars) models[['Logit']] <- glm(am ~ factor(cyl), mtcars, family = binomial) library(tibble) rows <- tribble(~term, ~OLS, ~Logit, 'factor(cyl)4', '-', '-', 'Info', '???', 'XYZ') attr(rows, 'position') <- c(3, 9) modelsummary(models, add_rows = rows)"},{"path":"https://vincentarelbundock.github.io/modelsummary/dev/articles/modelsummary.html","id":"exponentiate","dir":"Articles","previous_headings":"","what":"exponentiate","title":"modelsummary: regression tables","text":"can exponentiate estimates using exponentiate argument: can also present exponentiated standard models side side using logical vector:","code":"mod_logit <- glm(am ~ mpg, data = mtcars, family = binomial) modelsummary(mod_logit, exponentiate = TRUE) mod_logit <- list(mod_logit, mod_logit) modelsummary(mod_logit, exponentiate = c(TRUE, FALSE))"},{"path":"https://vincentarelbundock.github.io/modelsummary/dev/articles/modelsummary.html","id":"ellipsis-additional-arguments","dir":"Articles","previous_headings":"","what":"... ellipsis: Additional arguments","title":"modelsummary: regression tables","text":"arguments passed user modelsummary function pushed forward two functions: default, additional arguments pushed forward parameters::parameters performance::performance. Users can also can also use different “backend” extract information model objects: broom package. setting modelsummary_get global option, tell modelsummary use easystats/parameters packages instead broom. packages, arguments available, metrics argument. Please refer package’s documentation details. default, additional arguments pushed forward kableExtra::kbl, users can use different table-making function setting output argument different value \"gt\", \"flextable\", \"huxtable\". See Appearance vignette examples. arguments passed supported functions thus automatically available directly modelsummary, modelplot, datasummary family functions.","code":""},{"path":"https://vincentarelbundock.github.io/modelsummary/dev/articles/modelsummary.html","id":"custom-appearance","dir":"Articles","previous_headings":"","what":"Custom appearance","title":"modelsummary: regression tables","text":"customize appearance tables, modelsummary supports five popular extremely powerful table-making packages: gt: https://gt.rstudio.com kableExtra: http://haozhu233.github.io/kableExtra huxtable: https://hughjonesd.github.io/huxtable/ flextable: https://davidgohel.github.io/flextable/ DT: https://rstudio.github.io/DT “customizing look tables” vignette shows examples 4 packages.","code":""},{"path":"https://vincentarelbundock.github.io/modelsummary/dev/articles/modelsummary.html","id":"supported-models","dir":"Articles","previous_headings":"","what":"Supported models","title":"modelsummary: regression tables","text":"modelsummary automatically supports models supported tidy function broom package parameters function parameters package. list supported models rapidly expanding. moment, covers following model classes: see given model supported, can fit , call function: function return valid output, can easily (really!!) add support. See next section tutorial. , may consider opening issue Github website broom package: https://github.com/tidymodels/broom/issues","code":"supported_models() #> [1] \"aareg\" \"acf\" #> [3] \"afex_aov\" \"AKP\" #> [5] \"anova\" \"Anova.mlm\" #> [7] \"anova.rms\" \"aov\" #> [9] \"aovlist\" \"Arima\" #> [11] \"averaging\" \"bamlss\" #> [13] \"bayesQR\" \"bcplm\" #> [15] \"befa\" \"betamfx\" #> [17] \"betaor\" \"betareg\" #> [19] \"BFBayesFactor\" \"bfsl\" #> [21] \"BGGM\" \"bifeAPEs\" #> [23] \"biglm\" \"binDesign\" #> [25] \"binWidth\" \"blavaan\" #> [27] \"blrm\" \"boot\" #> [29] \"bracl\" \"brmsfit\" #> [31] \"brmultinom\" \"btergm\" #> [33] \"cch\" \"censReg\" #> [35] \"cgam\" \"character\" #> [37] \"cld\" \"clm\" #> [39] \"clm2\" \"clmm\" #> [41] \"clmm2\" \"coeftest\" #> [43] \"comparisons\" \"confint.glht\" #> [45] \"confusionMatrix\" \"coxph\" #> [47] \"cpglmm\" \"crr\" #> [49] \"cv.glmnet\" \"data.frame\" #> [51] \"dbscan\" \"default\" #> [53] \"deltaMethod\" \"density\" #> [55] \"dep.effect\" \"DirichletRegModel\" #> [57] \"dist\" \"draws\" #> [59] \"drc\" \"durbinWatsonTest\" #> [61] \"emm_list\" \"emmeans\" #> [63] \"emmeans_summary\" \"emmGrid\" #> [65] \"epi.2by2\" \"ergm\" #> [67] \"fa\" \"fa.ci\" #> [69] \"factanal\" \"FAMD\" #> [71] \"felm\" \"fitdistr\" #> [73] \"fixest\" \"fixest_multi\" #> [75] \"flac\" \"flic\" #> [77] \"ftable\" \"gam\" #> [79] \"Gam\" \"gamlss\" #> [81] \"gamm\" \"garch\" #> [83] \"geeglm\" \"ggeffects\" #> [85] \"glht\" \"glimML\" #> [87] \"glm\" \"glmm\" #> [89] \"glmmTMB\" \"glmnet\" #> [91] \"glmrob\" \"glmRob\" #> [93] \"glmx\" \"gmm\" #> [95] \"hclust\" \"hdbscan\" #> [97] \"hglm\" \"hkmeans\" #> [99] \"HLfit\" \"htest\" #> [101] \"hurdle\" \"hypotheses\" #> [103] \"irlba\" \"ivFixed\" #> [105] \"ivprobit\" \"ivreg\" #> [107] \"kappa\" \"kde\" #> [109] \"Kendall\" \"kmeans\" #> [111] \"lavaan\" \"leveneTest\" #> [113] \"Line\" \"Lines\" #> [115] \"list\" \"lm\" #> [117] \"lm_robust\" \"lm.beta\" #> [119] \"lme\" \"lmodel2\" #> [121] \"lmrob\" \"lmRob\" #> [123] \"logical\" \"logistf\" #> [125] \"logitmfx\" \"logitor\" #> [127] \"lqm\" \"lqmm\" #> [129] \"lsmobj\" \"manova\" #> [131] \"maov\" \"map\" #> [133] \"marginaleffects\" \"marginalmeans\" #> [135] \"margins\" \"maxim\" #> [137] \"maxLik\" \"mblogit\" #> [139] \"Mclust\" \"mcmc\" #> [141] \"mcmc.list\" \"MCMCglmm\" #> [143] \"mcp1\" \"mcp2\" #> [145] \"med1way\" \"mediate\" #> [147] \"merMod\" \"merModList\" #> [149] \"meta_bma\" \"meta_fixed\" #> [151] \"meta_random\" \"metaplus\" #> [153] \"mfx\" \"mhurdle\" #> [155] \"mipo\" \"mira\" #> [157] \"mixed\" \"MixMod\" #> [159] \"mixor\" \"mjoint\" #> [161] \"mle\" \"mle2\" #> [163] \"mlm\" \"mlogit\" #> [165] \"mmrm\" \"mmrm_fit\" #> [167] \"mmrm_tmb\" \"model_fit\" #> [169] \"model_parameters\" \"muhaz\" #> [171] \"multinom\" \"mvord\" #> [173] \"negbin\" \"negbinirr\" #> [175] \"negbinmfx\" \"nestedLogit\" #> [177] \"nlrq\" \"nls\" #> [179] \"NULL\" \"numeric\" #> [181] \"omega\" \"onesampb\" #> [183] \"optim\" \"orcutt\" #> [185] \"osrt\" \"pairwise.htest\" #> [187] \"pam\" \"parameters_efa\" #> [189] \"parameters_pca\" \"PCA\" #> [191] \"pgmm\" \"plm\" #> [193] \"PMCMR\" \"poissonirr\" #> [195] \"poissonmfx\" \"poLCA\" #> [197] \"polr\" \"Polygon\" #> [199] \"Polygons\" \"power.htest\" #> [201] \"prcomp\" \"predictions\" #> [203] \"principal\" \"probitmfx\" #> [205] \"pvclust\" \"pyears\" #> [207] \"rcorr\" \"ref.grid\" #> [209] \"regsubsets\" \"ridgelm\" #> [211] \"rlm\" \"rlmerMod\" #> [213] \"rma\" \"robtab\" #> [215] \"roc\" \"rq\" #> [217] \"rqs\" \"rqss\" #> [219] \"sarlm\" \"Sarlm\" #> [221] \"scam\" \"selection\" #> [223] \"sem\" \"SemiParBIV\" #> [225] \"slopes\" \"SpatialLinesDataFrame\" #> [227] \"SpatialPolygons\" \"SpatialPolygonsDataFrame\" #> [229] \"spec\" \"speedglm\" #> [231] \"speedlm\" \"stanfit\" #> [233] \"stanmvreg\" \"stanreg\" #> [235] \"summary_emm\" \"summary.glht\" #> [237] \"summary.lm\" \"summary.plm\" #> [239] \"summaryDefault\" \"survdiff\" #> [241] \"survexp\" \"survfit\" #> [243] \"survreg\" \"svd\" #> [245] \"svyglm\" \"svyolr\" #> [247] \"svytable\" \"systemfit\" #> [249] \"t1way\" \"table\" #> [251] \"tobit\" \"trendPMCMR\" #> [253] \"trimcibt\" \"ts\" #> [255] \"TukeyHSD\" \"varest\" #> [257] \"vgam\" \"wbgee\" #> [259] \"wbm\" \"wmcpAKP\" #> [261] \"xyz\" \"yuen\" #> [263] \"zcpglm\" \"zerocount\" #> [265] \"zeroinfl\" \"zoo\" get_estimates(model)"},{"path":[]},{"path":"https://vincentarelbundock.github.io/modelsummary/dev/articles/modelsummary.html","id":"adding-new-models-part-i","dir":"Articles","previous_headings":"New models and custom statistics","what":"Adding new models (part I)","title":"modelsummary: regression tables","text":"simplest way summarize unsupported model create modelsummary_list object. approach super flexible, requires manual intervention, can become tedious need summarize many models. next section shows add formal support unsupported model type. modelsummary_list list two element conform broom package specification: tidy glance. tidy data.frame least three columns: term, estimate, std.error. glance data.frame single row, column displayed bottom table goodness--fit section. Finally, wrap two elements list assign modelsummary_list class:","code":"ti <- data.frame( term = c(\"coef1\", \"coef2\", \"coef3\"), estimate = 1:3, std.error = c(pi, exp(1), sqrt(2))) gl <- data.frame( stat1 = \"blah\", stat2 = \"blah blah\") mod <- list( tidy = ti, glance = gl) class(mod) <- \"modelsummary_list\" modelsummary(mod)"},{"path":"https://vincentarelbundock.github.io/modelsummary/dev/articles/modelsummary.html","id":"adding-new-models-part-ii","dir":"Articles","previous_headings":"New models and custom statistics","what":"Adding new models (part II)","title":"modelsummary: regression tables","text":"modelsummary relies two functions broom package extract model information: tidy glance. broom doesn’t support type model trying summarize, modelsummary won’t support box. Thankfully, extremely easy add support models using custom methods. example, models produced MCMCglmm package currently supported broom. add support, simply need create tidy glance method: Three important things note. First, methods named tidy.MCMCglmm glance.MCMCglmm model object trying summarize class MCMCglmm. can find class model running: class(model). Second, methods include ellipsis ... argument. Third, example used statistic = 'conf.int' argument. tidy method produces conf.low conf.high columns. cases, users define std.error column custom tidy methods, statistic argument need adjusted. create new tidy glance methods, please consider contributing broom rest community can benefit work: https://github.com/tidymodels/broom","code":"# load packages and data library(modelsummary) library(MCMCglmm) data(PlodiaPO) # add custom functions to extract estimates (tidy) and goodness-of-fit (glance) information tidy.MCMCglmm <- function(x, ...) { s <- summary(x, ...) ret <- data.frame( term = row.names(s$solutions), estimate = s$solutions[, 1], conf.low = s$solutions[, 2], conf.high = s$solutions[, 3]) ret } glance.MCMCglmm <- function(x, ...) { ret <- data.frame( dic = x$DIC, n = nrow(x$X)) ret } # estimate a simple model model <- MCMCglmm(PO ~ 1 + plate, random = ~ FSfamily, data = PlodiaPO, verbose=FALSE, pr=TRUE) # summarize the model modelsummary(model, statistic = 'conf.int')"},{"path":"https://vincentarelbundock.github.io/modelsummary/dev/articles/modelsummary.html","id":"adding-new-information-to-existing-models","dir":"Articles","previous_headings":"New models and custom statistics","what":"Adding new information to existing models","title":"modelsummary: regression tables","text":"Users may want include information made available default extractor function. example, models produced MASS::polr produce p values default, means use stars=TRUE argument modelsummary. However, possible extract information using lmtest::coeftest function. include custom information, define new glance_custom tidy_custom methods. begin estimating model MASS::polr: get_estimates function shows default extractor produce p.value column. result, setting stars=TRUE modelsummary produce error. know MASS::polr produces object class polr: extract (custom) information model class, thus define method called tidy_custom.polr returns data.frame two columns: term p.value: method defined, modelsummary can automatically extract p values models class, now work properly stars=TRUE:","code":"library(MASS) mod_ordinal <- polr(as.ordered(gear) ~ mpg + drat, data = mtcars) get_estimates(mod_ordinal) #> term estimate std.error conf.level conf.low conf.high statistic #> 1 3|4 13.962948762 4.04107299 0.95 5.6851860 22.2407115 3.4552578 #> 2 4|5 16.898937339 4.39497069 0.95 7.8962480 25.9016267 3.8450626 #> 3 mpg -0.008646679 0.09034201 0.95 -0.1916706 0.1708667 -0.0957105 #> 4 drat 3.949431922 1.30665144 0.95 1.6191505 6.8457246 3.0225597 #> df.error p.value component s.value group #> 1 28 0.0017706302 alpha 9.1 #> 2 28 0.0006356348 alpha 10.6 #> 3 28 0.9244322337 beta 0.1 #> 4 28 0.0053120619 beta 7.6 class(mod_ordinal) #> [1] \"polr\" tidy_custom.polr <- function(x, ...) { s <- lmtest::coeftest(x) out <- data.frame( term = row.names(s), p.value = s[, \"Pr(>|t|)\"]) out } modelsummary(mod_ordinal, stars = TRUE)"},{"path":"https://vincentarelbundock.github.io/modelsummary/dev/articles/modelsummary.html","id":"customizing-existing-models-part-i","dir":"Articles","previous_headings":"New models and custom statistics","what":"Customizing existing models (part I)","title":"modelsummary: regression tables","text":"Sometimes users want include information supplied functions. pretty easy way include extra information define new glance_custom tidy_custom methods. illustrate, estimate two linear regression models using lm function: R, lm function produces models class “lm”: Let’s say like print dependent variable model particular class. need define new method called glance_custom.lm. method return data.frame (tibble) 1 row, 1 column per piece information want display. example: Now, let’s customize body table. vcov argument already allows users customize uncertainty estimates. imagine want override coefficient estimates “lm” models. Easy! need define tidy_custom.lm method returns data.frame (tibble) one column called “term” one column called “estimate”. , ’ll substitute estimates /-pointing triangles represents signs: define glance_custom tidy_custom methods, modelsummary automatically display customized model information: Note can define std.error column tidy_custom.lm replace uncertainty estimates instead coefficients.","code":"library(modelsummary) mod <- list() mod[[1]] <- lm(hp ~ mpg + drat, mtcars) mod[[2]] <- lm(wt ~ mpg + drat + am, mtcars) class(mod[[1]]) #> [1] \"lm\" glance_custom.lm <- function(x, ...) { dv <- as.character(formula(x)[2]) out <- data.frame(\"DV\" = dv) return(out) } tidy_custom.lm <- function(x, ...) { s <- summary(x)$coefficients out <- data.frame( term = row.names(s), estimate = ifelse(s[,1] > 0, '▲', '▼')) return(out) } modelsummary(mod)"},{"path":"https://vincentarelbundock.github.io/modelsummary/dev/articles/modelsummary.html","id":"customizing-existing-models-part-ii","dir":"Articles","previous_headings":"New models and custom statistics","what":"Customizing existing models (part II)","title":"modelsummary: regression tables","text":"even fundamental way customize output completely bypass modelsummary’s extractor functions assigning new class name model. example, Warning: defining new tidy glance methods, important include ellipsis argument (...). Note glance.custom() method, called stats:::nobs.lm() instead default stats::nobs() method, latter know know dispatch models new “custom” class. explicit solves problem. alternative set new class inherits previous one, use global option set broom default extractor function (otherwise modelsummary use standard lm extractors inheritance):","code":"# estimate a linear model mod_custom <- lm(hp ~ mpg + drat, mtcars) # assign it a new class class(mod_custom) <- \"custom\" # define tidy and glance methods tidy.custom <- function(x, ...) { data.frame( term = names(coef(x)), estimate = letters[1:length(coef(x))], std.error = seq_along(coef(x)) ) } glance.custom <- function(x, ...) { data.frame( \"Model\" = \"Custom\", \"nobs\" = stats:::nobs.lm(x) ) } # summarize modelsummary(mod_custom) options(modelsummary_get = \"broom\") class(mod_custom) <- c(\"custom\", \"lm\")"},{"path":"https://vincentarelbundock.github.io/modelsummary/dev/articles/modelsummary.html","id":"customizing-existing-models-part-iii","dir":"Articles","previous_headings":"New models and custom statistics","what":"Customizing existing models (part III)","title":"modelsummary: regression tables","text":"Another flexible way customize model output use output = \"modelsummary_list\". output option, modelsummary() returns list two elements: tidy contains parameter estimates, standard errors, etc., glance contains model statistics AIC. example, tidy glance can now customized, updated model can passed back modelsummary using modelsummary(mod_list). information displayed table contained mod_list, pattern allows flexible adjustments output tables. useful example pattern concerns mixed models using lme4. Assume want compare effect using different degrees--freedom adjustments significance coefficients. models identical parameter estimates, standard errors, model fit statistics - want change p-values. use parameters package compute adjusted p-values.","code":"mod <- lm(hp ~ mpg + drat, mtcars) mod_list <- modelsummary(mod, output = \"modelsummary_list\") mod_list$tidy #> term estimate std.error statistic df.error p.value s.value #> 1 (Intercept) 278.515455 55.414866 5.0260061 29 2.359726e-05 15.4 #> 2 mpg -9.985499 1.791837 -5.5727709 29 5.172030e-06 17.6 #> 3 drat 19.125752 20.197756 0.9469246 29 3.515013e-01 1.5 #> group conf.low conf.high #> 1 NA NA #> 2 NA NA #> 3 NA NA mod_list$glance #> aic bic r.squared adj.r.squared rmse nobs F logLik #> 1 337.8809 343.7438 0.6143611 0.5877653 41.90687 32 23.09994 -164.9404 library(\"lme4\") mod <- lmer(mpg ~ drat + (1 | am), data = mtcars) mod_list <- modelsummary(mod, output = \"modelsummary_list\", effects = \"fixed\") # create a copy, where we'll change the p-values mod_list_kenward <- as.list(mod_list) mod_list_kenward$tidy$p.value <- parameters::p_value_kenward(mod)$p modelsummary(list(\"Wald\" = mod_list, \"Kenward\" = mod_list_kenward), statistic = \"{std.error} ({p.value}) {stars}\")"},{"path":[]},{"path":"https://vincentarelbundock.github.io/modelsummary/dev/articles/modelsummary.html","id":"rmarkdown","dir":"Articles","previous_headings":"Rmarkdown, Quarto, Org-Mode","what":"Rmarkdown","title":"modelsummary: regression tables","text":"can use modelsummary insert tables dynamic documents knitr Rmarkdown. minimal .Rmd file can produce tables PDF, HTML, RTF documents: minimal.Rmd .Rmd file shows illustrates use table numbering cross-references produce PDF documents using bookdown: cross_references.Rmd .Rmd file shows customize tables PDF HTML files using gt kableExtra functions: appearance.Rmd","code":""},{"path":"https://vincentarelbundock.github.io/modelsummary/dev/articles/modelsummary.html","id":"quarto","dir":"Articles","previous_headings":"Rmarkdown, Quarto, Org-Mode","what":"Quarto","title":"modelsummary: regression tables","text":"Quarto open source publishing system built top Pandoc. designed “successor” Rmarkdown, includes useful features technical writing, built-support cross-references. modelsummary works automatically Quarto. minimal document cross-references render automatically PDF, HTML, :","code":"--- format: pdf title: Example --- @tbl-mtcars shows that cars with high horse power get low miles per gallon. ```{r} #| label: tbl-mtcars #| tbl-cap: \"Horse Powers vs. Miles per Gallon\" library(modelsummary) mod <- lm(mpg ~ hp, mtcars) modelsummary(mod) ```"},{"path":"https://vincentarelbundock.github.io/modelsummary/dev/articles/modelsummary.html","id":"emacs-org-mode","dir":"Articles","previous_headings":"Rmarkdown, Quarto, Org-Mode","what":"Emacs Org-Mode","title":"modelsummary: regression tables","text":"can use modelsummary insert tables Emacs Org-Mode documents, can exported variety formats, including HTML PDF (via LaTeX). anything Emacs-related, many ways achieve outcomes want. one example Org-Mode document can automatically export tables HTML PDF without manual tweaks: first line tells Org-mode assign variable called orgbackend. variable accessible R session, equal “html” “latex”, depending export format. second line creates Org macro use automatically add useful information header source blocks. instance, export HTML, macro expand :results output html. tells Org-Mode insert last printed output R session, treat raw HTML. {{{Rtable}}} call expands macro add information header block follows. #+BEGIN_SRC R :exports says want print original code output (:exports results omit code, example). Finally, options(modelsummary_factory_default=orgbackend uses variable defined set default output format. way, don’t use output argument every time. One potentially issue keep mind code extracts printout R console. However, customize tables kableExtra gt functions, functions always return printed raw HTML LaTeX code. Sometimes, can necessary add call cat end table customization pipeline. example:","code":"#+PROPERTY: header-args:R :var orgbackend=(prin1-to-string org-export-current-backend) #+MACRO: Rtable (eval (concat \"#+header: :results output \" (prin1-to-string org-export-current-backend))) {{{Rtable}}} #+BEGIN_SRC R :exports both library(modelsummary) options(modelsummary_factory_default = orgbackend) mod = lm(hp ~ mpg, data = mtcars) modelsummary(mod) #+END_SRC {{{Rtable}}} #+BEGIN_SRC R :exports both library(modelsummary) library(kableExtra) mod = lm(hp ~ mpg, data = mtcars) modelsummary(mod, output = orgbackend) %>% row_spec(1, background = \"pink\") %>% cat() #+END_SRC"},{"path":"https://vincentarelbundock.github.io/modelsummary/dev/articles/modelsummary.html","id":"global-options","dir":"Articles","previous_headings":"","what":"Global options","title":"modelsummary: regression tables","text":"Users can change default behavior modelsummary setting global options. Omit note bottom table significance threshold: Change default output format: Change backend packages modelsummary uses create tables different output formats: Change packages modelsummary uses extract information models: appearance vignette shows set “themes” tables using modelsummary_theme_gt, modelsummary_theme_kableExtra, modelsummary_theme_flextable modelsummary_theme_huxtable global options. example:","code":"options(\"modelsummary_stars_note\" = FALSE) options(modelsummary_factory_default = \"latex\") options(modelsummary_factory_default = \"gt\") options(modelsummary_factory_html = 'kableExtra') options(modelsummary_factory_latex = 'flextable') options(modelsummary_factory_word = 'huxtable') options(modelsummary_factory_png = 'gt') # tidymodels: broom options(modelsummary_get = \"broom\") # easystats: performance + parameters options(modelsummary_get = \"easystats\") library(gt) # The ... ellipsis is required! custom_theme <- function(x, ...) { x %>% gt::opt_row_striping(row_striping = TRUE) } options(\"modelsummary_theme_gt\" = custom_theme) mod <- lm(mpg ~ hp + drat, mtcars) modelsummary(mod, output = \"gt\")"},{"path":[]},{"path":"https://vincentarelbundock.github.io/modelsummary/dev/articles/modelsummary.html","id":"subgroup-estimation-with-nest_by","dir":"Articles","previous_headings":"Case studies","what":"Subgroup estimation with nest_by","title":"modelsummary: regression tables","text":"Sometimes, useful estimate multiple regression models subsets data. efficiently, can use nest_by function dplyr package. , estimate models lm, extract name pull, finally summarize modelsummary:","code":"library(tidyverse) mtcars %>% nest_by(cyl) %>% mutate(models = list(lm(mpg ~ hp, data))) %>% pull(models, name = cyl) %>% modelsummary"},{"path":"https://vincentarelbundock.github.io/modelsummary/dev/articles/modelsummary.html","id":"statistics-in-separate-columns-instead-of-one-over-the-other","dir":"Articles","previous_headings":"Case studies","what":"Statistics in separate columns instead of one over the other","title":"modelsummary: regression tables","text":"somes cases, may want display statistics separate columns instead one . easy achieve outcome using estimate argument. argument accepts vector values, one models trying summarize. want include estimates standard errors separate columns, need repeat model, request different statistics. example, can automated using simple function:","code":"library(modelsummary) library(kableExtra) mod1 <- lm(mpg ~ hp, mtcars) mod2 <- lm(mpg ~ hp + drat, mtcars) models <- list( \"Coef.\" = mod1, \"Std.Error\" = mod1, \"Coef.\" = mod2, \"Std.Error\" = mod2) modelsummary(models, estimate = c(\"estimate\", \"std.error\", \"estimate\", \"std.error\"), statistic = NULL, gof_omit = \".*\", output = \"kableExtra\") %>% add_header_above(c(\" \" = 1, \"Model A\" = 2, \"Model B\" = 2)) side_by_side <- function(models, estimates, ...) { models <- rep(models, each = length(estimates)) estimates <- rep(estimates, times = 2) names(models) <- names(estimates) modelsummary(models = models, estimate = estimates, statistic = NULL, gof_omit = \".*\", ...) } models = list( lm(mpg ~ hp, mtcars), lm(mpg ~ hp + drat, mtcars)) estimates <- c(\"Coef.\" = \"estimate\", \"Std.Error\" = \"std.error\") side_by_side(models, estimates = estimates)"},{"path":"https://vincentarelbundock.github.io/modelsummary/dev/articles/modelsummary.html","id":"bootstrap","dir":"Articles","previous_headings":"Case studies","what":"Bootstrap","title":"modelsummary: regression tables","text":"Users often want use estimates standard errors obtained using custom strategy. achieve automated replicable way, can useful use tidy_custom strategy described “Cutomizing Existing Models” section. example, can use modelr package draw 500 resamples dataset, compute bootstrap standard errors taking standard deviation estimates computed resampled datasets. , defined tidy_custom.lm function automatically bootstrap lm model supplied modelsummary, replace values table automatically. Note tidy_custom_lm returns data.frame 3 columns: term, estimate, std.error:","code":"library(\"modelsummary\") library(\"broom\") library(\"tidyverse\") library(\"modelr\") tidy_custom.lm <- function(x, ...) { # extract data from the model model.frame(x) %>% # draw 500 bootstrap resamples modelr::bootstrap(n = 500) %>% # estimate the model 500 times mutate(results = map(strap, ~ update(x, data = .))) %>% # extract results using `broom::tidy` mutate(results = map(results, tidy)) %>% # unnest and summarize unnest(results) %>% group_by(term) %>% summarize(std.error = sd(estimate), estimate = mean(estimate)) } mod = list( lm(hp ~ mpg, mtcars) , lm(hp ~ mpg + drat, mtcars)) modelsummary(mod)"},{"path":"https://vincentarelbundock.github.io/modelsummary/dev/articles/modelsummary.html","id":"fixest-fixed-effects-and-instrumental-variable-regression","dir":"Articles","previous_headings":"Case studies","what":"fixest: Fixed effects and instrumental variable regression","title":"modelsummary: regression tables","text":"One common use-case glance_custom include additional goodness--fit statistics. example, instrumental variable estimation computed fixest package, may want include IV-Wald statistic first-stage regression endogenous regressor:","code":"library(fixest) library(tidyverse) # create a toy dataset base <- iris names(base) <- c(\"y\", \"x1\", \"x_endo_1\", \"x_inst_1\", \"fe\") base$x_inst_2 <- 0.2 * base$y + 0.2 * base$x_endo_1 + rnorm(150, sd = 0.5) base$x_endo_2 <- 0.2 * base$y - 0.2 * base$x_inst_1 + rnorm(150, sd = 0.5) # estimate an instrumental variable model mod <- feols(y ~ x1 | fe | x_endo_1 + x_endo_2 ~ x_inst_1 + x_inst_2, base) # custom extractor function returns a one-row data.frame (or tibble) glance_custom.fixest <- function(x) { tibble( \"Wald (x_endo_1)\" = fitstat(x, \"ivwald\")[[1]]$stat, \"Wald (x_endo_2)\" = fitstat(x, \"ivwald\")[[2]]$stat ) } # draw table modelsummary(mod) rm(\"glance_custom.fixest\")"},{"path":"https://vincentarelbundock.github.io/modelsummary/dev/articles/modelsummary.html","id":"multiple-imputation","dir":"Articles","previous_headings":"Case studies","what":"Multiple imputation","title":"modelsummary: regression tables","text":"modelsummary can pool display analyses several datasets imputed using mice Amelia packages. code illustrates :","code":"library(mice) library(Amelia) library(modelsummary) # Download data from `Rdatasets` url <- 'https://vincentarelbundock.github.io/Rdatasets/csv/HistData/Guerry.csv' dat <- read.csv(url)[, c('Clergy', 'Commerce', 'Literacy')] # Insert missing values dat$Clergy[sample(1:nrow(dat), 10)] <- NA dat$Commerce[sample(1:nrow(dat), 10)] <- NA dat$Literacy[sample(1:nrow(dat), 10)] <- NA # Impute with `mice` and `Amelia` dat_mice <- mice(dat, m = 5, printFlag = FALSE) dat_amelia <- amelia(dat, m = 5, p2s = 0)$imputations # Estimate models mod <- list() mod[['Listwise deletion']] <- lm(Clergy ~ Literacy + Commerce, dat) mod[['Mice']] <- with(dat_mice, lm(Clergy ~ Literacy + Commerce)) mod[['Amelia']] <- lapply(dat_amelia, function(x) lm(Clergy ~ Literacy + Commerce, x)) # Pool results mod[['Mice']] <- mice::pool(mod[['Mice']]) mod[['Amelia']] <- mice::pool(mod[['Amelia']]) # Summarize modelsummary(mod)"},{"path":"https://vincentarelbundock.github.io/modelsummary/dev/articles/modelsummary.html","id":"table-making-packages","dir":"Articles","previous_headings":"","what":"Table-making packages","title":"modelsummary: regression tables","text":"table-making backends supported modelsummary overlapping capabilities (e.g., several can produce HTML tables). default packages used different outputs: kableExtra: HTML LaTeX / PDF flextable: Word Powerpoint gt: jpg png can modify defaults setting global options :","code":"options(modelsummary_factory_html = \"kableExtra\") options(modelsummary_factory_latex = \"gt\") options(modelsummary_factory_word = \"huxtable\") options(modelsummary_factory_png = \"gt\")"},{"path":[]},{"path":"https://vincentarelbundock.github.io/modelsummary/dev/articles/modelsummary.html","id":"stack-overflow-is-useful","dir":"Articles","previous_headings":"FAQ","what":"Stack Overflow is useful","title":"modelsummary: regression tables","text":"Standardized coefficients Row group labels Customizing Word tables add p values datasummary_correlation","code":""},{"path":"https://vincentarelbundock.github.io/modelsummary/dev/articles/modelsummary.html","id":"where-can-i-get-help","dir":"Articles","previous_headings":"FAQ","what":"Where can I get help?","title":"modelsummary: regression tables","text":"First, please read documentation ?modelsummary modelsummary website. website includes dozens worked examples lot detailed explanation. Second, try use [modelsummary] tag StackOverflow. Third, think found bug feature request, please file Github issue tracker:","code":""},{"path":"https://vincentarelbundock.github.io/modelsummary/dev/articles/modelsummary.html","id":"how-can-i-add-or-modify-statistics-in-a-table","dir":"Articles","previous_headings":"FAQ","what":"How can I add or modify statistics in a table?","title":"modelsummary: regression tables","text":"See detailed documentation “Adding Customizing Models” section modelsummary website.","code":""},{"path":"https://vincentarelbundock.github.io/modelsummary/dev/articles/modelsummary.html","id":"how-does-modelsummary-extract-estimates-and-goodness-of-fit-statistics","dir":"Articles","previous_headings":"FAQ","what":"How does modelsummary extract estimates and goodness-of-fit statistics?","title":"modelsummary: regression tables","text":"modelsummary table divided two parts: “Estimates” (top table) “Goodness--fit” (bottom table). populate two parts, modelsummary tries using broom, parameters performance packages sequence. Estimates: Try broom::tidy function see package supports model type, user defined custom tidy function global environment. fails… Try parameters::model_parameters function see parameters package supports model type. Goodness--fit: Try performance::model_performance function see performance package supports model type. Try broom::glance function see package supports model type, user defined custom glance function global environment. fails… can change order steps executed setting global option: fails, modelsummary return error message. problems model object, can often diagnose problem running following commands clean R session: none options work, can create tidy glance methods, described Adding new models section. one extractor functions work well takes long process, can define new “custom” model class choose extractors, described Adding new models section.","code":"# tidymodels: broom options(modelsummary_get = \"broom\") # easystats: performance + parameters options(modelsummary_get = \"easystats\") # see if parameters and performance support your model type library(parameters) library(performance) model_parameters(model) model_performance(model) # see if broom supports your model type library(broom) tidy(model) glance(model) # see if broom.mixed supports your model type library(broom.mixed) tidy(model) glance(model)"},{"path":"https://vincentarelbundock.github.io/modelsummary/dev/articles/modelsummary.html","id":"how-can-i-speed-up-modelsummary","dir":"Articles","previous_headings":"FAQ","what":"How can I speed up modelsummary?","title":"modelsummary: regression tables","text":"modelsummary function, , slow: take couple seconds produce table output format. However, sometimes can computationally expensive (long) extract estimates compute goodness--fit statistics model. main options speed modelsummary : Set gof_map=NA avoid computing expensive goodness--fit statistics. Use easystats extractor functions metrics argument avoid computing expensive statistics (see example). Use parallel computation summarizing multiple models. See “Parallel computation” section ?modelsummary documentation. diagnose slowdown find bottleneck, can try benchmark various extractor functions: experience, main bottleneck tends computing goodness--fit statistics. performance extractor allows users specify metrics argument select subset GOF include. Using can speedup things considerably. call modelsummary metrics argument:","code":"library(tictoc) data(trade) mod <- lm(mpg ~ hp + drat, mtcars) tic(\"tidy\") x <- broom::tidy(mod) toc() #> tidy: 0.003 sec elapsed tic(\"glance\") x <- broom::glance(mod) toc() #> glance: 0.005 sec elapsed tic(\"parameters\") x <- parameters::parameters(mod) toc() #> parameters: 0.027 sec elapsed tic(\"performance\") x <- performance::performance(mod) toc() #> performance: 0.014 sec elapsed modelsummary(mod, metrics = \"rmse\")"},{"path":"https://vincentarelbundock.github.io/modelsummary/dev/articles/modelsummary.html","id":"escaped-latex-characters","dir":"Articles","previous_headings":"FAQ","what":"Escaped LaTeX characters","title":"modelsummary: regression tables","text":"Sometimes, users want include raw LaTeX commands tables, coefficient names including math mode: Apple $\\times$ Orange. result attempts often weird string : \\$\\textbackslash{}times\\$ instead proper LaTeX-rendered characters. source problem kableExtra, default table-making package modelsummary, automatically escapes weird characters make sure tables compile properly LaTeX. avoid , need pass escape=FALSE modelsummary:","code":"modelsummary(mod, escape = FALSE)"},{"path":"https://vincentarelbundock.github.io/modelsummary/dev/articles/modelsummary.html","id":"bayesian-models","dir":"Articles","previous_headings":"FAQ","what":"Bayesian models","title":"modelsummary: regression tables","text":"Many bayesian models supported ---box, including produced rstanarm brms packages. statistics available bayesian models slightly different available frequentist models. Users can call get_estimates see available: shows std.error column, mad statistic (mean absolute deviation). can : noted modelsummary() documentation, model results extracted using parameters package. Users can pass additional arguments modelsummary(), push forward arguments parameters::parameters function change results. example, parameters documentation bayesian models shows centrality argument, allows users report mean standard deviation posterior distribution, instead median MAD: can also get additional test statistics using test argument:","code":"library(rstanarm) #> This is rstanarm version 2.21.4 #> - See https://mc-stan.org/rstanarm/articles/priors for changes to default priors! #> - Default priors may change, so it's safest to specify priors, even if equivalent to the defaults. #> - For execution on a local, multicore CPU with excess RAM we recommend calling #> options(mc.cores = parallel::detectCores()) #> #> Attaching package: 'rstanarm' #> The following object is masked from 'package:fixest': #> #> se mod <- stan_glm(am ~ hp + drat, data = mtcars) get_estimates(mod) #> term estimate mad conf.level conf.low conf.high #> 1 (Intercept) -2.223229224 0.586274128 0.95 -3.396758381 -1.037911267 #> 2 hp 0.000693693 0.001026168 0.95 -0.001395935 0.002758334 #> 3 drat 0.704419925 0.137470457 0.95 0.418757325 0.973648848 #> prior.distribution prior.location prior.scale group std.error statistic #> 1 normal 0.40625 1.24747729 NA NA #> 2 normal 0.00000 0.01819465 NA NA #> 3 normal 0.00000 2.33313429 NA NA #> p.value #> 1 NA #> 2 NA #> 3 NA modelsummary(mod, statistic = \"mad\") #> Warning: #> `modelsummary` uses the `performance` package to extract goodness-of-fit #> statistics from models of this class. You can specify the statistics you wish #> to compute by supplying a `metrics` argument to `modelsummary`, which will then #> push it forward to `performance`. Acceptable values are: \"all\", \"common\", #> \"none\", or a character vector of metrics names. For example: `modelsummary(mod, #> metrics = c(\"RMSE\", \"R2\")` Note that some metrics are computationally #> expensive. See `?performance::performance` for details. #> This warning appears once per session. get_estimates(mod, centrality = \"mean\") #> term estimate std.dev conf.level conf.low conf.high #> 1 (Intercept) -2.22176959 0.598245552 0.95 -3.396758381 -1.037911267 #> 2 hp 0.00067889 0.001066856 0.95 -0.001395935 0.002758334 #> 3 drat 0.70297473 0.141032549 0.95 0.418757325 0.973648848 #> prior.distribution prior.location prior.scale group std.error statistic #> 1 normal 0.40625 1.24747729 NA NA #> 2 normal 0.00000 0.01819465 NA NA #> 3 normal 0.00000 2.33313429 NA NA #> p.value #> 1 NA #> 2 NA #> 3 NA modelsummary(mod, statistic = \"std.dev\", centrality = \"mean\") get_estimates(mod, test = c(\"pd\", \"rope\")) #> term estimate mad conf.level conf.low conf.high #> 1 (Intercept) -2.223229224 0.586274128 0.95 -3.396758381 -1.037911267 #> 2 hp 0.000693693 0.001026168 0.95 -0.001395935 0.002758334 #> 3 drat 0.704419925 0.137470457 0.95 0.418757325 0.973648848 #> pd rope.percentage prior.distribution prior.location prior.scale group #> 1 0.9995 0 normal 0.40625 1.24747729 #> 2 0.7460 1 normal 0.00000 0.01819465 #> 3 1.0000 0 normal 0.00000 2.33313429 #> std.error statistic p.value #> 1 NA NA NA #> 2 NA NA NA #> 3 NA NA NA"},{"path":"https://vincentarelbundock.github.io/modelsummary/dev/authors.html","id":null,"dir":"","previous_headings":"","what":"Authors","title":"Authors and Citation","text":"Vincent Arel-Bundock. Author, maintainer. Joachim Gassen. Contributor. Nathan Eastwood. Contributor. Nick Huntington-Klein. Contributor. Moritz Schwarz. Contributor. Benjamin Elbers. Contributor. 0000-0001-5392-3448 Grant McDermott. Contributor. Lukas Wallrich. Contributor.","code":""},{"path":"https://vincentarelbundock.github.io/modelsummary/dev/authors.html","id":"citation","dir":"","previous_headings":"","what":"Citation","title":"Authors and Citation","text":"Arel-Bundock V (2022). “modelsummary: Data Model Summaries R.” Journal Statistical Software, 103(1), 1–23. doi:10.18637/jss.v103.i01.","code":"@Article{, title = {{modelsummary}: Data and Model Summaries in {R}}, author = {Vincent Arel-Bundock}, journal = {Journal of Statistical Software}, year = {2022}, volume = {103}, number = {1}, pages = {1--23}, doi = {10.18637/jss.v103.i01}, }"},{"path":"https://vincentarelbundock.github.io/modelsummary/dev/index.html","id":"modelsummary-","dir":"","previous_headings":"","what":"Summary Tables and Plots for Statistical Models and Data: Beautiful, Customizable, and Publication-Ready ","title":"Summary Tables and Plots for Statistical Models and Data: Beautiful, Customizable, and Publication-Ready ","text":"modelsummary creates tables plots present descriptive statistics summarize statistical models R. modelsummary package summarize data statistical models R. supports one hundred types models ---box, allows users report results models side--side table, coefficient plots. makes easy execute common tasks computing robust standard errors, adding significance stars, manipulating coefficient model labels. Beyond model summaries, package also includes suite tools produce highly flexible data summary tables, dataset overviews, correlation matrices, (multi-level) cross-tabulations, balance tables (also known “Table 1”). appearance tables produced modelsummary can customized using external packages kableExtra, gt, flextable, huxtable; plots can customized using ggplot2. Tables can exported many output formats, including HTML, LaTeX, Text/Markdown, Microsoft Word, Powerpoint, Excel, RTF, PDF, image files. Tables plots can embedded seamlessly rmarkdown, knitr, Sweave dynamic documents. modelsummary package designed simple, robust, modular, extensible (Arel-Bundock, 2022). modelsummary includes two families functions: modelsummary: Regression tables side--side models. modelplot: Coefficient plots. datasummary: Powerful tool create (multi-level) cross-tabs data summaries. datasummary_crosstab: Cross-tabulations. datasummary_balance: Balance tables subgroup statistics difference means (aka “Table 1”). datasummary_correlation: Correlation tables. datasummary_skim: Quick overview (“skim”) dataset. datasummary_df: Turn dataframes nice tables titles, notes, etc. functions, can create tables plots like :","code":""},{"path":"https://vincentarelbundock.github.io/modelsummary/dev/index.html","id":"table-of-contents","dir":"","previous_headings":"","what":"Table of contents","title":"Summary Tables and Plots for Statistical Models and Data: Beautiful, Customizable, and Publication-Ready ","text":"modelsummary website hosts ton examples. Make sure click links top page: https://vincentarelbundock.github.io/modelsummary use modelsummary? Installation Getting started Alternative packages modelsummary: Model summaries modelplot: Model plots datasummary: Data summaries Customizing look tables","code":""},{"path":"https://vincentarelbundock.github.io/modelsummary/dev/index.html","id":"why-should-i-use-modelsummary","dir":"","previous_headings":"","what":"Why should I use modelsummary?","title":"Summary Tables and Plots for Statistical Models and Data: Beautiful, Customizable, and Publication-Ready ","text":"benefits modelsummary alternative packages:","code":""},{"path":"https://vincentarelbundock.github.io/modelsummary/dev/index.html","id":"easy","dir":"","previous_headings":"Why should I use modelsummary?","what":"Easy","title":"Summary Tables and Plots for Statistical Models and Data: Beautiful, Customizable, and Publication-Ready ","text":"modelsummary easy use. simple call often suffices: command automatically display summary table Rstudio Viewer web browser. need one word change output format. example, text-version table can printed Console typing: Tables Microsoft Word LaTeX formats can saved file typing:","code":"library(modelsummary) mod <- lm(y ~ x, dat) modelsummary(mod) modelsummary(mod, output = \"markdown\") modelsummary(mod, output = \"table.docx\") modelsummary(mod, output = \"table.tex\")"},{"path":"https://vincentarelbundock.github.io/modelsummary/dev/index.html","id":"flexible","dir":"","previous_headings":"Why should I use modelsummary?","what":"Flexible","title":"Summary Tables and Plots for Statistical Models and Data: Beautiful, Customizable, and Publication-Ready ","text":"Information: package offers many intuitive powerful utilities customize information reported summary table. can rename, reorder, subset omit parameter estimates; choose set goodness--fit statistics include; display various “robust” standard errors confidence intervals; add titles, footnotes, source notes; insert stars custom characters indicate levels statistical significance; add rows supplemental information models. Appearance: Thanks gt, kableExtra, huxtable, flextable, DT packages, appearance modelsummary tables endlessly customizable. appearance customization page shows tables colored cells, weird text, spanning column labels, row groups, titles, source notes, footnotes, significance stars, . scratches surface possibilities. Supported models: Thanks broom parameters, modelsummary supports hundreds statistical models ---box. Installing packages can extend capabilities (e.g., broom.mixed). also easy add customize models. Output formats: modelsummary tables can saved HTML, LaTeX, Text/Markdown, Microsoft Word, Powerpoint, RTF, JPG, PNG formats. can also inserted seamlessly Rmarkdown documents produce automated documents reports PDF, HTML, RTF, Microsoft Word formats.","code":""},{"path":"https://vincentarelbundock.github.io/modelsummary/dev/index.html","id":"dangerous","dir":"","previous_headings":"Why should I use modelsummary?","what":"Dangerous","title":"Summary Tables and Plots for Statistical Models and Data: Beautiful, Customizable, and Publication-Ready ","text":"modelsummary dangerous! allows users stupid stuff like replacing intercepts squirrels.","code":""},{"path":"https://vincentarelbundock.github.io/modelsummary/dev/index.html","id":"reliable","dir":"","previous_headings":"Why should I use modelsummary?","what":"Reliable","title":"Summary Tables and Plots for Statistical Models and Data: Beautiful, Customizable, and Publication-Ready ","text":"modelsummary reliably dangerous! package developed using suite unit tests 95% coverage, (probably) won’t break.","code":""},{"path":"https://vincentarelbundock.github.io/modelsummary/dev/index.html","id":"community","dir":"","previous_headings":"Why should I use modelsummary?","what":"Community","title":"Summary Tables and Plots for Statistical Models and Data: Beautiful, Customizable, and Publication-Ready ","text":"modelsummary try everything. Instead, leverages incredible work R community. building top broom parameters packages, modelsummary already supports hundreds model types ---box. modelsummary also supports five popular table-building customization packages: gt, kableExtra, huxtable, flextable, DT packages. using packages, modelsummary allows users produce beautiful, endlessly customizable tables wide variety formats, including HTML, PDF, LaTeX, Markdown, MS Word. One benefit community-focused approach external packages improve, modelsummary improves well. Another benefit leveraging external packages allows modelsummary massively simplified codebase (relative similar packages). improve long term code maintainability, allow contributors participate GitHub.","code":""},{"path":"https://vincentarelbundock.github.io/modelsummary/dev/index.html","id":"installation","dir":"","previous_headings":"","what":"Installation","title":"Summary Tables and Plots for Statistical Models and Data: Beautiful, Customizable, and Publication-Ready ","text":"can install modelsummary CRAN: can install development version modelsummary (dependency insight) R-Universe: Restart R completely moving .","code":"install.packages('modelsummary') install.packages( c(\"modelsummary\", \"insight\", \"performance\", \"parameters\"), repos = c( \"https://vincentarelbundock.r-universe.dev\", \"https://easystats.r-universe.dev\"))"},{"path":"https://vincentarelbundock.github.io/modelsummary/dev/index.html","id":"getting-started","dir":"","previous_headings":"","what":"Getting started","title":"Summary Tables and Plots for Statistical Models and Data: Beautiful, Customizable, and Publication-Ready ","text":"million ways customize tables plots produced modelsummary. Getting Started section scratch surface. details, see vignettes: modelsummary: https://vincentarelbundock.github.io/modelsummary/articles/modelsummary.html modelplot: https://vincentarelbundock.github.io/modelsummary/articles/modelplot.html datasummary: https://vincentarelbundock.github.io/modelsummary/articles/datasummary.html Appearance: https://vincentarelbundock.github.io/modelsummary/articles/appearance.html begin, load modelsummary package download data Rdatasets archive: Quick overview data: Balance table (aka “Table 1”) differences means subgroups: Correlation table: Two variables two statistics, nested subgroups: Estimate linear model display results: Estimate five regression models, display results side--side, save Microsoft Word document:","code":"library(modelsummary) url <- 'https://vincentarelbundock.github.io/Rdatasets/csv/HistData/Guerry.csv' dat <- read.csv(url) dat$Small <- dat$Pop1831 > median(dat$Pop1831) datasummary_skim(dat) datasummary_balance(~Small, dat) datasummary_correlation(dat) datasummary(Literacy + Commerce ~ Small * (mean + sd), dat) mod <- lm(Donations ~ Crime_prop, data = dat) modelsummary(mod) models <- list( \"OLS 1\" = lm(Donations ~ Literacy + Clergy, data = dat), \"Poisson 1\" = glm(Donations ~ Literacy + Commerce, family = poisson, data = dat), \"OLS 2\" = lm(Crime_pers ~ Literacy + Clergy, data = dat), \"Poisson 2\" = glm(Crime_pers ~ Literacy + Commerce, family = poisson, data = dat), \"OLS 3\" = lm(Crime_prop ~ Literacy + Clergy, data = dat) ) modelsummary(models, output = \"table.docx\")"},{"path":"https://vincentarelbundock.github.io/modelsummary/dev/index.html","id":"alternative-packages","dir":"","previous_headings":"","what":"Alternative packages","title":"Summary Tables and Plots for Statistical Models and Data: Beautiful, Customizable, and Publication-Ready ","text":"several excellent alternatives draw model summary tables R: sjPlot gtsummary texreg stargazer apsrtable huxtable janitor","code":""},{"path":"https://vincentarelbundock.github.io/modelsummary/dev/reference/All.html","id":null,"dir":"Reference","previous_headings":"","what":"Include all columns of a dataframe. — All","title":"Include all columns of a dataframe. — All","text":"objects imported packages. Follow links see documentation. tables ","code":""},{"path":"https://vincentarelbundock.github.io/modelsummary/dev/reference/AllObs.html","id":null,"dir":"Reference","previous_headings":"","what":"Display all observations in a table. — AllObs","title":"Display all observations in a table. — AllObs","text":"objects imported packages. Follow links see documentation. tables AllObs","code":""},{"path":"https://vincentarelbundock.github.io/modelsummary/dev/reference/Arguments.html","id":null,"dir":"Reference","previous_headings":"","what":"'Arguments' pseudo-function — Arguments","title":"'Arguments' pseudo-function — Arguments","text":"objects imported packages. Follow links see documentation. tables Arguments","code":""},{"path":"https://vincentarelbundock.github.io/modelsummary/dev/reference/DropEmpty.html","id":null,"dir":"Reference","previous_headings":"","what":"'DropEmpty' pseudo-function — DropEmpty","title":"'DropEmpty' pseudo-function — DropEmpty","text":"objects imported packages. Follow links see documentation. tables DropEmpty","code":""},{"path":"https://vincentarelbundock.github.io/modelsummary/dev/reference/Factor.html","id":null,"dir":"Reference","previous_headings":"","what":"Use a variable as a factor to give rows in a table. — Factor","title":"Use a variable as a factor to give rows in a table. — Factor","text":"objects imported packages. Follow links see documentation. tables Factor","code":""},{"path":"https://vincentarelbundock.github.io/modelsummary/dev/reference/Format.html","id":null,"dir":"Reference","previous_headings":"","what":"Use a variable as a factor to give rows in a table. — Format","title":"Use a variable as a factor to give rows in a table. — Format","text":"objects imported packages. Follow links see documentation. tables Format","code":""},{"path":"https://vincentarelbundock.github.io/modelsummary/dev/reference/Heading.html","id":null,"dir":"Reference","previous_headings":"","what":"'Heading' pseudo-function — Heading","title":"'Heading' pseudo-function — Heading","text":"objects imported packages. Follow links see documentation. tables Heading","code":""},{"path":"https://vincentarelbundock.github.io/modelsummary/dev/reference/Histogram.html","id":null,"dir":"Reference","previous_headings":"","what":"datasummary statistic shortcut — Histogram","title":"datasummary statistic shortcut — Histogram","text":"function uses Unicode characters create histogram. can sometimes useful, generally discouraged. Unicode characters can display limited number heights bars, accuracy output highly dependent platform (typeface, output type, windows vs. mac, etc.). recommend use kableExtra::spec_hist function instead.","code":""},{"path":"https://vincentarelbundock.github.io/modelsummary/dev/reference/Histogram.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"datasummary statistic shortcut — Histogram","text":"","code":"Histogram(x, bins = 10)"},{"path":"https://vincentarelbundock.github.io/modelsummary/dev/reference/Histogram.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"datasummary statistic shortcut — Histogram","text":"x variable summarize bins number histogram bars","code":""},{"path":"https://vincentarelbundock.github.io/modelsummary/dev/reference/Max.html","id":null,"dir":"Reference","previous_headings":"","what":"datasummary statistic shortcut — Max","title":"datasummary statistic shortcut — Max","text":"datasummary statistic shortcut","code":""},{"path":"https://vincentarelbundock.github.io/modelsummary/dev/reference/Max.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"datasummary statistic shortcut — Max","text":"","code":"Max(x, fmt = NULL, na.rm = TRUE, ...)"},{"path":"https://vincentarelbundock.github.io/modelsummary/dev/reference/Max.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"datasummary statistic shortcut — Max","text":"x variable summarize fmt passed modelsummary:::rounding function na.rm logical value indicating whether ‘NA’ values stripped computation proceeds. ... unused","code":""},{"path":"https://vincentarelbundock.github.io/modelsummary/dev/reference/Max.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"datasummary statistic shortcut — Max","text":"","code":"if (identical(Sys.getenv(\"pkgdown\"), \"true\")) { datasummary(mpg + hp ~ Mean + Median + P0 + P25 + P50 + P75 + P100 + Min + Max + SD + Var, data = mtcars) } #> #> #> #> <\/th> #> | Mean <\/th> #> | Median <\/th> #> | P0 <\/th> #> | P25 <\/th> #> | P50 <\/th> #> | P75 <\/th> #> | P100 <\/th> #> | Min <\/th> #> | Max <\/th> #> | SD <\/th> #> | Var <\/th> #> <\/tr> #> <\/thead> #> | #> #> mpg <\/td> #> | 20.09 <\/td> #> | 19.20 <\/td> #> | 10.40 <\/td> #> | 15.43 <\/td> #> | 19.20 <\/td> #> | 22.80 <\/td> #> | 33.90 <\/td> #> | 10.40 <\/td> #> | 33.90 <\/td> #> | 6.03 <\/td> #> | 36.32 <\/td> #> <\/tr> #> | #> hp <\/td> #> | 146.69 <\/td> #> | 123.00 <\/td> #> | 52.00 <\/td> #> | 96.50 <\/td> #> | 123.00 <\/td> #> | 180.00 <\/td> #> | 335.00 <\/td> #> | 52.00 <\/td> #> | 335.00 <\/td> #> | 68.56 <\/td> #> | 4700.87 <\/td> #> <\/tr> #> <\/tbody> #> <\/table>"},{"path":"https://vincentarelbundock.github.io/modelsummary/dev/reference/Mean.html","id":null,"dir":"Reference","previous_headings":"","what":"datasummary statistic shortcut — Mean","title":"datasummary statistic shortcut — Mean","text":"datasummary statistic shortcut","code":""},{"path":"https://vincentarelbundock.github.io/modelsummary/dev/reference/Mean.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"datasummary statistic shortcut — Mean","text":"","code":"Mean(x, fmt = NULL, na.rm = TRUE, ...)"},{"path":"https://vincentarelbundock.github.io/modelsummary/dev/reference/Mean.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"datasummary statistic shortcut — Mean","text":"x variable summarize fmt passed modelsummary:::rounding function na.rm logical value indicating whether ‘NA’ values stripped computation proceeds. ... unused","code":""},{"path":"https://vincentarelbundock.github.io/modelsummary/dev/reference/Mean.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"datasummary statistic shortcut — Mean","text":"","code":"if (identical(Sys.getenv(\"pkgdown\"), \"true\")) { datasummary(mpg + hp ~ Mean + P0 + P25 + P50 + P75 + P100 + Min + Max + SD + Var, data = mtcars) } #> #> #> #> <\/th> #> | Mean <\/th> #> | P0 <\/th> #> | P25 <\/th> #> | P50 <\/th> #> | P75 <\/th> #> | P100 <\/th> #> | Min <\/th> #> | Max <\/th> #> | SD <\/th> #> | Var <\/th> #> <\/tr> #> <\/thead> #> | #> #> mpg <\/td> #> | 20.09 <\/td> #> | 10.40 <\/td> #> | 15.43 <\/td> #> | 19.20 <\/td> #> | 22.80 <\/td> #> | 33.90 <\/td> #> | 10.40 <\/td> #> | 33.90 <\/td> #> | 6.03 <\/td> #> | 36.32 <\/td> #> <\/tr> #> | #> hp <\/td> #> | 146.69 <\/td> #> | 52.00 <\/td> #> | 96.50 <\/td> #> | 123.00 <\/td> #> | 180.00 <\/td> #> | 335.00 <\/td> #> | 52.00 <\/td> #> | 335.00 <\/td> #> | 68.56 <\/td> #> | 4700.87 <\/td> #> <\/tr> #> <\/tbody> #> <\/table>"},{"path":"https://vincentarelbundock.github.io/modelsummary/dev/reference/Median.html","id":null,"dir":"Reference","previous_headings":"","what":"datasummary statistic shortcut — Median","title":"datasummary statistic shortcut — Median","text":"datasummary statistic shortcut","code":""},{"path":"https://vincentarelbundock.github.io/modelsummary/dev/reference/Median.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"datasummary statistic shortcut — Median","text":"","code":"Median(x, fmt = NULL, na.rm = TRUE, ...)"},{"path":"https://vincentarelbundock.github.io/modelsummary/dev/reference/Median.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"datasummary statistic shortcut — Median","text":"x variable summarize fmt passed modelsummary:::rounding function na.rm logical value indicating whether ‘NA’ values stripped computation proceeds. ... unused","code":""},{"path":"https://vincentarelbundock.github.io/modelsummary/dev/reference/Median.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"datasummary statistic shortcut — Median","text":"","code":"if (identical(Sys.getenv(\"pkgdown\"), \"true\")) { datasummary(mpg + hp ~ Mean + Median + P0 + P25 + P50 + P75 + P100 + Min + Max + SD + Var, data = mtcars) } #> #> #> #> <\/th> #> | Mean <\/th> #> | Median <\/th> #> | P0 <\/th> #> | P25 <\/th> #> | P50 <\/th> #> | P75 <\/th> #> | P100 <\/th> #> | Min <\/th> #> | Max <\/th> #> | SD <\/th> #> | Var <\/th> #> <\/tr> #> <\/thead> #> | #> #> mpg <\/td> #> | 20.09 <\/td> #> | 19.20 <\/td> #> | 10.40 <\/td> #> | 15.43 <\/td> #> | 19.20 <\/td> #> | 22.80 <\/td> #> | 33.90 <\/td> #> | 10.40 <\/td> #> | 33.90 <\/td> #> | 6.03 <\/td> #> | 36.32 <\/td> #> <\/tr> #> | #> hp <\/td> #> | 146.69 <\/td> #> | 123.00 <\/td> #> | 52.00 <\/td> #> | 96.50 <\/td> #> | 123.00 <\/td> #> | 180.00 <\/td> #> | 335.00 <\/td> #> | 52.00 <\/td> #> | 335.00 <\/td> #> | 68.56 <\/td> #> | 4700.87 <\/td> #> <\/tr> #> <\/tbody> #> <\/table>"},{"path":"https://vincentarelbundock.github.io/modelsummary/dev/reference/Min.html","id":null,"dir":"Reference","previous_headings":"","what":"datasummary statistic shortcut — Min","title":"datasummary statistic shortcut — Min","text":"datasummary statistic shortcut","code":""},{"path":"https://vincentarelbundock.github.io/modelsummary/dev/reference/Min.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"datasummary statistic shortcut — Min","text":"","code":"Min(x, fmt = NULL, na.rm = TRUE, ...)"},{"path":"https://vincentarelbundock.github.io/modelsummary/dev/reference/Min.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"datasummary statistic shortcut — Min","text":"x variable summarize fmt passed modelsummary:::rounding function na.rm logical value indicating whether ‘NA’ values stripped computation proceeds. ... unused","code":""},{"path":"https://vincentarelbundock.github.io/modelsummary/dev/reference/Min.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"datasummary statistic shortcut — Min","text":"","code":"if (identical(Sys.getenv(\"pkgdown\"), \"true\")) { datasummary(mpg + hp ~ Mean + Median + P0 + P25 + P50 + P75 + P100 + Min + Max + SD + Var, data = mtcars) } #> #> #> #> <\/th> #> | Mean <\/th> #> | Median <\/th> #> | P0 <\/th> #> | P25 <\/th> #> | P50 <\/th> #> | P75 <\/th> #> | P100 <\/th> #> | Min <\/th> #> | Max <\/th> #> | SD <\/th> #> | Var <\/th> #> <\/tr> #> <\/thead> #> | #> #> mpg <\/td> #> | 20.09 <\/td> #> | 19.20 <\/td> #> | 10.40 <\/td> #> | 15.43 <\/td> #> | 19.20 <\/td> #> | 22.80 <\/td> #> | 33.90 <\/td> #> | 10.40 <\/td> #> | 33.90 <\/td> #> | 6.03 <\/td> #> | 36.32 <\/td> #> <\/tr> #> | #> hp <\/td> #> | 146.69 <\/td> #> | 123.00 <\/td> #> | 52.00 <\/td> #> | 96.50 <\/td> #> | 123.00 <\/td> #> | 180.00 <\/td> #> | 335.00 <\/td> #> | 52.00 <\/td> #> | 335.00 <\/td> #> | 68.56 <\/td> #> | 4700.87 <\/td> #> <\/tr> #> <\/tbody> #> <\/table>"},{"path":"https://vincentarelbundock.github.io/modelsummary/dev/reference/Multicolumn.html","id":null,"dir":"Reference","previous_headings":"","what":"Use a variable as a factor to give rows in a table. — Multicolumn","title":"Use a variable as a factor to give rows in a table. — Multicolumn","text":"objects imported packages. Follow links see documentation. tables Multicolumn","code":""},{"path":"https://vincentarelbundock.github.io/modelsummary/dev/reference/N.html","id":null,"dir":"Reference","previous_headings":"","what":"datasummary statistic shortcut — N","title":"datasummary statistic shortcut — N","text":"datasummary statistic shortcut","code":""},{"path":"https://vincentarelbundock.github.io/modelsummary/dev/reference/N.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"datasummary statistic shortcut — N","text":"","code":"N(x)"},{"path":"https://vincentarelbundock.github.io/modelsummary/dev/reference/N.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"datasummary statistic shortcut — N","text":"x variable summarize","code":""},{"path":"https://vincentarelbundock.github.io/modelsummary/dev/reference/N.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"datasummary statistic shortcut — N","text":"","code":"if (identical(Sys.getenv(\"pkgdown\"), \"true\")) { datasummary(Factor(cyl) ~ N, data = mtcars) } #> #> #> #> cyl <\/th> #> | N <\/th> #> <\/tr> #> <\/thead> #> | #> #> 4 <\/td> #> | 11 <\/td> #> <\/tr> #> | #> 6 <\/td> #> | 7 <\/td> #> <\/tr> #> | #> 8 <\/td> #> | 14 <\/td> #> <\/tr> #> <\/tbody> #> <\/table>"},{"path":"https://vincentarelbundock.github.io/modelsummary/dev/reference/NPercent.html","id":null,"dir":"Reference","previous_headings":"","what":"datasummary statistic shortcut — NPercent","title":"datasummary statistic shortcut — NPercent","text":"datasummary statistic shortcut","code":""},{"path":"https://vincentarelbundock.github.io/modelsummary/dev/reference/NPercent.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"datasummary statistic shortcut — NPercent","text":"","code":"NPercent(x, y)"},{"path":"https://vincentarelbundock.github.io/modelsummary/dev/reference/NPercent.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"datasummary statistic shortcut — NPercent","text":"x variable summarize y denominator variable","code":""},{"path":"https://vincentarelbundock.github.io/modelsummary/dev/reference/NUnique.html","id":null,"dir":"Reference","previous_headings":"","what":"datasummary statistic shortcut — NUnique","title":"datasummary statistic shortcut — NUnique","text":"datasummary statistic shortcut","code":""},{"path":"https://vincentarelbundock.github.io/modelsummary/dev/reference/NUnique.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"datasummary statistic shortcut — NUnique","text":"","code":"NUnique(x, ...)"},{"path":"https://vincentarelbundock.github.io/modelsummary/dev/reference/NUnique.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"datasummary statistic shortcut — NUnique","text":"x variable summarize ... unused","code":""},{"path":"https://vincentarelbundock.github.io/modelsummary/dev/reference/NUnique.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"datasummary statistic shortcut — NUnique","text":"","code":"if (identical(Sys.getenv(\"pkgdown\"), \"true\")) { datasummary(cyl + hp ~ NUnique, data = mtcars) } #> #> #> #> <\/th> #> | NUnique <\/th> #> <\/tr> #> <\/thead> #> | #> #> cyl <\/td> #> | 3 <\/td> #> <\/tr> #> | #> hp <\/td> #> | 22 <\/td> #> <\/tr> #> <\/tbody> #> <\/table>"},{"path":"https://vincentarelbundock.github.io/modelsummary/dev/reference/Ncol.html","id":null,"dir":"Reference","previous_headings":"","what":"datasummary statistic shortcut — Ncol","title":"datasummary statistic shortcut — Ncol","text":"datasummary statistic shortcut","code":""},{"path":"https://vincentarelbundock.github.io/modelsummary/dev/reference/Ncol.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"datasummary statistic shortcut — Ncol","text":"","code":"Ncol(x, ...)"},{"path":"https://vincentarelbundock.github.io/modelsummary/dev/reference/Ncol.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"datasummary statistic shortcut — Ncol","text":"x variable summarize ... unused","code":""},{"path":"https://vincentarelbundock.github.io/modelsummary/dev/reference/P0.html","id":null,"dir":"Reference","previous_headings":"","what":"datasummary statistic shortcut — P0","title":"datasummary statistic shortcut — P0","text":"datasummary statistic shortcut","code":""},{"path":"https://vincentarelbundock.github.io/modelsummary/dev/reference/P0.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"datasummary statistic shortcut — P0","text":"","code":"P0(x, fmt = NULL, na.rm = TRUE, ...)"},{"path":"https://vincentarelbundock.github.io/modelsummary/dev/reference/P0.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"datasummary statistic shortcut — P0","text":"x variable summarize fmt passed modelsummary:::rounding function na.rm logical value indicating whether ‘NA’ values stripped computation proceeds. ... unused","code":""},{"path":"https://vincentarelbundock.github.io/modelsummary/dev/reference/P0.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"datasummary statistic shortcut — P0","text":"","code":"if (identical(Sys.getenv(\"pkgdown\"), \"true\")) { datasummary(mpg + hp ~ Mean + Median + P0 + P25 + P50 + P75 + P100 + Min + Max + SD + Var, data = mtcars) } #> #> #> #> <\/th> #> | Mean <\/th> #> | Median <\/th> #> | P0 <\/th> #> | P25 <\/th> #> | P50 <\/th> #> | P75 <\/th> #> | P100 <\/th> #> | Min <\/th> #> | Max <\/th> #> | SD <\/th> #> | Var <\/th> #> <\/tr> #> <\/thead> #> | #> #> mpg <\/td> #> | 20.09 <\/td> #> | 19.20 <\/td> #> | 10.40 <\/td> #> | 15.43 <\/td> #> | 19.20 <\/td> #> | 22.80 <\/td> #> | 33.90 <\/td> #> | 10.40 <\/td> #> | 33.90 <\/td> #> | 6.03 <\/td> #> | 36.32 <\/td> #> <\/tr> #> | #> hp <\/td> #> | 146.69 <\/td> #> | 123.00 <\/td> #> | 52.00 <\/td> #> | 96.50 <\/td> #> | 123.00 <\/td> #> | 180.00 <\/td> #> | 335.00 <\/td> #> | 52.00 <\/td> #> | 335.00 <\/td> #> | 68.56 <\/td> #> | 4700.87 <\/td> #> <\/tr> #> <\/tbody> #> <\/table>"},{"path":"https://vincentarelbundock.github.io/modelsummary/dev/reference/P100.html","id":null,"dir":"Reference","previous_headings":"","what":"datasummary statistic shortcut — P100","title":"datasummary statistic shortcut — P100","text":"datasummary statistic shortcut","code":""},{"path":"https://vincentarelbundock.github.io/modelsummary/dev/reference/P100.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"datasummary statistic shortcut — P100","text":"","code":"P100(x, fmt = NULL, na.rm = TRUE, ...)"},{"path":"https://vincentarelbundock.github.io/modelsummary/dev/reference/P100.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"datasummary statistic shortcut — P100","text":"x variable summarize fmt passed modelsummary:::rounding function na.rm logical value indicating whether ‘NA’ values stripped computation proceeds. ... unused","code":""},{"path":"https://vincentarelbundock.github.io/modelsummary/dev/reference/P100.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"datasummary statistic shortcut — P100","text":"","code":"if (identical(Sys.getenv(\"pkgdown\"), \"true\")) { datasummary(mpg + hp ~ Mean + Median + P0 + P25 + P50 + P75 + P100 + Min + Max + SD + Var, data = mtcars) } #> #> #> #> <\/th> #> | Mean <\/th> #> | Median <\/th> #> | P0 <\/th> #> | P25 <\/th> #> | P50 <\/th> #> | P75 <\/th> #> | P100 <\/th> #> | Min <\/th> #> | Max <\/th> #> | SD <\/th> #> | Var <\/th> #> <\/tr> #> <\/thead> #> | #> #> mpg <\/td> #> | 20.09 <\/td> #> | 19.20 <\/td> #> | 10.40 <\/td> #> | 15.43 <\/td> #> | 19.20 <\/td> #> | 22.80 <\/td> #> | 33.90 <\/td> #> | 10.40 <\/td> #> | 33.90 <\/td> #> | 6.03 <\/td> #> | 36.32 <\/td> #> <\/tr> #> | #> hp <\/td> #> | 146.69 <\/td> #> | 123.00 <\/td> #> | 52.00 <\/td> #> | 96.50 <\/td> #> | 123.00 <\/td> #> | 180.00 <\/td> #> | 335.00 <\/td> #> | 52.00 <\/td> #> | 335.00 <\/td> #> | 68.56 <\/td> #> | 4700.87 <\/td> #> <\/tr> #> <\/tbody> #> <\/table>"},{"path":"https://vincentarelbundock.github.io/modelsummary/dev/reference/P25.html","id":null,"dir":"Reference","previous_headings":"","what":"datasummary statistic shortcut — P25","title":"datasummary statistic shortcut — P25","text":"datasummary statistic shortcut","code":""},{"path":"https://vincentarelbundock.github.io/modelsummary/dev/reference/P25.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"datasummary statistic shortcut — P25","text":"","code":"P25(x, fmt = NULL, na.rm = TRUE, ...)"},{"path":"https://vincentarelbundock.github.io/modelsummary/dev/reference/P25.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"datasummary statistic shortcut — P25","text":"x variable summarize fmt passed modelsummary:::rounding function na.rm logical value indicating whether ‘NA’ values stripped computation proceeds. ... unused","code":""},{"path":"https://vincentarelbundock.github.io/modelsummary/dev/reference/P25.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"datasummary statistic shortcut — P25","text":"","code":"if (identical(Sys.getenv(\"pkgdown\"), \"true\")) { datasummary(mpg + hp ~ Mean + Median + P0 + P25 + P50 + P75 + P100 + Min + Max + SD + Var, data = mtcars) } #> #> #> #> <\/th> #> | Mean <\/th> #> | Median <\/th> #> | P0 <\/th> #> | P25 <\/th> #> | P50 <\/th> #> | P75 <\/th> #> | P100 <\/th> #> | Min <\/th> #> | Max <\/th> #> | SD <\/th> #> | Var <\/th> #> <\/tr> #> <\/thead> #> | #> #> mpg <\/td> #> | 20.09 <\/td> #> | 19.20 <\/td> #> | 10.40 <\/td> #> | 15.43 <\/td> #> | 19.20 <\/td> #> | 22.80 <\/td> #> | 33.90 <\/td> #> | 10.40 <\/td> #> | 33.90 <\/td> #> | 6.03 <\/td> #> | 36.32 <\/td> #> <\/tr> #> | #> hp <\/td> #> | 146.69 <\/td> #> | 123.00 <\/td> #> | 52.00 <\/td> #> | 96.50 <\/td> #> | 123.00 <\/td> #> | 180.00 <\/td> #> | 335.00 <\/td> #> | 52.00 <\/td> #> | 335.00 <\/td> #> | 68.56 <\/td> #> | 4700.87 <\/td> #> <\/tr> #> <\/tbody> #> <\/table>"},{"path":"https://vincentarelbundock.github.io/modelsummary/dev/reference/P50.html","id":null,"dir":"Reference","previous_headings":"","what":"datasummary statistic shortcut — P50","title":"datasummary statistic shortcut — P50","text":"datasummary statistic shortcut","code":""},{"path":"https://vincentarelbundock.github.io/modelsummary/dev/reference/P50.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"datasummary statistic shortcut — P50","text":"","code":"P50(x, fmt = NULL, na.rm = TRUE, ...)"},{"path":"https://vincentarelbundock.github.io/modelsummary/dev/reference/P50.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"datasummary statistic shortcut — P50","text":"x variable summarize fmt passed modelsummary:::rounding function na.rm logical value indicating whether ‘NA’ values stripped computation proceeds. ... unused","code":""},{"path":"https://vincentarelbundock.github.io/modelsummary/dev/reference/P50.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"datasummary statistic shortcut — P50","text":"","code":"if (identical(Sys.getenv(\"pkgdown\"), \"true\")) { datasummary(mpg + hp ~ Mean + Median + P0 + P25 + P50 + P75 + P100 + Min + Max + SD + Var, data = mtcars) } #> #> #> #> <\/th> #> | Mean <\/th> #> | Median <\/th> #> | P0 <\/th> #> | P25 <\/th> #> | P50 <\/th> #> | P75 <\/th> #> | P100 <\/th> #> | Min <\/th> #> | Max <\/th> #> | SD <\/th> #> | Var <\/th> #> <\/tr> #> <\/thead> #> | #> #> mpg <\/td> #> | 20.09 <\/td> #> | 19.20 <\/td> #> | 10.40 <\/td> #> | 15.43 <\/td> #> | 19.20 <\/td> #> | 22.80 <\/td> #> | 33.90 <\/td> #> | 10.40 <\/td> #> | 33.90 <\/td> #> | 6.03 <\/td> #> | 36.32 <\/td> #> <\/tr> #> | #> hp <\/td> #> | 146.69 <\/td> #> | 123.00 <\/td> #> | 52.00 <\/td> #> | 96.50 <\/td> #> | 123.00 <\/td> #> | 180.00 <\/td> #> | 335.00 <\/td> #> | 52.00 <\/td> #> | 335.00 <\/td> #> | 68.56 <\/td> #> | 4700.87 <\/td> #> <\/tr> #> <\/tbody> #> <\/table>"},{"path":"https://vincentarelbundock.github.io/modelsummary/dev/reference/P75.html","id":null,"dir":"Reference","previous_headings":"","what":"datasummary statistic shortcut — P75","title":"datasummary statistic shortcut — P75","text":"datasummary statistic shortcut","code":""},{"path":"https://vincentarelbundock.github.io/modelsummary/dev/reference/P75.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"datasummary statistic shortcut — P75","text":"","code":"P75(x, fmt = NULL, na.rm = TRUE, ...)"},{"path":"https://vincentarelbundock.github.io/modelsummary/dev/reference/P75.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"datasummary statistic shortcut — P75","text":"x variable summarize fmt passed modelsummary:::rounding function na.rm logical value indicating whether ‘NA’ values stripped computation proceeds. ... unused","code":""},{"path":"https://vincentarelbundock.github.io/modelsummary/dev/reference/P75.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"datasummary statistic shortcut — P75","text":"","code":"if (identical(Sys.getenv(\"pkgdown\"), \"true\")) { datasummary(mpg + hp ~ Mean + Median + P0 + P25 + P50 + P75 + P100 + Min + Max + SD + Var, data = mtcars) } #> #> #> #> <\/th> #> | Mean <\/th> #> | Median <\/th> #> | P0 <\/th> #> | P25 <\/th> #> | P50 <\/th> #> | P75 <\/th> #> | P100 <\/th> #> | Min <\/th> #> | Max <\/th> #> | SD <\/th> #> | Var <\/th> #> <\/tr> #> <\/thead> #> | #> #> mpg <\/td> #> | 20.09 <\/td> #> | 19.20 <\/td> #> | 10.40 <\/td> #> | 15.43 <\/td> #> | 19.20 <\/td> #> | 22.80 <\/td> #> | 33.90 <\/td> #> | 10.40 <\/td> #> | 33.90 <\/td> #> | 6.03 <\/td> #> | 36.32 <\/td> #> <\/tr> #> | #> hp <\/td> #> | 146.69 <\/td> #> | 123.00 <\/td> #> | 52.00 <\/td> #> | 96.50 <\/td> #> | 123.00 <\/td> #> | 180.00 <\/td> #> | 335.00 <\/td> #> | 52.00 <\/td> #> | 335.00 <\/td> #> | 68.56 <\/td> #> | 4700.87 <\/td> #> <\/tr> #> <\/tbody> #> <\/table>"},{"path":"https://vincentarelbundock.github.io/modelsummary/dev/reference/Paste.html","id":null,"dir":"Reference","previous_headings":"","what":"Generate terms to paste values together in table. — Paste","title":"Generate terms to paste values together in table. — Paste","text":"objects imported packages. Follow links see documentation. tables Paste","code":""},{"path":"https://vincentarelbundock.github.io/modelsummary/dev/reference/Percent.html","id":null,"dir":"Reference","previous_headings":"","what":"Pseudo-function to compute a statistic relative to a reference set. — Percent","title":"Pseudo-function to compute a statistic relative to a reference set. — Percent","text":"objects imported packages. Follow links see documentation. tables Percent","code":""},{"path":"https://vincentarelbundock.github.io/modelsummary/dev/reference/PercentMissing.html","id":null,"dir":"Reference","previous_headings":"","what":"datasummary statistic shortcut — PercentMissing","title":"datasummary statistic shortcut — PercentMissing","text":"datasummary statistic shortcut","code":""},{"path":"https://vincentarelbundock.github.io/modelsummary/dev/reference/PercentMissing.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"datasummary statistic shortcut — PercentMissing","text":"","code":"PercentMissing(x)"},{"path":"https://vincentarelbundock.github.io/modelsummary/dev/reference/PercentMissing.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"datasummary statistic shortcut — PercentMissing","text":"x variable summarize","code":""},{"path":"https://vincentarelbundock.github.io/modelsummary/dev/reference/PlusMinus.html","id":null,"dir":"Reference","previous_headings":"","what":"Generate 'x +/- y' terms in table. — PlusMinus","title":"Generate 'x +/- y' terms in table. — PlusMinus","text":"objects imported packages. Follow links see documentation. tables PlusMinus","code":""},{"path":"https://vincentarelbundock.github.io/modelsummary/dev/reference/RowFactor.html","id":null,"dir":"Reference","previous_headings":"","what":"Use a variable as a factor to give rows in a table. — RowFactor","title":"Use a variable as a factor to give rows in a table. — RowFactor","text":"objects imported packages. Follow links see documentation. tables RowFactor","code":""},{"path":"https://vincentarelbundock.github.io/modelsummary/dev/reference/RowNum.html","id":null,"dir":"Reference","previous_headings":"","what":"Display all observations in a table. — RowNum","title":"Display all observations in a table. — RowNum","text":"objects imported packages. Follow links see documentation. tables RowNum","code":""},{"path":"https://vincentarelbundock.github.io/modelsummary/dev/reference/SD.html","id":null,"dir":"Reference","previous_headings":"","what":"datasummary statistic shortcut — SD","title":"datasummary statistic shortcut — SD","text":"datasummary statistic shortcut","code":""},{"path":"https://vincentarelbundock.github.io/modelsummary/dev/reference/SD.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"datasummary statistic shortcut — SD","text":"","code":"SD(x, fmt = NULL, na.rm = TRUE, ...)"},{"path":"https://vincentarelbundock.github.io/modelsummary/dev/reference/SD.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"datasummary statistic shortcut — SD","text":"x variable summarize fmt passed modelsummary:::rounding function na.rm logical value indicating whether ‘NA’ values stripped computation proceeds. ... unused","code":""},{"path":"https://vincentarelbundock.github.io/modelsummary/dev/reference/SD.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"datasummary statistic shortcut — SD","text":"","code":"if (identical(Sys.getenv(\"pkgdown\"), \"true\")) { datasummary(mpg + hp ~ Mean + Median + P0 + P25 + P50 + P75 + P100 + Min + Max + SD + Var, data = mtcars) } #> #> #> #> <\/th> #> | Mean <\/th> #> | Median <\/th> #> | P0 <\/th> #> | P25 <\/th> #> | P50 <\/th> #> | P75 <\/th> #> | P100 <\/th> #> | Min <\/th> #> | Max <\/th> #> | SD <\/th> #> | Var <\/th> #> <\/tr> #> <\/thead> #> | #> #> mpg <\/td> #> | 20.09 <\/td> #> | 19.20 <\/td> #> | 10.40 <\/td> #> | 15.43 <\/td> #> | 19.20 <\/td> #> | 22.80 <\/td> #> | 33.90 <\/td> #> | 10.40 <\/td> #> | 33.90 <\/td> #> | 6.03 <\/td> #> | 36.32 <\/td> #> <\/tr> #> | #> hp <\/td> #> | 146.69 <\/td> #> | 123.00 <\/td> #> | 52.00 <\/td> #> | 96.50 <\/td> #> | 123.00 <\/td> #> | 180.00 <\/td> #> | 335.00 <\/td> #> | 52.00 <\/td> #> | 335.00 <\/td> #> | 68.56 <\/td> #> | 4700.87 <\/td> #> <\/tr> #> <\/tbody> #> <\/table>"},{"path":"https://vincentarelbundock.github.io/modelsummary/dev/reference/Var.html","id":null,"dir":"Reference","previous_headings":"","what":"datasummary statistic shortcut — Var","title":"datasummary statistic shortcut — Var","text":"datasummary statistic shortcut","code":""},{"path":"https://vincentarelbundock.github.io/modelsummary/dev/reference/Var.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"datasummary statistic shortcut — Var","text":"","code":"Var(x, fmt = NULL, na.rm = TRUE, ...)"},{"path":"https://vincentarelbundock.github.io/modelsummary/dev/reference/Var.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"datasummary statistic shortcut — Var","text":"x variable summarize fmt passed modelsummary:::rounding function na.rm logical value indicating whether ‘NA’ values stripped computation proceeds. ... unused","code":""},{"path":"https://vincentarelbundock.github.io/modelsummary/dev/reference/Var.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"datasummary statistic shortcut — Var","text":"","code":"if (identical(Sys.getenv(\"pkgdown\"), \"true\")) { datasummary(mpg + hp ~ Mean + Median + P0 + P25 + P50 + P75 + P100 + Min + Max + SD + Var, data = mtcars) } #> #> #> #> <\/th> #> | Mean <\/th> #> | Median <\/th> #> | P0 <\/th> #> | P25 <\/th> #> | P50 <\/th> #> | P75 <\/th> #> | P100 <\/th> #> | Min <\/th> #> | Max <\/th> #> | SD <\/th> #> | Var <\/th> #> <\/tr> #> <\/thead> #> | #> #> mpg <\/td> #> | 20.09 <\/td> #> | 19.20 <\/td> #> | 10.40 <\/td> #> | 15.43 <\/td> #> | 19.20 <\/td> #> | 22.80 <\/td> #> | 33.90 <\/td> #> | 10.40 <\/td> #> | 33.90 <\/td> #> | 6.03 <\/td> #> | 36.32 <\/td> #> <\/tr> #> | #> hp <\/td> #> | 146.69 <\/td> #> | 123.00 <\/td> #> | 52.00 <\/td> #> | 96.50 <\/td> #> | 123.00 <\/td> #> | 180.00 <\/td> #> | 335.00 <\/td> #> | 52.00 <\/td> #> | 335.00 <\/td> #> | 68.56 <\/td> #> | 4700.87 <\/td> #> <\/tr> #> <\/tbody> #> <\/table>"},{"path":"https://vincentarelbundock.github.io/modelsummary/dev/reference/coef_rename.html","id":null,"dir":"Reference","previous_headings":"","what":"Rename model terms — coef_rename","title":"Rename model terms — coef_rename","text":"convenience function can passed coef_rename argument modelsummary function.","code":""},{"path":"https://vincentarelbundock.github.io/modelsummary/dev/reference/coef_rename.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Rename model terms — coef_rename","text":"","code":"coef_rename( x, factor = TRUE, factor_name = TRUE, backticks = TRUE, titlecase = TRUE, underscore = TRUE, asis = TRUE )"},{"path":"https://vincentarelbundock.github.io/modelsummary/dev/reference/coef_rename.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Rename model terms — coef_rename","text":"x character vector term names transform factor boolean remove \"factor()\" label factor_name boolean remove \"factor()\" label name variable backticks boolean remove backticks titlecase boolean convert title case underscore boolean replace underscores spaces asis boolean remove -formula calls","code":""},{"path":"https://vincentarelbundock.github.io/modelsummary/dev/reference/coef_rename.html","id":"examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Rename model terms — coef_rename","text":"","code":"library(modelsummary) dat <- mtcars dat$horse_power <- dat$hp mod <- lm(mpg ~ horse_power + factor(cyl), dat) modelsummary(mod, coef_rename = coef_rename)"},{"path":"https://vincentarelbundock.github.io/modelsummary/dev/reference/colLabels.html","id":null,"dir":"Reference","previous_headings":"","what":"Retrieve or modify the row or column labels. — colLabels","title":"Retrieve or modify the row or column labels. — colLabels","text":"objects imported packages. Follow links see documentation. tables colLabels","code":""},{"path":"https://vincentarelbundock.github.io/modelsummary/dev/reference/config_modelsummary.html","id":null,"dir":"Reference","previous_headings":"","what":"Persistent user settings for the modelsummary package — config_modelsummary","title":"Persistent user settings for the modelsummary package — config_modelsummary","text":"Persistent user settings modelsummary package","code":""},{"path":"https://vincentarelbundock.github.io/modelsummary/dev/reference/config_modelsummary.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Persistent user settings for the modelsummary package — config_modelsummary","text":"","code":"config_modelsummary( factory_default, factory_latex, factory_html, factory_markdown, reset = FALSE )"},{"path":"https://vincentarelbundock.github.io/modelsummary/dev/reference/config_modelsummary.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Persistent user settings for the modelsummary package — config_modelsummary","text":"factory_default Default output format: \"kableExtra\", \"gt\", \"flextable\", \"huxtable\", \"DT\", \"markdown\" factory_latex Name package used generate LaTeX output output=\"latex\". factory_html Name package used generate LaTeX output output=\"html\". factory_markdown Name package used generate LaTeX output output=\"markdown\". reset TRUE return default settings.","code":""},{"path":"https://vincentarelbundock.github.io/modelsummary/dev/reference/datasummary.html","id":null,"dir":"Reference","previous_headings":"","what":"Summary tables using 2-sided formulae: crosstabs, frequencies, table\n1s and more. — datasummary","title":"Summary tables using 2-sided formulae: crosstabs, frequencies, table\n1s and more. — datasummary","text":"datasummary can use summary function produces one numeric character value per variable. examples section documentation shows define custom summary functions. modelsummary also supplies several shortcut summary functions can used datasummary() formulas: Min, Max, Mean, Median, Var, SD, NPercent, NUnique, Ncol, P0, P25, P50, P75, P100. See Details Examples sections , vignettes modelsummary website: https://vincentarelbundock.github.io/modelsummary/ https://vincentarelbundock.github.io/modelsummary/articles/datasummary.html","code":""},{"path":"https://vincentarelbundock.github.io/modelsummary/dev/reference/datasummary.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Summary tables using 2-sided formulae: crosstabs, frequencies, table\n1s and more. — datasummary","text":"","code":"datasummary( formula, data, output = \"default\", fmt = 2, title = NULL, notes = NULL, align = NULL, add_columns = NULL, add_rows = NULL, sparse_header = TRUE, escape = TRUE, ... )"},{"path":"https://vincentarelbundock.github.io/modelsummary/dev/reference/datasummary.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Summary tables using 2-sided formulae: crosstabs, frequencies, table\n1s and more. — datasummary","text":"formula two-sided formula describe table: rows ~ columns. See Examples section mini-tutorial Details section resources. Grouping/nesting variables can appear sides formula, summary functions must one side. data data.frame (tibble) output filename object type (character string) Supported filename extensions: .docx, .html, .tex, .md, .txt, .csv, .xlsx, .png, .jpg Supported object types: \"default\", \"html\", \"markdown\", \"latex\", \"latex_tabular\", \"data.frame\", \"gt\", \"kableExtra\", \"huxtable\", \"flextable\", \"DT\", \"jupyter\". \"modelsummary_list\" value produces lightweight object can saved fed back modelsummary function. \"default\" output format can set \"kableExtra\", \"gt\", \"flextable\", \"huxtable\", \"DT\", \"markdown\" user choose default value, packages listed tried sequence. Session-specific configuration: options(\"modelsummary_factory_default\" = \"gt\") Persistent configuration: config_modelsummary(output = \"markdown\") Warning: Users supply file name output argument intend customize table external packages. See 'Details' section. LaTeX compilation requires booktabs siunitx packages, siunitx can disabled replaced global options. See 'Details' section. fmt format numeric values: integer, user-supplied function, modelsummary function. Integer: Number decimal digits User-supplied functions: function accepts numeric vector returns character vector length. modelsummary functions: fmt = fmt_significant(2): Two significant digits (term-level) fmt = fmt_sprintf(\"%.3f\"): See ?sprintf fmt = fmt_identity(): unformatted raw values title string notes list vector notes append bottom table. align string number characters equal number columns table (e.g., align = \"lcc\"). Valid characters: l, c, r, d. \"l\": left-aligned column \"c\": centered column \"r\": right-aligned column \"d\": dot-aligned column. LaTeX/PDF output, option requires least version 3.0.25 siunitx LaTeX package. commands must appear LaTeX preamble (added automatically compiling Rmarkdown documents PDF): \\usepackage{booktabs} \\usepackage{siunitx} \\newcolumntype{d}{S[ input-open-uncertainty=, input-close-uncertainty=, parse-numbers = false, table-align-text-pre=false, table-align-text-post=false ]} add_columns data.frame (tibble) number rows main table. add_rows data.frame (tibble) number columns main table. default, rows appended bottom table. can define \"position\" attribute integers set row positions. See Examples section . sparse_header TRUE FALSE. TRUE eliminates column headers unique label across columns, except row immediately data. FALSE keeps headers. order terms entered formula determines order headers appear. example, x~mean*z print mean-related header z-related header.` escape boolean TRUE escapes substitutes LaTeX/HTML characters prevent file compiling/displaying. setting affect captions notes. ... arguments passed table-making functions kableExtra::kbl, gt::gt, DT::datatable, etc. depending output argument. allows users pass arguments directly datasummary order affect behavior functions behind scenes.","code":""},{"path":"https://vincentarelbundock.github.io/modelsummary/dev/reference/datasummary.html","id":"details","dir":"Reference","previous_headings":"","what":"Details","title":"Summary tables using 2-sided formulae: crosstabs, frequencies, table\n1s and more. — datasummary","text":"Visit 'modelsummary' website usage examples: https://vincentarelbundock.github.io/modelsummary 'datasummary' function thin wrapper around 'tabular' function 'tables' package. details table-making formulas can found 'tables' package documentation: ?tables::tabular Hierarchical \"nested\" column labels available output formats: kableExtra, gt, html, rtf, LaTeX. saving tables formats, nested labels combined \"flat\" header.","code":""},{"path":"https://vincentarelbundock.github.io/modelsummary/dev/reference/datasummary.html","id":"global-options","dir":"Reference","previous_headings":"","what":"Global Options","title":"Summary tables using 2-sided formulae: crosstabs, frequencies, table\n1s and more. — datasummary","text":"behavior modelsummary can modified setting global options. example: options(modelsummary_model_labels = \"roman\") rest section describes options .","code":""},{"path":"https://vincentarelbundock.github.io/modelsummary/dev/reference/datasummary.html","id":"model-labels-default-column-names","dir":"Reference","previous_headings":"","what":"Model labels: default column names","title":"Summary tables using 2-sided formulae: crosstabs, frequencies, table\n1s and more. — datasummary","text":"global option changes style default column headers: options(modelsummary_model_labels = \"roman\") options(modelsummary_panel_labels = \"roman\") supported styles : \"model\", \"panel\", \"arabic\", \"letters\", \"roman\", \"(arabic)\", \"(letters)\", \"(roman)\"\" panel-specific option used shape=\"rbind\"","code":""},{"path":"https://vincentarelbundock.github.io/modelsummary/dev/reference/datasummary.html","id":"table-making-packages","dir":"Reference","previous_headings":"","what":"Table-making packages","title":"Summary tables using 2-sided formulae: crosstabs, frequencies, table\n1s and more. — datasummary","text":"modelsummary supports 4 table-making packages: kableExtra, gt, flextable, huxtable, DT. packages overlapping functionalities. example, 3 packages can export LaTeX. change default backend used specific file format, can use options function: options(modelsummary_factory_html = 'kableExtra') options(modelsummary_factory_latex = 'gt') options(modelsummary_factory_word = 'huxtable') options(modelsummary_factory_png = 'gt')","code":""},{"path":"https://vincentarelbundock.github.io/modelsummary/dev/reference/datasummary.html","id":"table-themes","dir":"Reference","previous_headings":"","what":"Table themes","title":"Summary tables using 2-sided formulae: crosstabs, frequencies, table\n1s and more. — datasummary","text":"Change look tables automated replicable way, using modelsummary theming functionality. See vignette: https://vincentarelbundock.github.io/modelsummary/articles/appearance.html modelsummary_theme_gt modelsummary_theme_kableExtra modelsummary_theme_huxtable modelsummary_theme_flextable modelsummary_theme_dataframe","code":""},{"path":"https://vincentarelbundock.github.io/modelsummary/dev/reference/datasummary.html","id":"model-extraction-functions","dir":"Reference","previous_headings":"","what":"Model extraction functions","title":"Summary tables using 2-sided formulae: crosstabs, frequencies, table\n1s and more. — datasummary","text":"modelsummary can use two sets packages extract information statistical models: easystats family (performance parameters) broom. default, uses easystats first falls back broom case failure. can change order priorities include goodness--fit extracted packages setting: options(modelsummary_get = \"broom\") options(modelsummary_get = \"easystats\") options(modelsummary_get = \"\")","code":""},{"path":"https://vincentarelbundock.github.io/modelsummary/dev/reference/datasummary.html","id":"formatting-numeric-entries","dir":"Reference","previous_headings":"","what":"Formatting numeric entries","title":"Summary tables using 2-sided formulae: crosstabs, frequencies, table\n1s and more. — datasummary","text":"default, LaTeX tables enclose numeric entries \\num{} command siunitx package. prevent behavior, enclose numbers dollar signs (LaTeX math mode), users can call: options(modelsummary_format_numeric_latex = \"plain\") options(modelsummary_format_numeric_latex = \"mathmode\") similar option can used display numerical entries using MathJax HTML tables: options(modelsummary_format_numeric_html = \"mathjax\")","code":""},{"path":"https://vincentarelbundock.github.io/modelsummary/dev/reference/datasummary.html","id":"examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Summary tables using 2-sided formulae: crosstabs, frequencies, table\n1s and more. — datasummary","text":"","code":"library(modelsummary) # The left-hand side of the formula describes rows, and the right-hand side # describes columns. This table uses the \"mpg\" variable as a row and the \"mean\" # function as a column: datasummary(mpg ~ mean, data = mtcars) # This table uses the \"mean\" function as a row and the \"mpg\" variable as a column: datasummary(mean ~ mpg, data = mtcars) # Display several variables or functions of the data using the \"+\" # concatenation operator. This table has 2 rows and 2 columns: datasummary(hp + mpg ~ mean + sd, data = mtcars) # Nest variables or statistics inside a \"factor\" variable using the \"*\" nesting # operator. This table shows the mean of \"hp\" and \"mpg\" for each value of # \"cyl\": mtcars$cyl <- as.factor(mtcars$cyl) datasummary(hp + mpg ~ cyl * mean, data = mtcars) # If you don't want to convert your original data # to factors, you can use the 'Factor()' # function inside 'datasummary' to obtain an identical result: datasummary(hp + mpg ~ Factor(cyl) * mean, data = mtcars) # You can nest several variables or statistics inside a factor by using # parentheses. This table shows the mean and the standard deviation for each # subset of \"cyl\": datasummary(hp + mpg ~ cyl * (mean + sd), data = mtcars) # Summarize all numeric variables with 'All()' datasummary(All(mtcars) ~ mean + sd, data = mtcars) # Define custom summary statistics. Your custom function should accept a vector # of numeric values and return a single numeric or string value: minmax <- function(x) sprintf(\"[%.2f, %.2f]\", min(x), max(x)) mean_na <- function(x) mean(x, na.rm = TRUE) datasummary(hp + mpg ~ minmax + mean_na, data = mtcars) # To handle missing values, you can pass arguments to your functions using # '*Arguments()' datasummary(hp + mpg ~ mean * Arguments(na.rm = TRUE), data = mtcars) # For convenience, 'modelsummary' supplies several convenience functions # with the argument `na.rm=TRUE` by default: Mean, Median, Min, Max, SD, Var, # P0, P25, P50, P75, P100, NUnique, Histogram #datasummary(hp + mpg ~ Mean + SD + Histogram, data = mtcars) # These functions also accept a 'fmt' argument which allows you to # round/format the results datasummary(hp + mpg ~ Mean * Arguments(fmt = \"%.3f\") + SD * Arguments(fmt = \"%.1f\"), data = mtcars) # Save your tables to a variety of output formats: f <- hp + mpg ~ Mean + SD #datasummary(f, data = mtcars, output = 'table.html') #datasummary(f, data = mtcars, output = 'table.tex') #datasummary(f, data = mtcars, output = 'table.md') #datasummary(f, data = mtcars, output = 'table.docx') #datasummary(f, data = mtcars, output = 'table.pptx') #datasummary(f, data = mtcars, output = 'table.jpg') #datasummary(f, data = mtcars, output = 'table.png') # Display human-readable code #datasummary(f, data = mtcars, output = 'html') #datasummary(f, data = mtcars, output = 'markdown') #datasummary(f, data = mtcars, output = 'latex') # Return a table object to customize using a table-making package #datasummary(f, data = mtcars, output = 'gt') #datasummary(f, data = mtcars, output = 'kableExtra') #datasummary(f, data = mtcars, output = 'flextable') #datasummary(f, data = mtcars, output = 'huxtable') # add_rows new_rows <- data.frame(a = 1:2, b = 2:3, c = 4:5) attr(new_rows, 'position') <- c(1, 3) datasummary(mpg + hp ~ mean + sd, data = mtcars, add_rows = new_rows)"},{"path":"https://vincentarelbundock.github.io/modelsummary/dev/reference/datasummary.html","id":"references","dir":"Reference","previous_headings":"","what":"References","title":"Summary tables using 2-sided formulae: crosstabs, frequencies, table\n1s and more. — datasummary","text":"Arel-Bundock V (2022). “modelsummary: Data Model Summaries R.” Journal Statistical Software, 103(1), 1-23. doi:10.18637/jss.v103.i01 .'","code":""},{"path":"https://vincentarelbundock.github.io/modelsummary/dev/reference/datasummary_balance.html","id":null,"dir":"Reference","previous_headings":"","what":"Balance table: Summary statistics for different subsets of the data (e.g.,\ncontrol and treatment groups) — datasummary_balance","title":"Balance table: Summary statistics for different subsets of the data (e.g.,\ncontrol and treatment groups) — datasummary_balance","text":"Creates balance tables summary statistics different subsets data (e.g., control treatment groups). can also used create summary tables full data sets. See Details Examples sections , vignettes modelsummary website: https://vincentarelbundock.github.io/modelsummary/ https://vincentarelbundock.github.io/modelsummary/articles/datasummary.html","code":""},{"path":"https://vincentarelbundock.github.io/modelsummary/dev/reference/datasummary_balance.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Balance table: Summary statistics for different subsets of the data (e.g.,\ncontrol and treatment groups) — datasummary_balance","text":"","code":"datasummary_balance( formula, data, output = \"default\", fmt = fmt_decimal(digits = 1, pdigits = 3), title = NULL, notes = NULL, align = NULL, stars = FALSE, add_columns = NULL, add_rows = NULL, dinm = TRUE, dinm_statistic = \"std.error\", escape = TRUE, ... )"},{"path":"https://vincentarelbundock.github.io/modelsummary/dev/reference/datasummary_balance.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Balance table: Summary statistics for different subsets of the data (e.g.,\ncontrol and treatment groups) — datasummary_balance","text":"formula one-sided formula \"condition\" \"column\" variable right-hand side. ~1 can used show summary statistics full data set data data.frame (tibble). data includes columns called \"blocks\", \"clusters\", /\"weights\", \"estimatr\" package consider calculating difference means. weights column, reported mean standard errors also weighted. output filename object type (character string) Supported filename extensions: .docx, .html, .tex, .md, .txt, .csv, .xlsx, .png, .jpg Supported object types: \"default\", \"html\", \"markdown\", \"latex\", \"latex_tabular\", \"data.frame\", \"gt\", \"kableExtra\", \"huxtable\", \"flextable\", \"DT\", \"jupyter\". \"modelsummary_list\" value produces lightweight object can saved fed back modelsummary function. \"default\" output format can set \"kableExtra\", \"gt\", \"flextable\", \"huxtable\", \"DT\", \"markdown\" user choose default value, packages listed tried sequence. Session-specific configuration: options(\"modelsummary_factory_default\" = \"gt\") Persistent configuration: config_modelsummary(output = \"markdown\") Warning: Users supply file name output argument intend customize table external packages. See 'Details' section. LaTeX compilation requires booktabs siunitx packages, siunitx can disabled replaced global options. See 'Details' section. fmt format numeric values: integer, user-supplied function, modelsummary function. Integer: Number decimal digits User-supplied functions: function accepts numeric vector returns character vector length. modelsummary functions: fmt = fmt_significant(2): Two significant digits (term-level) fmt = fmt_sprintf(\"%.3f\"): See ?sprintf fmt = fmt_identity(): unformatted raw values title string notes list vector notes append bottom table. align string number characters equal number columns table (e.g., align = \"lcc\"). Valid characters: l, c, r, d. \"l\": left-aligned column \"c\": centered column \"r\": right-aligned column \"d\": dot-aligned column. LaTeX/PDF output, option requires least version 3.0.25 siunitx LaTeX package. commands must appear LaTeX preamble (added automatically compiling Rmarkdown documents PDF): \\usepackage{booktabs} \\usepackage{siunitx} \\newcolumntype{d}{S[ input-open-uncertainty=, input-close-uncertainty=, parse-numbers = false, table-align-text-pre=false, table-align-text-post=false ]} stars indicate statistical significance FALSE (default): significance stars. TRUE: +=.1, *=.05, **=.01, ***=0.001 Named numeric vector custom stars c('*' = .1, '+' = .05) Note: legend inserted bottom table estimate statistic arguments use \"glue strings\" {stars}. add_columns data.frame (tibble) number rows main table. add_rows data.frame (tibble) number columns main table. default, rows appended bottom table. can define \"position\" attribute integers set row positions. See Examples section . dinm TRUE calculates difference means uncertainty estimates. option available estimatr package installed. data includes columns named \"blocks\", \"clusters\", \"weights\", information taken account automatically estimatr::difference_in_means. dinm_statistic string: \"std.error\" \"p.value\" escape boolean TRUE escapes substitutes LaTeX/HTML characters prevent file compiling/displaying. setting affect captions notes. ... arguments passed table-making functions kableExtra::kbl, gt::gt, DT::datatable, etc. depending output argument. allows users pass arguments directly datasummary order affect behavior functions behind scenes.","code":""},{"path":"https://vincentarelbundock.github.io/modelsummary/dev/reference/datasummary_balance.html","id":"global-options","dir":"Reference","previous_headings":"","what":"Global Options","title":"Balance table: Summary statistics for different subsets of the data (e.g.,\ncontrol and treatment groups) — datasummary_balance","text":"behavior modelsummary can modified setting global options. example: options(modelsummary_model_labels = \"roman\") rest section describes options .","code":""},{"path":"https://vincentarelbundock.github.io/modelsummary/dev/reference/datasummary_balance.html","id":"model-labels-default-column-names","dir":"Reference","previous_headings":"","what":"Model labels: default column names","title":"Balance table: Summary statistics for different subsets of the data (e.g.,\ncontrol and treatment groups) — datasummary_balance","text":"global option changes style default column headers: options(modelsummary_model_labels = \"roman\") options(modelsummary_panel_labels = \"roman\") supported styles : \"model\", \"panel\", \"arabic\", \"letters\", \"roman\", \"(arabic)\", \"(letters)\", \"(roman)\"\" panel-specific option used shape=\"rbind\"","code":""},{"path":"https://vincentarelbundock.github.io/modelsummary/dev/reference/datasummary_balance.html","id":"table-making-packages","dir":"Reference","previous_headings":"","what":"Table-making packages","title":"Balance table: Summary statistics for different subsets of the data (e.g.,\ncontrol and treatment groups) — datasummary_balance","text":"modelsummary supports 4 table-making packages: kableExtra, gt, flextable, huxtable, DT. packages overlapping functionalities. example, 3 packages can export LaTeX. change default backend used specific file format, can use options function: options(modelsummary_factory_html = 'kableExtra') options(modelsummary_factory_latex = 'gt') options(modelsummary_factory_word = 'huxtable') options(modelsummary_factory_png = 'gt')","code":""},{"path":"https://vincentarelbundock.github.io/modelsummary/dev/reference/datasummary_balance.html","id":"table-themes","dir":"Reference","previous_headings":"","what":"Table themes","title":"Balance table: Summary statistics for different subsets of the data (e.g.,\ncontrol and treatment groups) — datasummary_balance","text":"Change look tables automated replicable way, using modelsummary theming functionality. See vignette: https://vincentarelbundock.github.io/modelsummary/articles/appearance.html modelsummary_theme_gt modelsummary_theme_kableExtra modelsummary_theme_huxtable modelsummary_theme_flextable modelsummary_theme_dataframe","code":""},{"path":"https://vincentarelbundock.github.io/modelsummary/dev/reference/datasummary_balance.html","id":"model-extraction-functions","dir":"Reference","previous_headings":"","what":"Model extraction functions","title":"Balance table: Summary statistics for different subsets of the data (e.g.,\ncontrol and treatment groups) — datasummary_balance","text":"modelsummary can use two sets packages extract information statistical models: easystats family (performance parameters) broom. default, uses easystats first falls back broom case failure. can change order priorities include goodness--fit extracted packages setting: options(modelsummary_get = \"broom\") options(modelsummary_get = \"easystats\") options(modelsummary_get = \"\")","code":""},{"path":"https://vincentarelbundock.github.io/modelsummary/dev/reference/datasummary_balance.html","id":"formatting-numeric-entries","dir":"Reference","previous_headings":"","what":"Formatting numeric entries","title":"Balance table: Summary statistics for different subsets of the data (e.g.,\ncontrol and treatment groups) — datasummary_balance","text":"default, LaTeX tables enclose numeric entries \\num{} command siunitx package. prevent behavior, enclose numbers dollar signs (LaTeX math mode), users can call: options(modelsummary_format_numeric_latex = \"plain\") options(modelsummary_format_numeric_latex = \"mathmode\") similar option can used display numerical entries using MathJax HTML tables: options(modelsummary_format_numeric_html = \"mathjax\")","code":""},{"path":"https://vincentarelbundock.github.io/modelsummary/dev/reference/datasummary_balance.html","id":"examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Balance table: Summary statistics for different subsets of the data (e.g.,\ncontrol and treatment groups) — datasummary_balance","text":"","code":"library(modelsummary) datasummary_balance(~am, mtcars)"},{"path":"https://vincentarelbundock.github.io/modelsummary/dev/reference/datasummary_balance.html","id":"references","dir":"Reference","previous_headings":"","what":"References","title":"Balance table: Summary statistics for different subsets of the data (e.g.,\ncontrol and treatment groups) — datasummary_balance","text":"Arel-Bundock V (2022). “modelsummary: Data Model Summaries R.” Journal Statistical Software, 103(1), 1-23. doi:10.18637/jss.v103.i01 .'","code":""},{"path":"https://vincentarelbundock.github.io/modelsummary/dev/reference/datasummary_correlation.html","id":null,"dir":"Reference","previous_headings":"","what":"Generate a correlation table for all numeric variables in your dataset. — datasummary_correlation","title":"Generate a correlation table for all numeric variables in your dataset. — datasummary_correlation","text":"names variables displayed correlation table names columns data. can rename columns (without spaces) produce table human-readable variables. See Details Examples sections , vignettes modelsummary website: https://vincentarelbundock.github.io/modelsummary/ https://vincentarelbundock.github.io/modelsummary/articles/datasummary.html","code":""},{"path":"https://vincentarelbundock.github.io/modelsummary/dev/reference/datasummary_correlation.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Generate a correlation table for all numeric variables in your dataset. — datasummary_correlation","text":"","code":"datasummary_correlation( data, output = \"default\", method = \"pearson\", fmt = 2, align = NULL, add_rows = NULL, add_columns = NULL, title = NULL, notes = NULL, escape = TRUE, ... )"},{"path":"https://vincentarelbundock.github.io/modelsummary/dev/reference/datasummary_correlation.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Generate a correlation table for all numeric variables in your dataset. — datasummary_correlation","text":"data data.frame (tibble) output filename object type (character string) Supported filename extensions: .docx, .html, .tex, .md, .txt, .csv, .xlsx, .png, .jpg Supported object types: \"default\", \"html\", \"markdown\", \"latex\", \"latex_tabular\", \"data.frame\", \"gt\", \"kableExtra\", \"huxtable\", \"flextable\", \"DT\", \"jupyter\". \"modelsummary_list\" value produces lightweight object can saved fed back modelsummary function. \"default\" output format can set \"kableExtra\", \"gt\", \"flextable\", \"huxtable\", \"DT\", \"markdown\" user choose default value, packages listed tried sequence. Session-specific configuration: options(\"modelsummary_factory_default\" = \"gt\") Persistent configuration: config_modelsummary(output = \"markdown\") Warning: Users supply file name output argument intend customize table external packages. See 'Details' section. LaTeX compilation requires booktabs siunitx packages, siunitx can disabled replaced global options. See 'Details' section. method character function character: \"pearson\", \"kendall\", \"spearman\", \"pearspear\" (Pearson correlations Spearman correlations diagonal) function: takes data.frame numeric columns returns square matrix data.frame unique row.names colnames corresponding variable names. Note datasummary_correlation_format can often useful formatting output custom correlation functions. fmt format numeric values: integer, user-supplied function, modelsummary function. Integer: Number decimal digits User-supplied functions: function accepts numeric vector returns character vector length. modelsummary functions: fmt = fmt_significant(2): Two significant digits (term-level) fmt = fmt_sprintf(\"%.3f\"): See ?sprintf fmt = fmt_identity(): unformatted raw values align string number characters equal number columns table (e.g., align = \"lcc\"). Valid characters: l, c, r, d. \"l\": left-aligned column \"c\": centered column \"r\": right-aligned column \"d\": dot-aligned column. LaTeX/PDF output, option requires least version 3.0.25 siunitx LaTeX package. commands must appear LaTeX preamble (added automatically compiling Rmarkdown documents PDF): \\usepackage{booktabs} \\usepackage{siunitx} \\newcolumntype{d}{S[ input-open-uncertainty=, input-close-uncertainty=, parse-numbers = false, table-align-text-pre=false, table-align-text-post=false ]} add_rows data.frame (tibble) number columns main table. default, rows appended bottom table. can define \"position\" attribute integers set row positions. See Examples section . add_columns data.frame (tibble) number rows main table. title string notes list vector notes append bottom table. escape boolean TRUE escapes substitutes LaTeX/HTML characters prevent file compiling/displaying. setting affect captions notes. ... parameters passed table-making packages.","code":""},{"path":"https://vincentarelbundock.github.io/modelsummary/dev/reference/datasummary_correlation.html","id":"global-options","dir":"Reference","previous_headings":"","what":"Global Options","title":"Generate a correlation table for all numeric variables in your dataset. — datasummary_correlation","text":"behavior modelsummary can modified setting global options. example: options(modelsummary_model_labels = \"roman\") rest section describes options .","code":""},{"path":"https://vincentarelbundock.github.io/modelsummary/dev/reference/datasummary_correlation.html","id":"model-labels-default-column-names","dir":"Reference","previous_headings":"","what":"Model labels: default column names","title":"Generate a correlation table for all numeric variables in your dataset. — datasummary_correlation","text":"global option changes style default column headers: options(modelsummary_model_labels = \"roman\") options(modelsummary_panel_labels = \"roman\") supported styles : \"model\", \"panel\", \"arabic\", \"letters\", \"roman\", \"(arabic)\", \"(letters)\", \"(roman)\"\" panel-specific option used shape=\"rbind\"","code":""},{"path":"https://vincentarelbundock.github.io/modelsummary/dev/reference/datasummary_correlation.html","id":"table-making-packages","dir":"Reference","previous_headings":"","what":"Table-making packages","title":"Generate a correlation table for all numeric variables in your dataset. — datasummary_correlation","text":"modelsummary supports 4 table-making packages: kableExtra, gt, flextable, huxtable, DT. packages overlapping functionalities. example, 3 packages can export LaTeX. change default backend used specific file format, can use options function: options(modelsummary_factory_html = 'kableExtra') options(modelsummary_factory_latex = 'gt') options(modelsummary_factory_word = 'huxtable') options(modelsummary_factory_png = 'gt')","code":""},{"path":"https://vincentarelbundock.github.io/modelsummary/dev/reference/datasummary_correlation.html","id":"table-themes","dir":"Reference","previous_headings":"","what":"Table themes","title":"Generate a correlation table for all numeric variables in your dataset. — datasummary_correlation","text":"Change look tables automated replicable way, using modelsummary theming functionality. See vignette: https://vincentarelbundock.github.io/modelsummary/articles/appearance.html modelsummary_theme_gt modelsummary_theme_kableExtra modelsummary_theme_huxtable modelsummary_theme_flextable modelsummary_theme_dataframe","code":""},{"path":"https://vincentarelbundock.github.io/modelsummary/dev/reference/datasummary_correlation.html","id":"model-extraction-functions","dir":"Reference","previous_headings":"","what":"Model extraction functions","title":"Generate a correlation table for all numeric variables in your dataset. — datasummary_correlation","text":"modelsummary can use two sets packages extract information statistical models: easystats family (performance parameters) broom. default, uses easystats first falls back broom case failure. can change order priorities include goodness--fit extracted packages setting: options(modelsummary_get = \"broom\") options(modelsummary_get = \"easystats\") options(modelsummary_get = \"\")","code":""},{"path":"https://vincentarelbundock.github.io/modelsummary/dev/reference/datasummary_correlation.html","id":"formatting-numeric-entries","dir":"Reference","previous_headings":"","what":"Formatting numeric entries","title":"Generate a correlation table for all numeric variables in your dataset. — datasummary_correlation","text":"default, LaTeX tables enclose numeric entries \\num{} command siunitx package. prevent behavior, enclose numbers dollar signs (LaTeX math mode), users can call: options(modelsummary_format_numeric_latex = \"plain\") options(modelsummary_format_numeric_latex = \"mathmode\") similar option can used display numerical entries using MathJax HTML tables: options(modelsummary_format_numeric_html = \"mathjax\")","code":""},{"path":"https://vincentarelbundock.github.io/modelsummary/dev/reference/datasummary_correlation.html","id":"examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Generate a correlation table for all numeric variables in your dataset. — datasummary_correlation","text":"","code":"library(modelsummary) # clean variable names (base R) dat <- mtcars[, c(\"mpg\", \"hp\")] colnames(dat) <- c(\"Miles / Gallon\", \"Horse Power\") datasummary_correlation(dat) # clean variable names (tidyverse) library(tidyverse) dat <- mtcars %>% select(`Miles / Gallon` = mpg, `Horse Power` = hp) datasummary_correlation(dat) # alternative methods datasummary_correlation(dat, method = \"pearspear\") # custom function cor_fun <- function(x) cor(x, method = \"kendall\") datasummary_correlation(dat, method = cor_fun) # rename columns alphabetically and include a footnote for reference note <- sprintf(\"(%s) %s\", letters[1:ncol(dat)], colnames(dat)) note <- paste(note, collapse = \"; \") colnames(dat) <- sprintf(\"(%s)\", letters[1:ncol(dat)]) datasummary_correlation(dat, notes = note) # `datasummary_correlation_format`: custom function with formatting dat <- mtcars[, c(\"mpg\", \"hp\", \"disp\")] cor_fun <- function(x) { out <- cor(x, method = \"kendall\") datasummary_correlation_format( out, fmt = 2, upper_triangle = \"x\", diagonal = \".\") } datasummary_correlation(dat, method = cor_fun) # use kableExtra and psych to color significant cells library(psych) library(kableExtra) dat <- mtcars[, c(\"vs\", \"hp\", \"gear\")] cor_fun <- function(dat) { # compute correlations and format them correlations <- data.frame(cor(dat)) correlations <- datasummary_correlation_format(correlations, fmt = 2) # calculate pvalues using the `psych` package pvalues <- psych::corr.test(dat)$p # use `kableExtra::cell_spec` to color significant cells for (i in 1:nrow(correlations)) { for (j in 1:ncol(correlations)) { if (pvalues[i, j] < 0.05 && i != j) { correlations[i, j] <- cell_spec(correlations[i, j], background = \"pink\") } } } return(correlations) } # The `escape=FALSE` is important here! datasummary_correlation(dat, method = cor_fun, escape = FALSE)"},{"path":"https://vincentarelbundock.github.io/modelsummary/dev/reference/datasummary_correlation.html","id":"references","dir":"Reference","previous_headings":"","what":"References","title":"Generate a correlation table for all numeric variables in your dataset. — datasummary_correlation","text":"Arel-Bundock V (2022). “modelsummary: Data Model Summaries R.” Journal Statistical Software, 103(1), 1-23. doi:10.18637/jss.v103.i01 .'","code":""},{"path":"https://vincentarelbundock.github.io/modelsummary/dev/reference/datasummary_correlation_format.html","id":null,"dir":"Reference","previous_headings":"","what":"Format the content of a correlation table — datasummary_correlation_format","title":"Format the content of a correlation table — datasummary_correlation_format","text":"Mostly internal use, can useful users supply function method argument datasummary_correlation.","code":""},{"path":"https://vincentarelbundock.github.io/modelsummary/dev/reference/datasummary_correlation_format.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Format the content of a correlation table — datasummary_correlation_format","text":"","code":"datasummary_correlation_format( x, fmt, leading_zero = FALSE, diagonal = NULL, upper_triangle = NULL )"},{"path":"https://vincentarelbundock.github.io/modelsummary/dev/reference/datasummary_correlation_format.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Format the content of a correlation table — datasummary_correlation_format","text":"x square numeric matrix fmt format numeric values: integer, user-supplied function, modelsummary function. Integer: Number decimal digits User-supplied functions: function accepts numeric vector returns character vector length. modelsummary functions: fmt = fmt_significant(2): Two significant digits (term-level) fmt = fmt_sprintf(\"%.3f\"): See ?sprintf fmt = fmt_identity(): unformatted raw values leading_zero boolean. FALSE, leading zeros removed diagonal character NULL. character, elements diagonal replaced character (e.g., \"1\"). upper_triangle character NULL. character, elements upper triangle replaced character (e.g., \"\" \".\").","code":""},{"path":"https://vincentarelbundock.github.io/modelsummary/dev/reference/datasummary_correlation_format.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Format the content of a correlation table — datasummary_correlation_format","text":"","code":"library(modelsummary) dat <- mtcars[, c(\"mpg\", \"hp\", \"disp\")] cor_fun <- function(x) { out <- cor(x, method = \"kendall\") datasummary_correlation_format( out, fmt = 2, upper_triangle = \"x\", diagonal = \".\") } datasummary_correlation(dat, method = cor_fun) #> #> #> #> <\/th> #> | mpg <\/th> #> | hp <\/th> #> | disp <\/th> #> <\/tr> #> <\/thead> #> | #> #> mpg <\/td> #> | . <\/td> #> | x <\/td> #> | x <\/td> #> <\/tr> #> | #> hp <\/td> #> | −.74 <\/td> #> | . <\/td> #> | x <\/td> #> <\/tr> #> | #> disp <\/td> #> | −.77 <\/td> #> | .67 <\/td> #> | . <\/td> #> <\/tr> #> <\/tbody> #> <\/table>"},{"path":"https://vincentarelbundock.github.io/modelsummary/dev/reference/datasummary_crosstab.html","id":null,"dir":"Reference","previous_headings":"","what":"Cross tabulations for categorical variables — datasummary_crosstab","title":"Cross tabulations for categorical variables — datasummary_crosstab","text":"Convenience function tabulate counts, cell percentages, row/column percentages categorical variables. See Details section description internal design. complex cross tabulations, use datasummary directly. See Details Examples sections , vignettes modelsummary website: https://vincentarelbundock.github.io/modelsummary/ https://vincentarelbundock.github.io/modelsummary/articles/datasummary.html","code":""},{"path":"https://vincentarelbundock.github.io/modelsummary/dev/reference/datasummary_crosstab.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Cross tabulations for categorical variables — datasummary_crosstab","text":"","code":"datasummary_crosstab( formula, statistic = 1 ~ 1 + N + Percent(\"row\"), data, output = \"default\", fmt = 1, title = NULL, notes = NULL, align = NULL, add_columns = NULL, add_rows = NULL, sparse_header = TRUE, escape = TRUE, ... )"},{"path":"https://vincentarelbundock.github.io/modelsummary/dev/reference/datasummary_crosstab.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Cross tabulations for categorical variables — datasummary_crosstab","text":"formula two-sided formula describe table: rows ~ columns, rows columns variables data. Rows columns may contain interactions, e.g., var1 * var2 ~ var3. statistic formula form 1 ~ 1 + N + Percent(\"row\"). left-hand side may empty contain 1 include row totals. right-hand side may contain: 1 column totals, N counts, Percent() cell percentages, Percent(\"row\") row percentages, Percent(\"col\") column percentages. data data.frame (tibble) output filename object type (character string) Supported filename extensions: .docx, .html, .tex, .md, .txt, .csv, .xlsx, .png, .jpg Supported object types: \"default\", \"html\", \"markdown\", \"latex\", \"latex_tabular\", \"data.frame\", \"gt\", \"kableExtra\", \"huxtable\", \"flextable\", \"DT\", \"jupyter\". \"modelsummary_list\" value produces lightweight object can saved fed back modelsummary function. \"default\" output format can set \"kableExtra\", \"gt\", \"flextable\", \"huxtable\", \"DT\", \"markdown\" user choose default value, packages listed tried sequence. Session-specific configuration: options(\"modelsummary_factory_default\" = \"gt\") Persistent configuration: config_modelsummary(output = \"markdown\") Warning: Users supply file name output argument intend customize table external packages. See 'Details' section. LaTeX compilation requires booktabs siunitx packages, siunitx can disabled replaced global options. See 'Details' section. fmt format numeric values: integer, user-supplied function, modelsummary function. Integer: Number decimal digits User-supplied functions: function accepts numeric vector returns character vector length. modelsummary functions: fmt = fmt_significant(2): Two significant digits (term-level) fmt = fmt_sprintf(\"%.3f\"): See ?sprintf fmt = fmt_identity(): unformatted raw values title string notes list vector notes append bottom table. align string number characters equal number columns table (e.g., align = \"lcc\"). Valid characters: l, c, r, d. \"l\": left-aligned column \"c\": centered column \"r\": right-aligned column \"d\": dot-aligned column. LaTeX/PDF output, option requires least version 3.0.25 siunitx LaTeX package. commands must appear LaTeX preamble (added automatically compiling Rmarkdown documents PDF): \\usepackage{booktabs} \\usepackage{siunitx} \\newcolumntype{d}{S[ input-open-uncertainty=, input-close-uncertainty=, parse-numbers = false, table-align-text-pre=false, table-align-text-post=false ]} add_columns data.frame (tibble) number rows main table. add_rows data.frame (tibble) number columns main table. default, rows appended bottom table. can define \"position\" attribute integers set row positions. See Examples section . sparse_header TRUE FALSE. TRUE eliminates column headers unique label across columns, except row immediately data. FALSE keeps headers. order terms entered formula determines order headers appear. example, x~mean*z print mean-related header z-related header.` escape boolean TRUE escapes substitutes LaTeX/HTML characters prevent file compiling/displaying. setting affect captions notes. ... arguments passed table-making functions kableExtra::kbl, gt::gt, DT::datatable, etc. depending output argument. allows users pass arguments directly datasummary order affect behavior functions behind scenes.","code":""},{"path":"https://vincentarelbundock.github.io/modelsummary/dev/reference/datasummary_crosstab.html","id":"details","dir":"Reference","previous_headings":"","what":"Details","title":"Cross tabulations for categorical variables — datasummary_crosstab","text":"datasummary_crosstab wrapper around datasummary function. wrapper works creating customized formula feeding datasummary. customized formula comes two parts. First, take two-sided formula supplied formula argument. variables formula wrapped Factor() call ensure variables treated categorical. Second, statistic argument gives two-sided formula specifies statistics include table. datasummary_crosstab modifies formula automatically include \"clean\" labels. Finally, formula statistic formulas combined single formula fed directly datasummary function produce table. Variables formula automatically wrapped Factor().","code":""},{"path":"https://vincentarelbundock.github.io/modelsummary/dev/reference/datasummary_crosstab.html","id":"global-options","dir":"Reference","previous_headings":"","what":"Global Options","title":"Cross tabulations for categorical variables — datasummary_crosstab","text":"behavior modelsummary can modified setting global options. example: options(modelsummary_model_labels = \"roman\") rest section describes options .","code":""},{"path":"https://vincentarelbundock.github.io/modelsummary/dev/reference/datasummary_crosstab.html","id":"model-labels-default-column-names","dir":"Reference","previous_headings":"","what":"Model labels: default column names","title":"Cross tabulations for categorical variables — datasummary_crosstab","text":"global option changes style default column headers: options(modelsummary_model_labels = \"roman\") options(modelsummary_panel_labels = \"roman\") supported styles : \"model\", \"panel\", \"arabic\", \"letters\", \"roman\", \"(arabic)\", \"(letters)\", \"(roman)\"\" panel-specific option used shape=\"rbind\"","code":""},{"path":"https://vincentarelbundock.github.io/modelsummary/dev/reference/datasummary_crosstab.html","id":"table-making-packages","dir":"Reference","previous_headings":"","what":"Table-making packages","title":"Cross tabulations for categorical variables — datasummary_crosstab","text":"modelsummary supports 4 table-making packages: kableExtra, gt, flextable, huxtable, DT. packages overlapping functionalities. example, 3 packages can export LaTeX. change default backend used specific file format, can use options function: options(modelsummary_factory_html = 'kableExtra') options(modelsummary_factory_latex = 'gt') options(modelsummary_factory_word = 'huxtable') options(modelsummary_factory_png = 'gt')","code":""},{"path":"https://vincentarelbundock.github.io/modelsummary/dev/reference/datasummary_crosstab.html","id":"table-themes","dir":"Reference","previous_headings":"","what":"Table themes","title":"Cross tabulations for categorical variables — datasummary_crosstab","text":"Change look tables automated replicable way, using modelsummary theming functionality. See vignette: https://vincentarelbundock.github.io/modelsummary/articles/appearance.html modelsummary_theme_gt modelsummary_theme_kableExtra modelsummary_theme_huxtable modelsummary_theme_flextable modelsummary_theme_dataframe","code":""},{"path":"https://vincentarelbundock.github.io/modelsummary/dev/reference/datasummary_crosstab.html","id":"model-extraction-functions","dir":"Reference","previous_headings":"","what":"Model extraction functions","title":"Cross tabulations for categorical variables — datasummary_crosstab","text":"modelsummary can use two sets packages extract information statistical models: easystats family (performance parameters) broom. default, uses easystats first falls back broom case failure. can change order priorities include goodness--fit extracted packages setting: options(modelsummary_get = \"broom\") options(modelsummary_get = \"easystats\") options(modelsummary_get = \"\")","code":""},{"path":"https://vincentarelbundock.github.io/modelsummary/dev/reference/datasummary_crosstab.html","id":"formatting-numeric-entries","dir":"Reference","previous_headings":"","what":"Formatting numeric entries","title":"Cross tabulations for categorical variables — datasummary_crosstab","text":"default, LaTeX tables enclose numeric entries \\num{} command siunitx package. prevent behavior, enclose numbers dollar signs (LaTeX math mode), users can call: options(modelsummary_format_numeric_latex = \"plain\") options(modelsummary_format_numeric_latex = \"mathmode\") similar option can used display numerical entries using MathJax HTML tables: options(modelsummary_format_numeric_html = \"mathjax\")","code":""},{"path":"https://vincentarelbundock.github.io/modelsummary/dev/reference/datasummary_crosstab.html","id":"examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Cross tabulations for categorical variables — datasummary_crosstab","text":"","code":"library(modelsummary) # crosstab of two variables, showing counts, row percentages, and row/column totals datasummary_crosstab(cyl ~ gear, data = mtcars) # crosstab of two variables, showing counts only and no totals datasummary_crosstab(cyl ~ gear, statistic = ~ N, data = mtcars) # crosstab of three variables datasummary_crosstab(am * cyl ~ gear, data = mtcars) # crosstab with two variables and column percentages datasummary_crosstab(am ~ gear, statistic = ~ Percent(\"col\"), data = mtcars)"},{"path":"https://vincentarelbundock.github.io/modelsummary/dev/reference/datasummary_crosstab.html","id":"references","dir":"Reference","previous_headings":"","what":"References","title":"Cross tabulations for categorical variables — datasummary_crosstab","text":"Arel-Bundock V (2022). “modelsummary: Data Model Summaries R.” Journal Statistical Software, 103(1), 1-23. doi:10.18637/jss.v103.i01 .'","code":""},{"path":"https://vincentarelbundock.github.io/modelsummary/dev/reference/datasummary_df.html","id":null,"dir":"Reference","previous_headings":"","what":"Draw a table from a data.frame — datasummary_df","title":"Draw a table from a data.frame — datasummary_df","text":"Draw table data.frame","code":""},{"path":"https://vincentarelbundock.github.io/modelsummary/dev/reference/datasummary_df.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Draw a table from a data.frame — datasummary_df","text":"","code":"datasummary_df( data, output = \"default\", fmt = 2, align = NULL, hrule = NULL, title = NULL, notes = NULL, add_rows = NULL, add_columns = NULL, escape = TRUE, ... )"},{"path":"https://vincentarelbundock.github.io/modelsummary/dev/reference/datasummary_df.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Draw a table from a data.frame — datasummary_df","text":"data data.frame (tibble) output filename object type (character string) Supported filename extensions: .docx, .html, .tex, .md, .txt, .csv, .xlsx, .png, .jpg Supported object types: \"default\", \"html\", \"markdown\", \"latex\", \"latex_tabular\", \"data.frame\", \"gt\", \"kableExtra\", \"huxtable\", \"flextable\", \"DT\", \"jupyter\". \"modelsummary_list\" value produces lightweight object can saved fed back modelsummary function. \"default\" output format can set \"kableExtra\", \"gt\", \"flextable\", \"huxtable\", \"DT\", \"markdown\" user choose default value, packages listed tried sequence. Session-specific configuration: options(\"modelsummary_factory_default\" = \"gt\") Persistent configuration: config_modelsummary(output = \"markdown\") Warning: Users supply file name output argument intend customize table external packages. See 'Details' section. LaTeX compilation requires booktabs siunitx packages, siunitx can disabled replaced global options. See 'Details' section. fmt format numeric values: integer, user-supplied function, modelsummary function. Integer: Number decimal digits User-supplied functions: function accepts numeric vector returns character vector length. modelsummary functions: fmt = fmt_significant(2): Two significant digits (term-level) fmt = fmt_sprintf(\"%.3f\"): See ?sprintf fmt = fmt_identity(): unformatted raw values align string number characters equal number columns table (e.g., align = \"lcc\"). Valid characters: l, c, r, d. \"l\": left-aligned column \"c\": centered column \"r\": right-aligned column \"d\": dot-aligned column. LaTeX/PDF output, option requires least version 3.0.25 siunitx LaTeX package. commands must appear LaTeX preamble (added automatically compiling Rmarkdown documents PDF): \\usepackage{booktabs} \\usepackage{siunitx} \\newcolumntype{d}{S[ input-open-uncertainty=, input-close-uncertainty=, parse-numbers = false, table-align-text-pre=false, table-align-text-post=false ]} hrule position horizontal rules (integer vector) title string notes list vector notes append bottom table. add_rows data.frame (tibble) number columns main table. default, rows appended bottom table. can define \"position\" attribute integers set row positions. See Examples section . add_columns data.frame (tibble) number rows main table. escape boolean TRUE escapes substitutes LaTeX/HTML characters prevent file compiling/displaying. setting affect captions notes. ... arguments passed table-making functions kableExtra::kbl, gt::gt, DT::datatable, etc. depending output argument. allows users pass arguments directly datasummary order affect behavior functions behind scenes.","code":""},{"path":"https://vincentarelbundock.github.io/modelsummary/dev/reference/datasummary_df.html","id":"references","dir":"Reference","previous_headings":"","what":"References","title":"Draw a table from a data.frame — datasummary_df","text":"Arel-Bundock V (2022). “modelsummary: Data Model Summaries R.” Journal Statistical Software, 103(1), 1-23. doi:10.18637/jss.v103.i01 .'","code":""},{"path":"https://vincentarelbundock.github.io/modelsummary/dev/reference/datasummary_skim.html","id":null,"dir":"Reference","previous_headings":"","what":"Quick overview of numeric or categorical variables — datasummary_skim","title":"Quick overview of numeric or categorical variables — datasummary_skim","text":"function inspired excellent skimr package R. See Details Examples sections , vignettes modelsummary website: https://vincentarelbundock.github.io/modelsummary/ https://vincentarelbundock.github.io/modelsummary/articles/datasummary.html","code":""},{"path":"https://vincentarelbundock.github.io/modelsummary/dev/reference/datasummary_skim.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Quick overview of numeric or categorical variables — datasummary_skim","text":"","code":"datasummary_skim( data, type = \"numeric\", output = \"default\", fmt = \"%.1f\", histogram = TRUE, title = NULL, notes = NULL, align = NULL, escape = TRUE, ... )"},{"path":"https://vincentarelbundock.github.io/modelsummary/dev/reference/datasummary_skim.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Quick overview of numeric or categorical variables — datasummary_skim","text":"data data.frame (tibble) type variables summarize: \"numeric\" \"categorical\" (character) output filename object type (character string) Supported filename extensions: .docx, .html, .tex, .md, .txt, .csv, .xlsx, .png, .jpg Supported object types: \"default\", \"html\", \"markdown\", \"latex\", \"latex_tabular\", \"data.frame\", \"gt\", \"kableExtra\", \"huxtable\", \"flextable\", \"DT\", \"jupyter\". \"modelsummary_list\" value produces lightweight object can saved fed back modelsummary function. \"default\" output format can set \"kableExtra\", \"gt\", \"flextable\", \"huxtable\", \"DT\", \"markdown\" user choose default value, packages listed tried sequence. Session-specific configuration: options(\"modelsummary_factory_default\" = \"gt\") Persistent configuration: config_modelsummary(output = \"markdown\") Warning: Users supply file name output argument intend customize table external packages. See 'Details' section. LaTeX compilation requires booktabs siunitx packages, siunitx can disabled replaced global options. See 'Details' section. fmt format numeric values: integer, user-supplied function, modelsummary function. Integer: Number decimal digits User-supplied functions: function accepts numeric vector returns character vector length. modelsummary functions: fmt = fmt_significant(2): Two significant digits (term-level) fmt = fmt_sprintf(\"%.3f\"): See ?sprintf fmt = fmt_identity(): unformatted raw values histogram include histogram (TRUE/FALSE). Supported : type = \"numeric\" output \"html\", \"default\", \"jpg\", \"png\", \"kableExtra\" PDF HTML documents compiled via Rmarkdown knitr See examples section example use datasummary include histograms formats markdown. title string notes list vector notes append bottom table. align string number characters equal number columns table (e.g., align = \"lcc\"). Valid characters: l, c, r, d. \"l\": left-aligned column \"c\": centered column \"r\": right-aligned column \"d\": dot-aligned column. LaTeX/PDF output, option requires least version 3.0.25 siunitx LaTeX package. commands must appear LaTeX preamble (added automatically compiling Rmarkdown documents PDF): \\usepackage{booktabs} \\usepackage{siunitx} \\newcolumntype{d}{S[ input-open-uncertainty=, input-close-uncertainty=, parse-numbers = false, table-align-text-pre=false, table-align-text-post=false ]} escape boolean TRUE escapes substitutes LaTeX/HTML characters prevent file compiling/displaying. setting affect captions notes. ... arguments passed table-making functions kableExtra::kbl, gt::gt, DT::datatable, etc. depending output argument. allows users pass arguments directly datasummary order affect behavior functions behind scenes.","code":""},{"path":"https://vincentarelbundock.github.io/modelsummary/dev/reference/datasummary_skim.html","id":"global-options","dir":"Reference","previous_headings":"","what":"Global Options","title":"Quick overview of numeric or categorical variables — datasummary_skim","text":"behavior modelsummary can modified setting global options. example: options(modelsummary_model_labels = \"roman\") rest section describes options .","code":""},{"path":"https://vincentarelbundock.github.io/modelsummary/dev/reference/datasummary_skim.html","id":"model-labels-default-column-names","dir":"Reference","previous_headings":"","what":"Model labels: default column names","title":"Quick overview of numeric or categorical variables — datasummary_skim","text":"global option changes style default column headers: options(modelsummary_model_labels = \"roman\") options(modelsummary_panel_labels = \"roman\") supported styles : \"model\", \"panel\", \"arabic\", \"letters\", \"roman\", \"(arabic)\", \"(letters)\", \"(roman)\"\" panel-specific option used shape=\"rbind\"","code":""},{"path":"https://vincentarelbundock.github.io/modelsummary/dev/reference/datasummary_skim.html","id":"table-making-packages","dir":"Reference","previous_headings":"","what":"Table-making packages","title":"Quick overview of numeric or categorical variables — datasummary_skim","text":"modelsummary supports 4 table-making packages: kableExtra, gt, flextable, huxtable, DT. packages overlapping functionalities. example, 3 packages can export LaTeX. change default backend used specific file format, can use options function: options(modelsummary_factory_html = 'kableExtra') options(modelsummary_factory_latex = 'gt') options(modelsummary_factory_word = 'huxtable') options(modelsummary_factory_png = 'gt')","code":""},{"path":"https://vincentarelbundock.github.io/modelsummary/dev/reference/datasummary_skim.html","id":"table-themes","dir":"Reference","previous_headings":"","what":"Table themes","title":"Quick overview of numeric or categorical variables — datasummary_skim","text":"Change look tables automated replicable way, using modelsummary theming functionality. See vignette: https://vincentarelbundock.github.io/modelsummary/articles/appearance.html modelsummary_theme_gt modelsummary_theme_kableExtra modelsummary_theme_huxtable modelsummary_theme_flextable modelsummary_theme_dataframe","code":""},{"path":"https://vincentarelbundock.github.io/modelsummary/dev/reference/datasummary_skim.html","id":"model-extraction-functions","dir":"Reference","previous_headings":"","what":"Model extraction functions","title":"Quick overview of numeric or categorical variables — datasummary_skim","text":"modelsummary can use two sets packages extract information statistical models: easystats family (performance parameters) broom. default, uses easystats first falls back broom case failure. can change order priorities include goodness--fit extracted packages setting: options(modelsummary_get = \"broom\") options(modelsummary_get = \"easystats\") options(modelsummary_get = \"\")","code":""},{"path":"https://vincentarelbundock.github.io/modelsummary/dev/reference/datasummary_skim.html","id":"formatting-numeric-entries","dir":"Reference","previous_headings":"","what":"Formatting numeric entries","title":"Quick overview of numeric or categorical variables — datasummary_skim","text":"default, LaTeX tables enclose numeric entries \\num{} command siunitx package. prevent behavior, enclose numbers dollar signs (LaTeX math mode), users can call: options(modelsummary_format_numeric_latex = \"plain\") options(modelsummary_format_numeric_latex = \"mathmode\") similar option can used display numerical entries using MathJax HTML tables: options(modelsummary_format_numeric_html = \"mathjax\")","code":""},{"path":"https://vincentarelbundock.github.io/modelsummary/dev/reference/datasummary_skim.html","id":"examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Quick overview of numeric or categorical variables — datasummary_skim","text":"","code":"dat <- mtcars dat$vs <- as.logical(dat$vs) dat$cyl <- as.factor(dat$cyl) datasummary_skim(dat) datasummary_skim(dat, \"categorical\") # You can use `datasummary` to produce a similar table in different formats. # Note that the `Histogram` function relies on unicode characters. These # characters will only display correctly in some operating systems, under some # locales, using some fonts. Displaying such histograms on Windows computers # is notoriously tricky. The `modelsummary` authors cannot provide support to # display these unicode histograms. f <- All(mtcars) ~ Mean + SD + Min + Median + Max + Histogram # datasummary(f, mtcars, output=\"markdown\")"},{"path":"https://vincentarelbundock.github.io/modelsummary/dev/reference/datasummary_skim.html","id":"references","dir":"Reference","previous_headings":"","what":"References","title":"Quick overview of numeric or categorical variables — datasummary_skim","text":"Arel-Bundock V (2022). “modelsummary: Data Model Summaries R.” Journal Statistical Software, 103(1), 1-23. doi:10.18637/jss.v103.i01 .'","code":""},{"path":"https://vincentarelbundock.github.io/modelsummary/dev/reference/dsummary.html","id":null,"dir":"Reference","previous_headings":"","what":"dsummary() is a shortcut to datasummary() — dsummary","title":"dsummary() is a shortcut to datasummary() — dsummary","text":"datasummary can use summary function produces one numeric character value per variable. examples section documentation shows define custom summary functions. modelsummary also supplies several shortcut summary functions can used datasummary() formulas: Min, Max, Mean, Median, Var, SD, NPercent, NUnique, Ncol, P0, P25, P50, P75, P100. See Details Examples sections , vignettes modelsummary website: https://vincentarelbundock.github.io/modelsummary/ https://vincentarelbundock.github.io/modelsummary/articles/datasummary.html","code":""},{"path":"https://vincentarelbundock.github.io/modelsummary/dev/reference/dsummary.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"dsummary() is a shortcut to datasummary() — dsummary","text":"","code":"dsummary( formula, data, output = \"default\", fmt = 2, title = NULL, notes = NULL, align = NULL, add_columns = NULL, add_rows = NULL, sparse_header = TRUE, escape = TRUE, ... )"},{"path":"https://vincentarelbundock.github.io/modelsummary/dev/reference/dsummary.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"dsummary() is a shortcut to datasummary() — dsummary","text":"formula two-sided formula describe table: rows ~ columns. See Examples section mini-tutorial Details section resources. Grouping/nesting variables can appear sides formula, summary functions must one side. data data.frame (tibble) output filename object type (character string) Supported filename extensions: .docx, .html, .tex, .md, .txt, .csv, .xlsx, .png, .jpg Supported object types: \"default\", \"html\", \"markdown\", \"latex\", \"latex_tabular\", \"data.frame\", \"gt\", \"kableExtra\", \"huxtable\", \"flextable\", \"DT\", \"jupyter\". \"modelsummary_list\" value produces lightweight object can saved fed back modelsummary function. \"default\" output format can set \"kableExtra\", \"gt\", \"flextable\", \"huxtable\", \"DT\", \"markdown\" user choose default value, packages listed tried sequence. Session-specific configuration: options(\"modelsummary_factory_default\" = \"gt\") Persistent configuration: config_modelsummary(output = \"markdown\") Warning: Users supply file name output argument intend customize table external packages. See 'Details' section. LaTeX compilation requires booktabs siunitx packages, siunitx can disabled replaced global options. See 'Details' section. fmt format numeric values: integer, user-supplied function, modelsummary function. Integer: Number decimal digits User-supplied functions: function accepts numeric vector returns character vector length. modelsummary functions: fmt = fmt_significant(2): Two significant digits (term-level) fmt = fmt_sprintf(\"%.3f\"): See ?sprintf fmt = fmt_identity(): unformatted raw values title string notes list vector notes append bottom table. align string number characters equal number columns table (e.g., align = \"lcc\"). Valid characters: l, c, r, d. \"l\": left-aligned column \"c\": centered column \"r\": right-aligned column \"d\": dot-aligned column. LaTeX/PDF output, option requires least version 3.0.25 siunitx LaTeX package. commands must appear LaTeX preamble (added automatically compiling Rmarkdown documents PDF): \\usepackage{booktabs} \\usepackage{siunitx} \\newcolumntype{d}{S[ input-open-uncertainty=, input-close-uncertainty=, parse-numbers = false, table-align-text-pre=false, table-align-text-post=false ]} add_columns data.frame (tibble) number rows main table. add_rows data.frame (tibble) number columns main table. default, rows appended bottom table. can define \"position\" attribute integers set row positions. See Examples section . sparse_header TRUE FALSE. TRUE eliminates column headers unique label across columns, except row immediately data. FALSE keeps headers. order terms entered formula determines order headers appear. example, x~mean*z print mean-related header z-related header.` escape boolean TRUE escapes substitutes LaTeX/HTML characters prevent file compiling/displaying. setting affect captions notes. ... arguments passed table-making functions kableExtra::kbl, gt::gt, DT::datatable, etc. depending output argument. allows users pass arguments directly datasummary order affect behavior functions behind scenes.","code":""},{"path":"https://vincentarelbundock.github.io/modelsummary/dev/reference/dsummary.html","id":"details","dir":"Reference","previous_headings":"","what":"Details","title":"dsummary() is a shortcut to datasummary() — dsummary","text":"Visit 'modelsummary' website usage examples: https://vincentarelbundock.github.io/modelsummary 'datasummary' function thin wrapper around 'tabular' function 'tables' package. details table-making formulas can found 'tables' package documentation: ?tables::tabular Hierarchical \"nested\" column labels available output formats: kableExtra, gt, html, rtf, LaTeX. saving tables formats, nested labels combined \"flat\" header.","code":""},{"path":"https://vincentarelbundock.github.io/modelsummary/dev/reference/dsummary.html","id":"global-options","dir":"Reference","previous_headings":"","what":"Global Options","title":"dsummary() is a shortcut to datasummary() — dsummary","text":"behavior modelsummary can modified setting global options. example: options(modelsummary_model_labels = \"roman\") rest section describes options .","code":""},{"path":"https://vincentarelbundock.github.io/modelsummary/dev/reference/dsummary.html","id":"model-labels-default-column-names","dir":"Reference","previous_headings":"","what":"Model labels: default column names","title":"dsummary() is a shortcut to datasummary() — dsummary","text":"global option changes style default column headers: options(modelsummary_model_labels = \"roman\") options(modelsummary_panel_labels = \"roman\") supported styles : \"model\", \"panel\", \"arabic\", \"letters\", \"roman\", \"(arabic)\", \"(letters)\", \"(roman)\"\" panel-specific option used shape=\"rbind\"","code":""},{"path":"https://vincentarelbundock.github.io/modelsummary/dev/reference/dsummary.html","id":"table-making-packages","dir":"Reference","previous_headings":"","what":"Table-making packages","title":"dsummary() is a shortcut to datasummary() — dsummary","text":"modelsummary supports 4 table-making packages: kableExtra, gt, flextable, huxtable, DT. packages overlapping functionalities. example, 3 packages can export LaTeX. change default backend used specific file format, can use options function: options(modelsummary_factory_html = 'kableExtra') options(modelsummary_factory_latex = 'gt') options(modelsummary_factory_word = 'huxtable') options(modelsummary_factory_png = 'gt')","code":""},{"path":"https://vincentarelbundock.github.io/modelsummary/dev/reference/dsummary.html","id":"table-themes","dir":"Reference","previous_headings":"","what":"Table themes","title":"dsummary() is a shortcut to datasummary() — dsummary","text":"Change look tables automated replicable way, using modelsummary theming functionality. See vignette: https://vincentarelbundock.github.io/modelsummary/articles/appearance.html modelsummary_theme_gt modelsummary_theme_kableExtra modelsummary_theme_huxtable modelsummary_theme_flextable modelsummary_theme_dataframe","code":""},{"path":"https://vincentarelbundock.github.io/modelsummary/dev/reference/dsummary.html","id":"model-extraction-functions","dir":"Reference","previous_headings":"","what":"Model extraction functions","title":"dsummary() is a shortcut to datasummary() — dsummary","text":"modelsummary can use two sets packages extract information statistical models: easystats family (performance parameters) broom. default, uses easystats first falls back broom case failure. can change order priorities include goodness--fit extracted packages setting: options(modelsummary_get = \"broom\") options(modelsummary_get = \"easystats\") options(modelsummary_get = \"\")","code":""},{"path":"https://vincentarelbundock.github.io/modelsummary/dev/reference/dsummary.html","id":"formatting-numeric-entries","dir":"Reference","previous_headings":"","what":"Formatting numeric entries","title":"dsummary() is a shortcut to datasummary() — dsummary","text":"default, LaTeX tables enclose numeric entries \\num{} command siunitx package. prevent behavior, enclose numbers dollar signs (LaTeX math mode), users can call: options(modelsummary_format_numeric_latex = \"plain\") options(modelsummary_format_numeric_latex = \"mathmode\") similar option can used display numerical entries using MathJax HTML tables: options(modelsummary_format_numeric_html = \"mathjax\")","code":""},{"path":"https://vincentarelbundock.github.io/modelsummary/dev/reference/dsummary.html","id":"examples","dir":"Reference","previous_headings":"","what":"Examples","title":"dsummary() is a shortcut to datasummary() — dsummary","text":"","code":"library(modelsummary) # The left-hand side of the formula describes rows, and the right-hand side # describes columns. This table uses the \"mpg\" variable as a row and the \"mean\" # function as a column: datasummary(mpg ~ mean, data = mtcars) # This table uses the \"mean\" function as a row and the \"mpg\" variable as a column: datasummary(mean ~ mpg, data = mtcars) # Display several variables or functions of the data using the \"+\" # concatenation operator. This table has 2 rows and 2 columns: datasummary(hp + mpg ~ mean + sd, data = mtcars) # Nest variables or statistics inside a \"factor\" variable using the \"*\" nesting # operator. This table shows the mean of \"hp\" and \"mpg\" for each value of # \"cyl\": mtcars$cyl <- as.factor(mtcars$cyl) datasummary(hp + mpg ~ cyl * mean, data = mtcars) # If you don't want to convert your original data # to factors, you can use the 'Factor()' # function inside 'datasummary' to obtain an identical result: datasummary(hp + mpg ~ Factor(cyl) * mean, data = mtcars) # You can nest several variables or statistics inside a factor by using # parentheses. This table shows the mean and the standard deviation for each # subset of \"cyl\": datasummary(hp + mpg ~ cyl * (mean + sd), data = mtcars) # Summarize all numeric variables with 'All()' datasummary(All(mtcars) ~ mean + sd, data = mtcars) # Define custom summary statistics. Your custom function should accept a vector # of numeric values and return a single numeric or string value: minmax <- function(x) sprintf(\"[%.2f, %.2f]\", min(x), max(x)) mean_na <- function(x) mean(x, na.rm = TRUE) datasummary(hp + mpg ~ minmax + mean_na, data = mtcars) # To handle missing values, you can pass arguments to your functions using # '*Arguments()' datasummary(hp + mpg ~ mean * Arguments(na.rm = TRUE), data = mtcars) # For convenience, 'modelsummary' supplies several convenience functions # with the argument `na.rm=TRUE` by default: Mean, Median, Min, Max, SD, Var, # P0, P25, P50, P75, P100, NUnique, Histogram #datasummary(hp + mpg ~ Mean + SD + Histogram, data = mtcars) # These functions also accept a 'fmt' argument which allows you to # round/format the results datasummary(hp + mpg ~ Mean * Arguments(fmt = \"%.3f\") + SD * Arguments(fmt = \"%.1f\"), data = mtcars) # Save your tables to a variety of output formats: f <- hp + mpg ~ Mean + SD #datasummary(f, data = mtcars, output = 'table.html') #datasummary(f, data = mtcars, output = 'table.tex') #datasummary(f, data = mtcars, output = 'table.md') #datasummary(f, data = mtcars, output = 'table.docx') #datasummary(f, data = mtcars, output = 'table.pptx') #datasummary(f, data = mtcars, output = 'table.jpg') #datasummary(f, data = mtcars, output = 'table.png') # Display human-readable code #datasummary(f, data = mtcars, output = 'html') #datasummary(f, data = mtcars, output = 'markdown') #datasummary(f, data = mtcars, output = 'latex') # Return a table object to customize using a table-making package #datasummary(f, data = mtcars, output = 'gt') #datasummary(f, data = mtcars, output = 'kableExtra') #datasummary(f, data = mtcars, output = 'flextable') #datasummary(f, data = mtcars, output = 'huxtable') # add_rows new_rows <- data.frame(a = 1:2, b = 2:3, c = 4:5) attr(new_rows, 'position') <- c(1, 3) datasummary(mpg + hp ~ mean + sd, data = mtcars, add_rows = new_rows)"},{"path":"https://vincentarelbundock.github.io/modelsummary/dev/reference/dsummary.html","id":"references","dir":"Reference","previous_headings":"","what":"References","title":"dsummary() is a shortcut to datasummary() — dsummary","text":"Arel-Bundock V (2022). “modelsummary: Data Model Summaries R.” Journal Statistical Software, 103(1), 1-23. doi:10.18637/jss.v103.i01 .'","code":""},{"path":"https://vincentarelbundock.github.io/modelsummary/dev/reference/dvnames.html","id":null,"dir":"Reference","previous_headings":"","what":"Title models with their dependent variables — dvnames","title":"Title models with their dependent variables — dvnames","text":"convenience function use regression model list regression models. Returns named list models, names models' respective dependent variables. Pass list models dvnames sending modelsummary automatically get dependent variable-titled columns.","code":""},{"path":"https://vincentarelbundock.github.io/modelsummary/dev/reference/dvnames.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Title models with their dependent variables — dvnames","text":"","code":"dvnames(models, number = FALSE, strip = FALSE, fill = \"Model\")"},{"path":"https://vincentarelbundock.github.io/modelsummary/dev/reference/dvnames.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Title models with their dependent variables — dvnames","text":"models regression model list regression models number models numbered (1), (2), etc., addition dependent variable names? strip boolean FALSE returns dependent variable names appear model. TRUE returns dependent variable names appear data, without transformations. fill insight::find_response() find response, column title use place. Set ' ' leave blank.","code":""},{"path":"https://vincentarelbundock.github.io/modelsummary/dev/reference/dvnames.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Title models with their dependent variables — dvnames","text":"","code":"m1 <- lm(mpg ~ hp, data = mtcars) m2 <- lm(mpg ~ hp + wt, data = mtcars) # Without dvnames, column names are (1) and (2) modelsummary(list(m1, m2)) #> #> #> #> <\/th> #> | (1) <\/th> #> | (2) <\/th> #> <\/tr> #> <\/thead> #> | #> #> (Intercept) <\/td> #> | 30.099 <\/td> #> | 37.227 <\/td> #> <\/tr> #> | #> <\/td> #> | (1.634) <\/td> #> | (1.599) <\/td> #> <\/tr> #> | #> hp <\/td> #> | −0.068 <\/td> #> | −0.032 <\/td> #> <\/tr> #> | #> <\/td> #> | (0.010) <\/td> #> | (0.009) <\/td> #> <\/tr> #> | #> wt <\/td> #> | <\/td> #> | −3.878 <\/td> #> <\/tr> #> | #> <\/td> #> | <\/td> #> | (0.633) <\/td> #> <\/tr> #> | #> Num.Obs. <\/td> #> | 32 <\/td> #> | 32 <\/td> #> <\/tr> #> | #> R2 <\/td> #> | 0.602 <\/td> #> | 0.827 <\/td> #> <\/tr> #> | #> R2 Adj. <\/td> #> | 0.589 <\/td> #> | 0.815 <\/td> #> <\/tr> #> | #> AIC <\/td> #> | 181.2 <\/td> #> | 156.7 <\/td> #> <\/tr> #> | #> BIC <\/td> #> | 185.6 <\/td> #> | 162.5 <\/td> #> <\/tr> #> | #> Log.Lik. <\/td> #> | −87.619 <\/td> #> | −74.326 <\/td> #> <\/tr> #> | #> F <\/td> #> | 45.460 <\/td> #> | 69.211 <\/td> #> <\/tr> #> | #> RMSE <\/td> #> | 3.74 <\/td> #> | 2.47 <\/td> #> <\/tr> #> <\/tbody> #> <\/table> # With dvnames, they are \"mpg\" and \"mpg\" modelsummary(dvnames(list(m1,m2))) #> #> #> #> <\/th> #> | mpg <\/th> #> | mpg <\/th> #> <\/tr> #> <\/thead> #> | #> #> (Intercept) <\/td> #> | 30.099 <\/td> #> | 37.227 <\/td> #> <\/tr> #> | #> <\/td> #> | (1.634) <\/td> #> | (1.599) <\/td> #> <\/tr> #> | #> hp <\/td> #> | −0.068 <\/td> #> | −0.032 <\/td> #> <\/tr> #> | #> <\/td> #> | (0.010) <\/td> #> | (0.009) <\/td> #> <\/tr> #> | #> wt <\/td> #> | <\/td> #> | −3.878 <\/td> #> <\/tr> #> | #> <\/td> #> | <\/td> #> | (0.633) <\/td> #> <\/tr> #> | #> Num.Obs. <\/td> #> | 32 <\/td> #> | 32 <\/td> #> <\/tr> #> | #> R2 <\/td> #> | 0.602 <\/td> #> | 0.827 <\/td> #> <\/tr> #> | #> R2 Adj. <\/td> #> | 0.589 <\/td> #> | 0.815 <\/td> #> <\/tr> #> | #> AIC <\/td> #> | 181.2 <\/td> #> | 156.7 <\/td> #> <\/tr> #> | #> BIC <\/td> #> | 185.6 <\/td> #> | 162.5 <\/td> #> <\/tr> #> | #> Log.Lik. <\/td> #> | −87.619 <\/td> #> | −74.326 <\/td> #> <\/tr> #> | #> F <\/td> #> | 45.460 <\/td> #> | 69.211 <\/td> #> <\/tr> #> | #> RMSE <\/td> #> | 3.74 <\/td> #> | 2.47 <\/td> #> <\/tr> #> <\/tbody> #> <\/table>"},{"path":"https://vincentarelbundock.github.io/modelsummary/dev/reference/escape_html.html","id":null,"dir":"Reference","previous_headings":"","what":"Escape problematic characters to allow display in HTML — escape_html","title":"Escape problematic characters to allow display in HTML — escape_html","text":"Copied knitr internal use unexported CRAN rejects :::","code":""},{"path":"https://vincentarelbundock.github.io/modelsummary/dev/reference/escape_html.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Escape problematic characters to allow display in HTML — escape_html","text":"","code":"escape_html(x)"},{"path":"https://vincentarelbundock.github.io/modelsummary/dev/reference/escape_html.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Escape problematic characters to allow display in HTML — escape_html","text":"x character string escape","code":""},{"path":"https://vincentarelbundock.github.io/modelsummary/dev/reference/escape_latex.html","id":null,"dir":"Reference","previous_headings":"","what":"Escape problematic characters to allow compilation in LaTeX — escape_latex","title":"Escape problematic characters to allow compilation in LaTeX — escape_latex","text":"Copied knitr internal use unexported CRAN rejects :::","code":""},{"path":"https://vincentarelbundock.github.io/modelsummary/dev/reference/escape_latex.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Escape problematic characters to allow compilation in LaTeX — escape_latex","text":"","code":"escape_latex(x, newlines = FALSE, spaces = FALSE)"},{"path":"https://vincentarelbundock.github.io/modelsummary/dev/reference/escape_latex.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Escape problematic characters to allow compilation in LaTeX — escape_latex","text":"x character string escape newlines boolean spaces boolean","code":""},{"path":"https://vincentarelbundock.github.io/modelsummary/dev/reference/escape_string.html","id":null,"dir":"Reference","previous_headings":"","what":"Make sure LaTeX and HTML are safe to compile — escape_string","title":"Make sure LaTeX and HTML are safe to compile — escape_string","text":"Make sure LaTeX HTML safe compile","code":""},{"path":"https://vincentarelbundock.github.io/modelsummary/dev/reference/escape_string.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Make sure LaTeX and HTML are safe to compile — escape_string","text":"","code":"escape_string(x)"},{"path":"https://vincentarelbundock.github.io/modelsummary/dev/reference/fmt_decimal.html","id":null,"dir":"Reference","previous_headings":"","what":"Rounding with decimal digits in the fmt argument — fmt_decimal","title":"Rounding with decimal digits in the fmt argument — fmt_decimal","text":"Rounding decimal digits fmt argument","code":""},{"path":"https://vincentarelbundock.github.io/modelsummary/dev/reference/fmt_decimal.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Rounding with decimal digits in the fmt argument — fmt_decimal","text":"","code":"fmt_decimal(digits = 3, pdigits = NULL, ...)"},{"path":"https://vincentarelbundock.github.io/modelsummary/dev/reference/fmt_decimal.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Rounding with decimal digits in the fmt argument — fmt_decimal","text":"digits Number decimal digits keep, including trailing zeros. pdigits Number decimal digits keep p values. NULL, value digits used. ... Additional arguments passed format() function (e.g., big.marks, scientific). See ?format","code":""},{"path":"https://vincentarelbundock.github.io/modelsummary/dev/reference/fmt_sci.html","id":null,"dir":"Reference","previous_headings":"","what":"Rounding using scientific notation — fmt_sci","title":"Rounding using scientific notation — fmt_sci","text":"Rounding using scientific notation","code":""},{"path":"https://vincentarelbundock.github.io/modelsummary/dev/reference/fmt_sci.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Rounding using scientific notation — fmt_sci","text":"","code":"fmt_sci(digits = 3, ...)"},{"path":"https://vincentarelbundock.github.io/modelsummary/dev/reference/fmt_sci.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Rounding using scientific notation — fmt_sci","text":"digits positive integer indicating many significant digits used numeric complex x. ... additional arguments passed format().","code":""},{"path":"https://vincentarelbundock.github.io/modelsummary/dev/reference/fmt_significant.html","id":null,"dir":"Reference","previous_headings":"","what":"Rounding with significant digits in the fmt argument — fmt_significant","title":"Rounding with significant digits in the fmt argument — fmt_significant","text":"number decimal digits keep decimal assessed","code":""},{"path":"https://vincentarelbundock.github.io/modelsummary/dev/reference/fmt_significant.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Rounding with significant digits in the fmt argument — fmt_significant","text":"","code":"fmt_significant(digits = 3, ...)"},{"path":"https://vincentarelbundock.github.io/modelsummary/dev/reference/fmt_significant.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Rounding with significant digits in the fmt argument — fmt_significant","text":"digits Number significant digits keep. ... Additional arguments passed format() function (e.g., big.marks, scientific). See ?format","code":""},{"path":"https://vincentarelbundock.github.io/modelsummary/dev/reference/fmt_sprintf.html","id":null,"dir":"Reference","previous_headings":"","what":"Rounding with the sprintf() function in the fmt argument — fmt_sprintf","title":"Rounding with the sprintf() function in the fmt argument — fmt_sprintf","text":"Rounding sprintf() function fmt argument","code":""},{"path":"https://vincentarelbundock.github.io/modelsummary/dev/reference/fmt_sprintf.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Rounding with the sprintf() function in the fmt argument — fmt_sprintf","text":"","code":"fmt_sprintf(fmt)"},{"path":"https://vincentarelbundock.github.io/modelsummary/dev/reference/fmt_sprintf.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Rounding with the sprintf() function in the fmt argument — fmt_sprintf","text":"fmt string control sprintf(), \"%.3f\" keep 3 decimal digits. See ?sprintf","code":""},{"path":"https://vincentarelbundock.github.io/modelsummary/dev/reference/fmt_statistic.html","id":null,"dir":"Reference","previous_headings":"","what":"Rounding with decimal digits on a per-statistic basis in the fmt argument for modelsummary() — fmt_statistic","title":"Rounding with decimal digits on a per-statistic basis in the fmt argument for modelsummary() — fmt_statistic","text":"Rounding decimal digits per-statistic basis fmt argument modelsummary()","code":""},{"path":"https://vincentarelbundock.github.io/modelsummary/dev/reference/fmt_statistic.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Rounding with decimal digits on a per-statistic basis in the fmt argument for modelsummary() — fmt_statistic","text":"","code":"fmt_statistic(..., default = 3)"},{"path":"https://vincentarelbundock.github.io/modelsummary/dev/reference/fmt_statistic.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Rounding with decimal digits on a per-statistic basis in the fmt argument for modelsummary() — fmt_statistic","text":"... Statistic names fmt value default Number decimal digits keep unspecified terms","code":""},{"path":"https://vincentarelbundock.github.io/modelsummary/dev/reference/fmt_term.html","id":null,"dir":"Reference","previous_headings":"","what":"Rounding with decimal digits on a per-term basis in the fmt argument for modelsummary() — fmt_term","title":"Rounding with decimal digits on a per-term basis in the fmt argument for modelsummary() — fmt_term","text":"Rounding decimal digits per-term basis fmt argument modelsummary()","code":""},{"path":"https://vincentarelbundock.github.io/modelsummary/dev/reference/fmt_term.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Rounding with decimal digits on a per-term basis in the fmt argument for modelsummary() — fmt_term","text":"","code":"fmt_term(..., default = 3)"},{"path":"https://vincentarelbundock.github.io/modelsummary/dev/reference/fmt_term.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Rounding with decimal digits on a per-term basis in the fmt argument for modelsummary() — fmt_term","text":"... Term names fmt value default Number decimal digits keep unspecified terms","code":""},{"path":"https://vincentarelbundock.github.io/modelsummary/dev/reference/get_estimates.html","id":null,"dir":"Reference","previous_headings":"","what":"Extract model estimates in a tidy format. — get_estimates","title":"Extract model estimates in a tidy format. — get_estimates","text":"mostly internal function useful users want unified approach extract results wide variety models. models get_estimates attaches useful attributes output. can access information calling attributes function: attributes(get_estimates(model))","code":""},{"path":"https://vincentarelbundock.github.io/modelsummary/dev/reference/get_estimates.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Extract model estimates in a tidy format. — get_estimates","text":"","code":"get_estimates( model, conf_level = 0.95, vcov = NULL, shape = NULL, coef_rename = FALSE, ... )"},{"path":"https://vincentarelbundock.github.io/modelsummary/dev/reference/get_estimates.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Extract model estimates in a tidy format. — get_estimates","text":"model single model object conf_level numeric value 0 1. confidence level use confidence intervals. Setting argument NULL extract confidence intervals, can faster models. vcov robust standard errors manual statistics. vcov argument accepts six types input (see 'Details' 'Examples' sections ): NULL returns default uncertainty estimates model object string, vector, (named) list strings. \"iid\", \"classical\", \"constant\" aliases NULL, returns model's default uncertainty estimates. strings \"HC\", \"HC0\", \"HC1\" (alias: \"stata\"), \"HC2\", \"HC3\" (alias: \"robust\"), \"HC4\", \"HC4m\", \"HC5\", \"HAC\", \"NeweyWest\", \"Andrews\", \"panel-corrected\", \"outer-product\", \"weave\" use variance-covariance matrices computed using functions sandwich package, equivalent method. behavior functions can (sometimes must) altered passing arguments sandwich directly modelsummary ellipsis (...), safer define custom functions described next bullet. function (named) list functions return variance-covariance matrices row column names equal names coefficient estimates (e.g., stats::vcov, sandwich::vcovHC, function(x) vcovPC(x, cluster=\"country\")). formula (named) list formulas cluster variable(s) right-hand side (e.g., ~clusterid). named list length(models) variance-covariance matrices row column names equal names coefficient estimates. named list length(models) vectors names equal names coefficient estimates. See 'Examples' section . Warning: since list vectors can include arbitrary strings numbers, modelsummary automatically calculate p values. stars argument may thus use incorrect significance thresholds vcov list vectors. shape NULL, formula, string determines shape table. NULL: Default shape terms rows models columns. Formula: left side determines appears rows, right side determines appears columns. formula can include one group identifier(s) display related terms together, can useful models multivariate outcomes grouped coefficients (See examples section ). group identifier(s) must column names produced : get_estimates(model). group identifier(s) can combined term identifier single column using colon represent interaction. incomplete formula supplied (e.g., ~statistic), modelsummary tries complete automatically. Goodness--fit statistics appended bottom table model right hand side formula (.e., columns). Potential shape values include: term + statistic ~ model: default term ~ model + statistic: statistics separate columns model + statistic ~ term: models rows terms columns term + response + statistic ~ model: term group id separate columns term : response + statistic ~ model: term group id single column term ~ response String: \"rbind\" \"rcollapse\" bind rows two regression tables create \"panels\" \"stacks\" regression models. models argument must (potentially named) nested list models. Unnamed nested list 2 panels: list(list(model1, model2), list(model3, model4)) Named nested list 2 panels: list(\"Panel \" = list(model1, model2), \"Panel B\" = list(model3, model4)) Named panels named models: list(\"Panel \" = list(\"()\" = model1, \"(II)\" = model2), \"Panel B\" = list(\"()\" = model3, \"(II)\" = model4)) \"rbind\": Bind rows independent regression tables \"rcollapse\": Bind rows regression tables create panel bottom \"collapse\" goodness--fit statistics identical across models. coef_rename logical, named unnamed character vector, function Logical: TRUE renames variables based \"label\" attribute column. See Example section . Unnamed character vector length equal number coefficients final table, coef_omit applied. Named character vector: Values refer variable names appear table. Names refer original term names stored model object. Ex: c(\"hp:mpg\"=\"hp X mpg\") Function: Accepts character vector model's term names returns named vector like one described . modelsummary package supplies coef_rename() function can common cleaning tasks: modelsummary(model, coef_rename = coef_rename) ... arguments passed three functions. See documentation functions lists available arguments. parameters::model_parameters extracts parameter estimates. Available arguments depend model type, include: standardize, centrality, dispersion, test, ci_method, prior, diagnostic, rope_range, power, cluster, etc. performance::model_performance extracts goodness--fit statistics. Available arguments depend model type, include: metrics, estimator, etc. kableExtra::kbl gt::gt draw tables, depending value output argument.","code":""},{"path":"https://vincentarelbundock.github.io/modelsummary/dev/reference/get_gof.html","id":null,"dir":"Reference","previous_headings":"","what":"Extract model gof A mostly internal function with some potential uses\noutside. — get_gof","title":"Extract model gof A mostly internal function with some potential uses\noutside. — get_gof","text":"Extract model gof mostly internal function potential uses outside.","code":""},{"path":"https://vincentarelbundock.github.io/modelsummary/dev/reference/get_gof.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Extract model gof A mostly internal function with some potential uses\noutside. — get_gof","text":"","code":"get_gof(model, vcov_type = NULL, ...)"},{"path":"https://vincentarelbundock.github.io/modelsummary/dev/reference/get_gof.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Extract model gof A mostly internal function with some potential uses\noutside. — get_gof","text":"model single model object vcov_type string vcov type add bottom table ... arguments passed three functions. See documentation functions lists available arguments. parameters::model_parameters extracts parameter estimates. Available arguments depend model type, include: standardize, centrality, dispersion, test, ci_method, prior, diagnostic, rope_range, power, cluster, etc. performance::model_performance extracts goodness--fit statistics. Available arguments depend model type, include: metrics, estimator, etc. kableExtra::kbl gt::gt draw tables, depending value output argument.","code":""},{"path":"https://vincentarelbundock.github.io/modelsummary/dev/reference/get_gof_broom.html","id":null,"dir":"Reference","previous_headings":"","what":"Extract goodness-of-fit statistics from a single model using the\nbroom package or another package with package which supplies a\nmethod for the generics::glance generic. — get_gof_broom","title":"Extract goodness-of-fit statistics from a single model using the\nbroom package or another package with package which supplies a\nmethod for the generics::glance generic. — get_gof_broom","text":"Extract goodness--fit statistics single model using broom package another package package supplies method generics::glance generic.","code":""},{"path":"https://vincentarelbundock.github.io/modelsummary/dev/reference/get_gof_broom.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Extract goodness-of-fit statistics from a single model using the\nbroom package or another package with package which supplies a\nmethod for the generics::glance generic. — get_gof_broom","text":"","code":"get_gof_broom(model, ...)"},{"path":"https://vincentarelbundock.github.io/modelsummary/dev/reference/get_gof_parameters.html","id":null,"dir":"Reference","previous_headings":"","what":"Extract goodness-of-fit statistics from a single model using\nthe performance package — get_gof_parameters","title":"Extract goodness-of-fit statistics from a single model using\nthe performance package — get_gof_parameters","text":"Extract goodness--fit statistics single model using performance package","code":""},{"path":"https://vincentarelbundock.github.io/modelsummary/dev/reference/get_gof_parameters.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Extract goodness-of-fit statistics from a single model using\nthe performance package — get_gof_parameters","text":"","code":"get_gof_parameters(model, ...)"},{"path":"https://vincentarelbundock.github.io/modelsummary/dev/reference/get_vcov.html","id":null,"dir":"Reference","previous_headings":"","what":"Allow users to override uncertainty estimates — get_vcov","title":"Allow users to override uncertainty estimates — get_vcov","text":"Allow users override uncertainty estimates","code":""},{"path":"https://vincentarelbundock.github.io/modelsummary/dev/reference/get_vcov.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Allow users to override uncertainty estimates — get_vcov","text":"","code":"get_vcov(model, vcov = NULL, ...)"},{"path":"https://vincentarelbundock.github.io/modelsummary/dev/reference/get_vcov.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Allow users to override uncertainty estimates — get_vcov","text":"model object type available tidy method. vcov robust standard errors manual statistics. vcov argument accepts six types input (see 'Details' 'Examples' sections ): NULL returns default uncertainty estimates model object string, vector, (named) list strings. \"iid\", \"classical\", \"constant\" aliases NULL, returns model's default uncertainty estimates. strings \"HC\", \"HC0\", \"HC1\" (alias: \"stata\"), \"HC2\", \"HC3\" (alias: \"robust\"), \"HC4\", \"HC4m\", \"HC5\", \"HAC\", \"NeweyWest\", \"Andrews\", \"panel-corrected\", \"outer-product\", \"weave\" use variance-covariance matrices computed using functions sandwich package, equivalent method. behavior functions can (sometimes must) altered passing arguments sandwich directly modelsummary ellipsis (...), safer define custom functions described next bullet. function (named) list functions return variance-covariance matrices row column names equal names coefficient estimates (e.g., stats::vcov, sandwich::vcovHC, function(x) vcovPC(x, cluster=\"country\")). formula (named) list formulas cluster variable(s) right-hand side (e.g., ~clusterid). named list length(models) variance-covariance matrices row column names equal names coefficient estimates. named list length(models) vectors names equal names coefficient estimates. See 'Examples' section . Warning: since list vectors can include arbitrary strings numbers, modelsummary automatically calculate p values. stars argument may thus use incorrect significance thresholds vcov list vectors. ... arguments passed three functions. See documentation functions lists available arguments. parameters::model_parameters extracts parameter estimates. Available arguments depend model type, include: standardize, centrality, dispersion, test, ci_method, prior, diagnostic, rope_range, power, cluster, etc. performance::model_performance extracts goodness--fit statistics. Available arguments depend model type, include: metrics, estimator, etc. kableExtra::kbl gt::gt draw tables, depending value output argument.","code":""},{"path":"https://vincentarelbundock.github.io/modelsummary/dev/reference/get_vcov.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Allow users to override uncertainty estimates — get_vcov","text":"numeric vector test statistics","code":""},{"path":"https://vincentarelbundock.github.io/modelsummary/dev/reference/get_vcov.mlm.html","id":null,"dir":"Reference","previous_headings":"","what":"Allow users to override uncertainty estimates — get_vcov.mlm","title":"Allow users to override uncertainty estimates — get_vcov.mlm","text":"Allow users override uncertainty estimates","code":""},{"path":"https://vincentarelbundock.github.io/modelsummary/dev/reference/get_vcov.mlm.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Allow users to override uncertainty estimates — get_vcov.mlm","text":"","code":"# S3 method for mlm get_vcov(model, vcov = NULL, conf_level = NULL, ...)"},{"path":"https://vincentarelbundock.github.io/modelsummary/dev/reference/get_vcov.mlm.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Allow users to override uncertainty estimates — get_vcov.mlm","text":"model object type available tidy method. vcov robust standard errors manual statistics. vcov argument accepts six types input (see 'Details' 'Examples' sections ): NULL returns default uncertainty estimates model object string, vector, (named) list strings. \"iid\", \"classical\", \"constant\" aliases NULL, returns model's default uncertainty estimates. strings \"HC\", \"HC0\", \"HC1\" (alias: \"stata\"), \"HC2\", \"HC3\" (alias: \"robust\"), \"HC4\", \"HC4m\", \"HC5\", \"HAC\", \"NeweyWest\", \"Andrews\", \"panel-corrected\", \"outer-product\", \"weave\" use variance-covariance matrices computed using functions sandwich package, equivalent method. behavior functions can (sometimes must) altered passing arguments sandwich directly modelsummary ellipsis (...), safer define custom functions described next bullet. function (named) list functions return variance-covariance matrices row column names equal names coefficient estimates (e.g., stats::vcov, sandwich::vcovHC, function(x) vcovPC(x, cluster=\"country\")). formula (named) list formulas cluster variable(s) right-hand side (e.g., ~clusterid). named list length(models) variance-covariance matrices row column names equal names coefficient estimates. named list length(models) vectors names equal names coefficient estimates. See 'Examples' section . Warning: since list vectors can include arbitrary strings numbers, modelsummary automatically calculate p values. stars argument may thus use incorrect significance thresholds vcov list vectors. ... arguments passed three functions. See documentation functions lists available arguments. parameters::model_parameters extracts parameter estimates. Available arguments depend model type, include: standardize, centrality, dispersion, test, ci_method, prior, diagnostic, rope_range, power, cluster, etc. performance::model_performance extracts goodness--fit statistics. Available arguments depend model type, include: metrics, estimator, etc. kableExtra::kbl gt::gt draw tables, depending value output argument.","code":""},{"path":"https://vincentarelbundock.github.io/modelsummary/dev/reference/get_vcov.mlm.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Allow users to override uncertainty estimates — get_vcov.mlm","text":"numeric vector test statistics","code":""},{"path":"https://vincentarelbundock.github.io/modelsummary/dev/reference/glance_custom.html","id":null,"dir":"Reference","previous_headings":"","what":"Extract custom information from a model object and turn it into a tidy\ndata.frame or tibble with a single row. — glance_custom","title":"Extract custom information from a model object and turn it into a tidy\ndata.frame or tibble with a single row. — glance_custom","text":"customize output model class lm, can define new method called glance_custom.lm returns one-row data.frame.","code":""},{"path":"https://vincentarelbundock.github.io/modelsummary/dev/reference/glance_custom.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Extract custom information from a model object and turn it into a tidy\ndata.frame or tibble with a single row. — glance_custom","text":"","code":"glance_custom(x, ...)"},{"path":"https://vincentarelbundock.github.io/modelsummary/dev/reference/glance_custom.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Extract custom information from a model object and turn it into a tidy\ndata.frame or tibble with a single row. — glance_custom","text":"x model R object convert single-row data frame ... ellipsis","code":""},{"path":"https://vincentarelbundock.github.io/modelsummary/dev/reference/glance_custom_internal.default.html","id":null,"dir":"Reference","previous_headings":"","what":"Avoid namespace conflict when we want to customize glance internally and\nstill allow users to do the same with their own functions — glance_custom_internal.default","title":"Avoid namespace conflict when we want to customize glance internally and\nstill allow users to do the same with their own functions — glance_custom_internal.default","text":"Avoid namespace conflict want customize glance internally still allow users functions","code":""},{"path":"https://vincentarelbundock.github.io/modelsummary/dev/reference/glance_custom_internal.default.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Avoid namespace conflict when we want to customize glance internally and\nstill allow users to do the same with their own functions — glance_custom_internal.default","text":"","code":"# S3 method for default glance_custom_internal(x, ...)"},{"path":"https://vincentarelbundock.github.io/modelsummary/dev/reference/glance_custom_internal.html","id":null,"dir":"Reference","previous_headings":"","what":"Avoid namespace conflict when we want to customize glance internally and\nstill allow users to do the same with their own functions — glance_custom_internal","title":"Avoid namespace conflict when we want to customize glance internally and\nstill allow users to do the same with their own functions — glance_custom_internal","text":"Avoid namespace conflict want customize glance internally still allow users functions","code":""},{"path":"https://vincentarelbundock.github.io/modelsummary/dev/reference/glance_custom_internal.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Avoid namespace conflict when we want to customize glance internally and\nstill allow users to do the same with their own functions — glance_custom_internal","text":"","code":"glance_custom_internal(x, ...)"},{"path":"https://vincentarelbundock.github.io/modelsummary/dev/reference/glance_custom_internal.lm.html","id":null,"dir":"Reference","previous_headings":"","what":"Avoid namespace conflict when we want to customize glance internally and\nstill allow users to do the same with their own functions — glance_custom_internal.lm","title":"Avoid namespace conflict when we want to customize glance internally and\nstill allow users to do the same with their own functions — glance_custom_internal.lm","text":"Avoid namespace conflict want customize glance internally still allow users functions","code":""},{"path":"https://vincentarelbundock.github.io/modelsummary/dev/reference/glance_custom_internal.lm.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Avoid namespace conflict when we want to customize glance internally and\nstill allow users to do the same with their own functions — glance_custom_internal.lm","text":"","code":"# S3 method for lm glance_custom_internal(x, vcov_type = NULL, gof = NULL, ...)"},{"path":"https://vincentarelbundock.github.io/modelsummary/dev/reference/gof_map.html","id":null,"dir":"Reference","previous_headings":"","what":"Data.frame used to clean up and format goodness-of-fit statistics — gof_map","title":"Data.frame used to clean up and format goodness-of-fit statistics — gof_map","text":"default, data frame passed 'gof_map' argument 'modelsummary' function. Users can modify data frame customize list statistics display format. See example .","code":""},{"path":"https://vincentarelbundock.github.io/modelsummary/dev/reference/gof_map.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Data.frame used to clean up and format goodness-of-fit statistics — gof_map","text":"","code":"gof_map"},{"path":"https://vincentarelbundock.github.io/modelsummary/dev/reference/gof_map.html","id":"format","dir":"Reference","previous_headings":"","what":"Format","title":"Data.frame used to clean up and format goodness-of-fit statistics — gof_map","text":"data.frame 4 columns character data: raw, clean, fmt, omit","code":""},{"path":"https://vincentarelbundock.github.io/modelsummary/dev/reference/gof_map.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Data.frame used to clean up and format goodness-of-fit statistics — gof_map","text":"","code":"if (identical(Sys.getenv(\"pkgdown\"), \"true\")) { library(modelsummary) mod <- lm(wt ~ drat, data = mtcars) gm <- modelsummary::gof_map gm$omit[gm$raw == 'deviance'] <- FALSE gm$fmt[gm$raw == 'r.squared'] <- \"%.5f\" modelsummary(mod, gof_map = gm) } #> Error: Assertion failed. One of the following must apply: #> * checkmate::check_numeric(fmt): Must be of type 'numeric', not #> * 'character' #> * checkmate::check_class(fmt): Must inherit from class 'fmt_factory', #> * but has class 'character' #> * checkmate::check_function(fmt): Must be a function, not 'character' #> * checkmate::check_string(fmt): Must comply to pattern '%' #> * checkmate::check_null(fmt): Must be NULL"},{"path":"https://vincentarelbundock.github.io/modelsummary/dev/reference/hush.html","id":null,"dir":"Reference","previous_headings":"","what":"Execute code silently — hush","title":"Execute code silently — hush","text":"Execute code silently","code":""},{"path":"https://vincentarelbundock.github.io/modelsummary/dev/reference/hush.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Execute code silently — hush","text":"","code":"hush(code)"},{"path":"https://vincentarelbundock.github.io/modelsummary/dev/reference/labelSubset.html","id":null,"dir":"Reference","previous_headings":"","what":"Add a label to a logical vector. — labelSubset","title":"Add a label to a logical vector. — labelSubset","text":"objects imported packages. Follow links see documentation. tables labelSubset","code":""},{"path":"https://vincentarelbundock.github.io/modelsummary/dev/reference/map_estimates.html","id":null,"dir":"Reference","previous_headings":"","what":"rename and reorder estimates from a single model\n(before merging to collapse) — map_estimates","title":"rename and reorder estimates from a single model\n(before merging to collapse) — map_estimates","text":"rename reorder estimates single model (merging collapse)","code":""},{"path":"https://vincentarelbundock.github.io/modelsummary/dev/reference/map_estimates.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"rename and reorder estimates from a single model\n(before merging to collapse) — map_estimates","text":"","code":"map_estimates(estimates, coef_rename, coef_map, coef_omit, group_map)"},{"path":"https://vincentarelbundock.github.io/modelsummary/dev/reference/map_gof.html","id":null,"dir":"Reference","previous_headings":"","what":"Internal function to subset, rename and re-order gof statistics — map_gof","title":"Internal function to subset, rename and re-order gof statistics — map_gof","text":"Internal function subset, rename re-order gof statistics","code":""},{"path":"https://vincentarelbundock.github.io/modelsummary/dev/reference/map_gof.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Internal function to subset, rename and re-order gof statistics — map_gof","text":"","code":"map_gof(gof, gof_omit, gof_map)"},{"path":"https://vincentarelbundock.github.io/modelsummary/dev/reference/modelplot.html","id":null,"dir":"Reference","previous_headings":"","what":"Model Summary Plots with Estimates and Confidence Intervals — modelplot","title":"Model Summary Plots with Estimates and Confidence Intervals — modelplot","text":"Dot-Whisker plot coefficient estimates confidence intervals. information, see Details Examples sections , vignettes modelsummary website: https://vincentarelbundock.github.io/modelsummary/ modelplot Vignette.","code":""},{"path":"https://vincentarelbundock.github.io/modelsummary/dev/reference/modelplot.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Model Summary Plots with Estimates and Confidence Intervals — modelplot","text":"","code":"modelplot( models, conf_level = 0.95, coef_map = NULL, coef_omit = NULL, coef_rename = NULL, vcov = NULL, exponentiate = FALSE, add_rows = NULL, facet = FALSE, draw = TRUE, background = NULL, ... )"},{"path":"https://vincentarelbundock.github.io/modelsummary/dev/reference/modelplot.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Model Summary Plots with Estimates and Confidence Intervals — modelplot","text":"models model, (named) list models, nested list models. Single model: modelsummary(model) Unnamed list models: modelsummary(list(model1, model2)) Models labelled automatically. default label style can altered setting global option. See . Named list models: modelsummary(list(\"\"=model1, \"B\"=model2)) Models labelled using list names. Nested list models: using shape=\"rbind\" argument, models can nested list models display \"panels\" \"stacks\" regression models. See shape argument documentation examples . conf_level numeric value 0 1. confidence level use confidence intervals. Setting argument NULL extract confidence intervals, can faster models. coef_map character vector. Subset, rename, reorder coefficients. Coefficients omitted vector omitted table. order vector determines order table. coef_map can named unnamed character vector. coef_map named vector, values define labels must appear table, names identify original term names stored model object: c(\"hp:mpg\"=\"HPxM/G\"). See Examples section . coef_omit integer vector regular expression identify coefficients omit (keep) table. Positive integers determine coefficients omit. Negative integers determine coefficients keep. regular expression can used omit coefficients, perl-compatible \"negative lookaheads\" can used specify coefficients keep table. Examples: c(2, 3, 5): omits second, third, fifth coefficients. c(-2, -3, -5): negative values keep second, third, fifth coefficients. \"ei\": omit coefficients matching \"ei\" substring. \"^Volume$\": omit \"Volume\" coefficient. \"ei|rc\": omit coefficients matching either \"ei\" \"rc\" substrings. \"^(?!Vol)\": keep coefficients starting \"Vol\" (inverse match using negative lookahead). \"^(?!.*ei)\": keep coefficients matching \"ei\" substring. \"^(?!.*ei|.*pt)\": keep coefficients matching either \"ei\" \"pt\" substrings. See Examples section complete code. coef_rename logical, named unnamed character vector, function Logical: TRUE renames variables based \"label\" attribute column. See Example section . Unnamed character vector length equal number coefficients final table, coef_omit applied. Named character vector: Values refer variable names appear table. Names refer original term names stored model object. Ex: c(\"hp:mpg\"=\"hp X mpg\") Function: Accepts character vector model's term names returns named vector like one described . modelsummary package supplies coef_rename() function can common cleaning tasks: modelsummary(model, coef_rename = coef_rename) vcov robust standard errors manual statistics. vcov argument accepts six types input (see 'Details' 'Examples' sections ): NULL returns default uncertainty estimates model object string, vector, (named) list strings. \"iid\", \"classical\", \"constant\" aliases NULL, returns model's default uncertainty estimates. strings \"HC\", \"HC0\", \"HC1\" (alias: \"stata\"), \"HC2\", \"HC3\" (alias: \"robust\"), \"HC4\", \"HC4m\", \"HC5\", \"HAC\", \"NeweyWest\", \"Andrews\", \"panel-corrected\", \"outer-product\", \"weave\" use variance-covariance matrices computed using functions sandwich package, equivalent method. behavior functions can (sometimes must) altered passing arguments sandwich directly modelsummary ellipsis (...), safer define custom functions described next bullet. function (named) list functions return variance-covariance matrices row column names equal names coefficient estimates (e.g., stats::vcov, sandwich::vcovHC, function(x) vcovPC(x, cluster=\"country\")). formula (named) list formulas cluster variable(s) right-hand side (e.g., ~clusterid). named list length(models) variance-covariance matrices row column names equal names coefficient estimates. named list length(models) vectors names equal names coefficient estimates. See 'Examples' section . Warning: since list vectors can include arbitrary strings numbers, modelsummary automatically calculate p values. stars argument may thus use incorrect significance thresholds vcov list vectors. exponentiate TRUE, FALSE, logical vector length equal number models. TRUE, estimate, conf.low, conf.high statistics exponentiated, std.error transformed exp(estimate)*std.error. add_rows data.frame (tibble) number columns main table. default, rows appended bottom table. can define \"position\" attribute integers set row positions. See Examples section . facet TRUE FALSE. 'models' argument includes several model objects, TRUE draws terms separate facets, FALSE draws terms side--side (dodged). draw TRUE returns 'ggplot2' object, FALSE returns data.frame used draw plot. background list 'ggplot2' geoms add background plot. especially useful display annotations \"behind\" 'geom_pointrange' 'modelplot' draws. ... arguments passed three functions. See documentation functions lists available arguments. parameters::model_parameters extracts parameter estimates. Available arguments depend model type, include: standardize, centrality, dispersion, test, ci_method, prior, diagnostic, rope_range, power, cluster, etc. performance::model_performance extracts goodness--fit statistics. Available arguments depend model type, include: metrics, estimator, etc. kableExtra::kbl gt::gt draw tables, depending value output argument.","code":""},{"path":"https://vincentarelbundock.github.io/modelsummary/dev/reference/modelplot.html","id":"examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Model Summary Plots with Estimates and Confidence Intervals — modelplot","text":"","code":"library(modelsummary) # single model mod <- lm(hp ~ vs + drat, mtcars) modelplot(mod) # omit terms with string matches or regexes modelplot(mod, coef_omit = 'Interc') # rename, reorder and subset with 'coef_map' cm <- c('vs' = 'V-shape engine', 'drat' = 'Rear axle ratio') modelplot(mod, coef_map = cm) # several models models <- list() models[['Small model']] <- lm(hp ~ vs, mtcars) models[['Medium model']] <- lm(hp ~ vs + factor(cyl), mtcars) models[['Large model']] <- lm(hp ~ vs + drat + factor(cyl), mtcars) modelplot(models) # add_rows: add an empty reference category mod <- lm(hp ~ factor(cyl), mtcars) add_rows = data.frame( term = \"factory(cyl)4\", model = \"(1)\", estimate = NA) attr(add_rows, \"position\") = 3 modelplot(mod, add_rows = add_rows) # customize your plots with 'ggplot2' functions library(ggplot2) modelplot(models) + scale_color_brewer(type = 'qual') + theme_classic() # pass arguments to 'geom_pointrange' through the ... ellipsis modelplot(mod, color = 'red', size = 1, fatten = .5) # add geoms to the background, behind geom_pointrange b <- list(geom_vline(xintercept = 0, color = 'orange'), annotate(\"rect\", alpha = .1, xmin = -.5, xmax = .5, ymin = -Inf, ymax = Inf), geom_point(aes(y = term, x = estimate), alpha = .3, size = 10, color = 'red', shape = 'square')) modelplot(mod, background = b) # logistic regression example df <- as.data.frame(Titanic) mod_titanic <- glm( Survived ~ Class + Sex, family = binomial, weight = Freq, data = df ) # displaying odds ratio using a log scale modelplot(mod_titanic, exponentiate = TRUE) + scale_x_log10() + xlab(\"Odds Ratios and 95% confidence intervals\")"},{"path":"https://vincentarelbundock.github.io/modelsummary/dev/reference/modelplot.html","id":"references","dir":"Reference","previous_headings":"","what":"References","title":"Model Summary Plots with Estimates and Confidence Intervals — modelplot","text":"Arel-Bundock V (2022). “modelsummary: Data Model Summaries R.” Journal Statistical Software, 103(1), 1-23. doi:10.18637/jss.v103.i01 .'","code":""},{"path":"https://vincentarelbundock.github.io/modelsummary/dev/reference/modelsummary.html","id":null,"dir":"Reference","previous_headings":"","what":"Model Summary Tables — modelsummary","title":"Model Summary Tables — modelsummary","text":"Create beautiful customizable tables summarize several statistical models side--side. function supports dozens statistical models, can produce tables HTML, LaTeX, Word, Markdown, PDF, PowerPoint, Excel, RTF, JPG, PNG. appearance tables can customized extensively specifying output argument, using functions one supported table customization packages: kableExtra, gt, flextable, huxtable, DT. information, see Details Examples sections , vignettes modelsummary website: https://vincentarelbundock.github.io/modelsummary/ modelsummary Vignette includes dozens examples tables extensive customizations. Appearance Vignette shows modify look tables.","code":""},{"path":"https://vincentarelbundock.github.io/modelsummary/dev/reference/modelsummary.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Model Summary Tables — modelsummary","text":"","code":"modelsummary( models, output = \"default\", fmt = 3, estimate = \"estimate\", statistic = \"std.error\", vcov = NULL, conf_level = 0.95, exponentiate = FALSE, stars = FALSE, shape = term + statistic ~ model, coef_map = NULL, coef_omit = NULL, coef_rename = FALSE, gof_map = NULL, gof_omit = NULL, group_map = NULL, add_columns = NULL, add_rows = NULL, align = NULL, notes = NULL, title = NULL, escape = TRUE, ... )"},{"path":"https://vincentarelbundock.github.io/modelsummary/dev/reference/modelsummary.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Model Summary Tables — modelsummary","text":"models model, (named) list models, nested list models. Single model: modelsummary(model) Unnamed list models: modelsummary(list(model1, model2)) Models labelled automatically. default label style can altered setting global option. See . Named list models: modelsummary(list(\"\"=model1, \"B\"=model2)) Models labelled using list names. Nested list models: using shape=\"rbind\" argument, models can nested list models display \"panels\" \"stacks\" regression models. See shape argument documentation examples . output filename object type (character string) Supported filename extensions: .docx, .html, .tex, .md, .txt, .csv, .xlsx, .png, .jpg Supported object types: \"default\", \"html\", \"markdown\", \"latex\", \"latex_tabular\", \"data.frame\", \"gt\", \"kableExtra\", \"huxtable\", \"flextable\", \"DT\", \"jupyter\". \"modelsummary_list\" value produces lightweight object can saved fed back modelsummary function. \"default\" output format can set \"kableExtra\", \"gt\", \"flextable\", \"huxtable\", \"DT\", \"markdown\" user choose default value, packages listed tried sequence. Session-specific configuration: options(\"modelsummary_factory_default\" = \"gt\") Persistent configuration: config_modelsummary(output = \"markdown\") Warning: Users supply file name output argument intend customize table external packages. See 'Details' section. LaTeX compilation requires booktabs siunitx packages, siunitx can disabled replaced global options. See 'Details' section. fmt format numeric values: integer, user-supplied function, modelsummary function. Integer: Number decimal digits User-supplied functions: function accepts numeric vector returns character vector length. modelsummary functions: fmt = fmt_significant(2): Two significant digits (term-level) fmt = fmt_decimal(digits = 2, pdigits = 3): Decimal digits estimate p values fmt = fmt_sprintf(\"%.3f\"): See ?sprintf fmt = fmt_term(\"(Intercept)\" = 1, \"X\" = 2): Format terms differently fmt = fmt_statistic(\"estimate\" = 1, \"r.sqared\" = 6): Format statistics differently. fmt = fmt_identity(): unformatted raw values string: Note LaTeX output: ensure proper typography, numeric entries enclosed \\num{} command, requires siunitx package loaded LaTeX preamble. behavior can altered global options. See 'Details' section. estimate single string character vector length equal number models. Valid entries include column name data.frame produced get_estimates(model), strings curly braces compatible glue package format. Examples: \"estimate\" \"{estimate} ({std.error}){stars}\" \"{estimate} [{conf.low}, {conf.high}]\" statistic vector strings glue strings select uncertainty statistics report vertically estimate. NULL omits uncertainty statistics. \"conf.int\", \"std.error\", \"statistic\", \"p.value\", \"conf.low\", \"conf.high\", . column name produced get_estimates(model) glue package strings braces, without R functions, : \"{p.value} [{conf.low}, {conf.high}]\" \"Std.Error: {std.error}\" `\"exp(estimate) * std.error\" Numbers automatically rounded converted strings. apply functions numeric values, last glue example, users must set fmt=NULL. Parentheses added automatically unless string includes glue curly braces {}. statistics supported models. See column names get_estimates(model), visit website learn add custom statistics. vcov robust standard errors manual statistics. vcov argument accepts six types input (see 'Details' 'Examples' sections ): NULL returns default uncertainty estimates model object string, vector, (named) list strings. \"iid\", \"classical\", \"constant\" aliases NULL, returns model's default uncertainty estimates. strings \"HC\", \"HC0\", \"HC1\" (alias: \"stata\"), \"HC2\", \"HC3\" (alias: \"robust\"), \"HC4\", \"HC4m\", \"HC5\", \"HAC\", \"NeweyWest\", \"Andrews\", \"panel-corrected\", \"outer-product\", \"weave\" use variance-covariance matrices computed using functions sandwich package, equivalent method. behavior functions can (sometimes must) altered passing arguments sandwich directly modelsummary ellipsis (...), safer define custom functions described next bullet. function (named) list functions return variance-covariance matrices row column names equal names coefficient estimates (e.g., stats::vcov, sandwich::vcovHC, function(x) vcovPC(x, cluster=\"country\")). formula (named) list formulas cluster variable(s) right-hand side (e.g., ~clusterid). named list length(models) variance-covariance matrices row column names equal names coefficient estimates. named list length(models) vectors names equal names coefficient estimates. See 'Examples' section . Warning: since list vectors can include arbitrary strings numbers, modelsummary automatically calculate p values. stars argument may thus use incorrect significance thresholds vcov list vectors. conf_level numeric value 0 1. confidence level use confidence intervals. Setting argument NULL extract confidence intervals, can faster models. exponentiate TRUE, FALSE, logical vector length equal number models. TRUE, estimate, conf.low, conf.high statistics exponentiated, std.error transformed exp(estimate)*std.error. stars indicate statistical significance FALSE (default): significance stars. TRUE: +=.1, *=.05, **=.01, ***=0.001 Named numeric vector custom stars c('*' = .1, '+' = .05) Note: legend inserted bottom table estimate statistic arguments use \"glue strings\" {stars}. shape NULL, formula, string determines shape table. NULL: Default shape terms rows models columns. Formula: left side determines appears rows, right side determines appears columns. formula can include one group identifier(s) display related terms together, can useful models multivariate outcomes grouped coefficients (See examples section ). group identifier(s) must column names produced : get_estimates(model). group identifier(s) can combined term identifier single column using colon represent interaction. incomplete formula supplied (e.g., ~statistic), modelsummary tries complete automatically. Goodness--fit statistics appended bottom table model right hand side formula (.e., columns). Potential shape values include: term + statistic ~ model: default term ~ model + statistic: statistics separate columns model + statistic ~ term: models rows terms columns term + response + statistic ~ model: term group id separate columns term : response + statistic ~ model: term group id single column term ~ response String: \"rbind\" \"rcollapse\" bind rows two regression tables create \"panels\" \"stacks\" regression models. models argument must (potentially named) nested list models. Unnamed nested list 2 panels: list(list(model1, model2), list(model3, model4)) Named nested list 2 panels: list(\"Panel \" = list(model1, model2), \"Panel B\" = list(model3, model4)) Named panels named models: list(\"Panel \" = list(\"()\" = model1, \"(II)\" = model2), \"Panel B\" = list(\"()\" = model3, \"(II)\" = model4)) \"rbind\": Bind rows independent regression tables \"rcollapse\": Bind rows regression tables create panel bottom \"collapse\" goodness--fit statistics identical across models. coef_map character vector. Subset, rename, reorder coefficients. Coefficients omitted vector omitted table. order vector determines order table. coef_map can named unnamed character vector. coef_map named vector, values define labels must appear table, names identify original term names stored model object: c(\"hp:mpg\"=\"HPxM/G\"). See Examples section . coef_omit integer vector regular expression identify coefficients omit (keep) table. Positive integers determine coefficients omit. Negative integers determine coefficients keep. regular expression can used omit coefficients, perl-compatible \"negative lookaheads\" can used specify coefficients keep table. Examples: c(2, 3, 5): omits second, third, fifth coefficients. c(-2, -3, -5): negative values keep second, third, fifth coefficients. \"ei\": omit coefficients matching \"ei\" substring. \"^Volume$\": omit \"Volume\" coefficient. \"ei|rc\": omit coefficients matching either \"ei\" \"rc\" substrings. \"^(?!Vol)\": keep coefficients starting \"Vol\" (inverse match using negative lookahead). \"^(?!.*ei)\": keep coefficients matching \"ei\" substring. \"^(?!.*ei|.*pt)\": keep coefficients matching either \"ei\" \"pt\" substrings. See Examples section complete code. coef_rename logical, named unnamed character vector, function Logical: TRUE renames variables based \"label\" attribute column. See Example section . Unnamed character vector length equal number coefficients final table, coef_omit applied. Named character vector: Values refer variable names appear table. Names refer original term names stored model object. Ex: c(\"hp:mpg\"=\"hp X mpg\") Function: Accepts character vector model's term names returns named vector like one described . modelsummary package supplies coef_rename() function can common cleaning tasks: modelsummary(model, coef_rename = coef_rename) gof_map rename, reorder, omit goodness--fit statistics model information. argument accepts 4 types values: NULL (default): modelsummary::gof_map dictionary used formatting, unknown statistic included. character vector: \"\", \"none\", vector statistics c(\"rmse\", \"nobs\", \"r.squared\"). Elements correspond colnames data.frame produced get_gof(model). modelsummary::gof_map default dictionary used format rename statistics. NA: excludes statistics bottom part table. data.frame 3 columns named \"raw\", \"clean\", \"fmt\". Unknown statistics omitted. See 'Examples' section . list lists, includes 3 elements named \"raw\", \"clean\", \"fmt\". Unknown statistics omitted. See 'Examples section '. gof_omit string regular expression (perl-compatible) used determine statistics omit bottom section table. \"negative lookahead\" can used specify statistics keep table. Examples: \"IC\": omit statistics matching \"IC\" substring. \"BIC|AIC\": omit statistics matching \"AIC\" \"BIC\" substrings. \"^(?!.*IC)\": keep statistics matching \"IC\" substring. group_map named unnamed character vector. Subset, rename, reorder coefficient groups specified grouping variable specified shape argument formula. argument behaves like coef_map. add_columns data.frame (tibble) number rows #' main table. default, rows appended bottom table. can define \"position\" attribute integers set columns positions. See Examples section . add_rows data.frame (tibble) number columns main table. default, rows appended bottom table. can define \"position\" attribute integers set row positions. See Examples section . align string number characters equal number columns table (e.g., align = \"lcc\"). Valid characters: l, c, r, d. \"l\": left-aligned column \"c\": centered column \"r\": right-aligned column \"d\": dot-aligned column. LaTeX/PDF output, option requires least version 3.0.25 siunitx LaTeX package. commands must appear LaTeX preamble (added automatically compiling Rmarkdown documents PDF): \\usepackage{booktabs} \\usepackage{siunitx} \\newcolumntype{d}{S[ input-open-uncertainty=, input-close-uncertainty=, parse-numbers = false, table-align-text-pre=false, table-align-text-post=false ]} notes list vector notes append bottom table. title string escape boolean TRUE escapes substitutes LaTeX/HTML characters prevent file compiling/displaying. setting affect captions notes. ... arguments passed three functions. See documentation functions lists available arguments. parameters::model_parameters extracts parameter estimates. Available arguments depend model type, include: standardize, centrality, dispersion, test, ci_method, prior, diagnostic, rope_range, power, cluster, etc. performance::model_performance extracts goodness--fit statistics. Available arguments depend model type, include: metrics, estimator, etc. kableExtra::kbl gt::gt draw tables, depending value output argument.","code":""},{"path":"https://vincentarelbundock.github.io/modelsummary/dev/reference/modelsummary.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Model Summary Tables — modelsummary","text":"regression table format determined output argument.","code":""},{"path":[]},{"path":"https://vincentarelbundock.github.io/modelsummary/dev/reference/modelsummary.html","id":"output","dir":"Reference","previous_headings":"","what":"output","title":"Model Summary Tables — modelsummary","text":"modelsummary_list output lightweight format can used save model results, can fed back modelsummary later avoid extracting results . file name valid extension supplied output argument, table written immediately file. want customize table post-processing external package, need choose different output format saving mechanism. Unfortunately, approach differs package package: gt: set output=\"gt\", post-process table, use gt::gtsave function. kableExtra: set output destination format (e.g., \"latex\", \"html\", \"markdown\"), post-process table, use kableExtra::save_kable function.","code":""},{"path":"https://vincentarelbundock.github.io/modelsummary/dev/reference/modelsummary.html","id":"vcov","dir":"Reference","previous_headings":"","what":"vcov","title":"Model Summary Tables — modelsummary","text":"use string \"robust\" \"HC0\", model must supported sandwich package. includes objects : lm, glm, survreg, coxph, mlogit, polr, hurdle, zeroinfl, . NULL, \"classical\", \"iid\", \"constant\" aliases modify uncertainty estimates simply report default standard errors stored model object. One-sided formulas ~clusterid passed sandwich::vcovCL function. Matrices functions producing variance-covariance matrices first passed lmtest. work, modelsummary attempts take square root diagonal adjust \"std.error\", uncertainty estimates adjusted. Numeric vectors formatted according fmt placed brackets. Character vectors printed given, without parentheses. model type supported lmtest package, vcov argument try use package adjust uncertainty estimates, including \"std.error\", \"statistic\", \"p.value\", \"conf.int\". model supported lmtest, \"std.error\" adjusted , example, taking square root matrix's diagonal.","code":""},{"path":"https://vincentarelbundock.github.io/modelsummary/dev/reference/modelsummary.html","id":"global-options","dir":"Reference","previous_headings":"","what":"Global Options","title":"Model Summary Tables — modelsummary","text":"behavior modelsummary can modified setting global options. example: options(modelsummary_model_labels = \"roman\") rest section describes options .","code":""},{"path":"https://vincentarelbundock.github.io/modelsummary/dev/reference/modelsummary.html","id":"model-labels-default-column-names","dir":"Reference","previous_headings":"","what":"Model labels: default column names","title":"Model Summary Tables — modelsummary","text":"global option changes style default column headers: options(modelsummary_model_labels = \"roman\") options(modelsummary_panel_labels = \"roman\") supported styles : \"model\", \"panel\", \"arabic\", \"letters\", \"roman\", \"(arabic)\", \"(letters)\", \"(roman)\"\" panel-specific option used shape=\"rbind\"","code":""},{"path":"https://vincentarelbundock.github.io/modelsummary/dev/reference/modelsummary.html","id":"table-making-packages","dir":"Reference","previous_headings":"","what":"Table-making packages","title":"Model Summary Tables — modelsummary","text":"modelsummary supports 4 table-making packages: kableExtra, gt, flextable, huxtable, DT. packages overlapping functionalities. example, 3 packages can export LaTeX. change default backend used specific file format, can use options function: options(modelsummary_factory_html = 'kableExtra') options(modelsummary_factory_latex = 'gt') options(modelsummary_factory_word = 'huxtable') options(modelsummary_factory_png = 'gt')","code":""},{"path":"https://vincentarelbundock.github.io/modelsummary/dev/reference/modelsummary.html","id":"table-themes","dir":"Reference","previous_headings":"","what":"Table themes","title":"Model Summary Tables — modelsummary","text":"Change look tables automated replicable way, using modelsummary theming functionality. See vignette: https://vincentarelbundock.github.io/modelsummary/articles/appearance.html modelsummary_theme_gt modelsummary_theme_kableExtra modelsummary_theme_huxtable modelsummary_theme_flextable modelsummary_theme_dataframe","code":""},{"path":"https://vincentarelbundock.github.io/modelsummary/dev/reference/modelsummary.html","id":"model-extraction-functions","dir":"Reference","previous_headings":"","what":"Model extraction functions","title":"Model Summary Tables — modelsummary","text":"modelsummary can use two sets packages extract information statistical models: easystats family (performance parameters) broom. default, uses easystats first falls back broom case failure. can change order priorities include goodness--fit extracted packages setting: options(modelsummary_get = \"broom\") options(modelsummary_get = \"easystats\") options(modelsummary_get = \"\")","code":""},{"path":"https://vincentarelbundock.github.io/modelsummary/dev/reference/modelsummary.html","id":"formatting-numeric-entries","dir":"Reference","previous_headings":"","what":"Formatting numeric entries","title":"Model Summary Tables — modelsummary","text":"default, LaTeX tables enclose numeric entries \\num{} command siunitx package. prevent behavior, enclose numbers dollar signs (LaTeX math mode), users can call: options(modelsummary_format_numeric_latex = \"plain\") options(modelsummary_format_numeric_latex = \"mathmode\") similar option can used display numerical entries using MathJax HTML tables: options(modelsummary_format_numeric_html = \"mathjax\")","code":""},{"path":"https://vincentarelbundock.github.io/modelsummary/dev/reference/modelsummary.html","id":"parallel-computation","dir":"Reference","previous_headings":"","what":"Parallel computation","title":"Model Summary Tables — modelsummary","text":"can take long time compute extract summary statistics certain models (e.g., Bayesian). cases, users can parallelize process. Since parallelization occurs model level, speedup available tables single model. Users mac linux can launch parallel computation using built-parallel package. need supply mc.cores argument pushed forward parallel::mclapply function: users can also use future.apply package parallelize model summaries. example, use 4 cores extract results: Note \"multicore\" plan parallelizes mac linux. Windows users can use plan(multisession) instead. However, note first time modelsummary() called multisession can fair bit longer, extra costs passing data loading required packages workers. Subsequent calls modelsummary() often much faster. users reported difficult reproduce errors using future package packages. future parallelization modelsummary can disabled calling: options(\"modelsummary_future\" = FALSE)","code":"modelsummary(model_list, mc.cores = 5) library(future.apply) plan(multicore, workers = 4) options(\"modelsummary_future\" = TRUE) modelsummary(model_list)"},{"path":"https://vincentarelbundock.github.io/modelsummary/dev/reference/modelsummary.html","id":"examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Model Summary Tables — modelsummary","text":"","code":"library(modelsummary) # load data and estimate models utils::data(trees) models <- list() models[['Bivariate']] <- lm(Girth ~ Height, data = trees) models[['Multivariate']] <- lm(Girth ~ Height + Volume, data = trees) # simple table modelsummary(models) # statistic modelsummary(models, statistic = NULL) modelsummary(models, statistic = 'p.value') modelsummary(models, statistic = 'statistic') modelsummary(models, statistic = 'conf.int', conf_level = 0.99) modelsummary(models, statistic = c(\"t = {statistic}\", \"se = {std.error}\", \"conf.int\")) # estimate modelsummary(models, statistic = NULL, estimate = \"{estimate} [{conf.low}, {conf.high}]\") modelsummary(models, estimate = c(\"{estimate}{stars}\", \"{estimate} ({std.error})\")) # vcov modelsummary(models, vcov = \"robust\") modelsummary(models, vcov = list(\"classical\", \"stata\")) modelsummary(models, vcov = sandwich::vcovHC) modelsummary(models, vcov = list(stats::vcov, sandwich::vcovHC)) modelsummary(models, vcov = list(c(\"(Intercept)\"=\"\", \"Height\"=\"!\"), c(\"(Intercept)\"=\"\", \"Height\"=\"!\", \"Volume\"=\"!!\"))) # vcov with custom names modelsummary( models, vcov = list(\"Stata Corp\" = \"stata\", \"Newey Lewis & the News\" = \"NeweyWest\")) # fmt mod <- lm(mpg ~ hp + drat + qsec, data = mtcars) modelsummary(mod, fmt = 3) modelsummary(mod, fmt = fmt_significant(3)) modelsummary(mod, fmt = NULL) modelsummary(mod, fmt = fmt_decimal(4)) modelsummary(mod, fmt = fmt_sprintf(\"%.5f\")) modelsummary(mod, fmt = fmt_statistic(estimate = 4, conf.int = 1), statistic = \"conf.int\") modelsummary(mod, fmt = fmt_term(hp = 4, drat = 1, default = 2)) m <- lm(mpg ~ I(hp * 1000) + drat, data = mtcars) f <- function(x) format(x, digits = 3, nsmall = 2, scientific = FALSE, trim = TRUE) modelsummary(m, fmt = f, gof_map = NA) # coef_rename modelsummary(models, coef_rename = c('Volume' = 'Large', 'Height' = 'Tall')) modelsummary(models, coef_rename = toupper) modelsummary(models, coef_rename = coef_rename) # coef_rename = TRUE for variable labels datlab <- mtcars datlab$cyl <- factor(datlab$cyl) attr(datlab$hp, \"label\") <- \"Horsepower\" attr(datlab$cyl, \"label\") <- \"Cylinders\" modlab <- lm(mpg ~ hp * drat + cyl, data = datlab) modelsummary(modlab, coef_rename = TRUE) # coef_rename: unnamed vector of length equal to the number of terms in the final table m <- lm(hp ~ mpg + factor(cyl), data = mtcars) modelsummary(m, coef_omit = -(3:4), coef_rename = c(\"Cyl 6\", \"Cyl 8\")) # coef_map modelsummary(models, coef_map = c('Volume' = 'Large', 'Height' = 'Tall')) modelsummary(models, coef_map = c('Volume', 'Height')) # coef_omit: omit the first and second coefficients modelsummary(models, coef_omit = 1:2) # coef_omit: omit coefficients matching one substring modelsummary(models, coef_omit = \"ei\", gof_omit = \".*\") # coef_omit: omit a specific coefficient modelsummary(models, coef_omit = \"^Volume$\", gof_omit = \".*\") # coef_omit: omit coefficients matching either one of two substring #modelsummary(models, coef_omit = \"ei|rc\", gof_omit = \".*\") # coef_omit: keep coefficients starting with a substring (using a negative lookahead) #modelsummary(models, coef_omit = \"^(?!Vol)\", gof_omit = \".*\") # coef_omit: keep coefficients matching a substring modelsummary(models, coef_omit = \"^(?!.*ei|.*pt)\", gof_omit = \".*\") # shape: multinomial model library(nnet) multi <- multinom(factor(cyl) ~ mpg + hp, data = mtcars, trace = FALSE) # shape: term names and group ids in rows, models in columns modelsummary(multi, shape = response ~ model) # shape: term names and group ids in rows in a single column modelsummary(multi, shape = term : response ~ model) # shape: term names in rows and group ids in columns modelsummary(multi, shape = term ~ response:model) # shape = \"rcollapse\" panels <- list( \"Panel A: MPG\" = list( \"A\" = lm(mpg ~ hp, data = mtcars), \"B\" = lm(mpg ~ hp + factor(gear), data = mtcars)), \"Panel B: Displacement\" = list( \"A\" = lm(disp ~ hp, data = mtcars), \"C\" = lm(disp ~ hp + factor(gear), data = mtcars)) ) modelsummary( panels, shape = \"rbind\", gof_map = c(\"nobs\", \"r.squared\")) # title modelsummary(models, title = 'This is the title') # title with LaTeX label (for numbering and referencing) modelsummary(models, title = 'This is the title \\\\label{tab:description}') # add_rows rows <- tibble::tribble(~term, ~Bivariate, ~Multivariate, 'Empty row', '-', '-', 'Another empty row', '?', '?') attr(rows, 'position') <- c(1, 3) modelsummary(models, add_rows = rows) # notes modelsummary(models, notes = list('A first note', 'A second note')) # gof_map: tribble library(tibble) gm <- tribble( ~raw, ~clean, ~fmt, \"r.squared\", \"R Squared\", 5) modelsummary(models, gof_map = gm)"},{"path":"https://vincentarelbundock.github.io/modelsummary/dev/reference/modelsummary.html","id":"references","dir":"Reference","previous_headings":"","what":"References","title":"Model Summary Tables — modelsummary","text":"Arel-Bundock V (2022). “modelsummary: Data Model Summaries R.” Journal Statistical Software, 103(1), 1-23. doi:10.18637/jss.v103.i01 .'","code":""},{"path":"https://vincentarelbundock.github.io/modelsummary/dev/reference/modelsummary_wide.html","id":null,"dir":"Reference","previous_headings":"","what":"Superseded function — modelsummary_wide","title":"Superseded function — modelsummary_wide","text":"function superseded shape argument modelsummary function.","code":""},{"path":"https://vincentarelbundock.github.io/modelsummary/dev/reference/modelsummary_wide.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Superseded function — modelsummary_wide","text":"","code":"modelsummary_wide(...)"},{"path":"https://vincentarelbundock.github.io/modelsummary/dev/reference/msummary.html","id":null,"dir":"Reference","previous_headings":"","what":"msummary() is a shortcut to modelsummary() — msummary","title":"msummary() is a shortcut to modelsummary() — msummary","text":"Create beautiful customizable tables summarize several statistical models side--side. function supports dozens statistical models, can produce tables HTML, LaTeX, Word, Markdown, PDF, PowerPoint, Excel, RTF, JPG, PNG. appearance tables can customized extensively specifying output argument, using functions one supported table customization packages: kableExtra, gt, flextable, huxtable, DT. information, see Details Examples sections , vignettes modelsummary website: https://vincentarelbundock.github.io/modelsummary/ modelsummary Vignette includes dozens examples tables extensive customizations. Appearance Vignette shows modify look tables.","code":""},{"path":"https://vincentarelbundock.github.io/modelsummary/dev/reference/msummary.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"msummary() is a shortcut to modelsummary() — msummary","text":"","code":"msummary( models, output = \"default\", fmt = 3, estimate = \"estimate\", statistic = \"std.error\", vcov = NULL, conf_level = 0.95, exponentiate = FALSE, stars = FALSE, shape = term + statistic ~ model, coef_map = NULL, coef_omit = NULL, coef_rename = FALSE, gof_map = NULL, gof_omit = NULL, group_map = NULL, add_columns = NULL, add_rows = NULL, align = NULL, notes = NULL, title = NULL, escape = TRUE, ... )"},{"path":"https://vincentarelbundock.github.io/modelsummary/dev/reference/msummary.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"msummary() is a shortcut to modelsummary() — msummary","text":"models model, (named) list models, nested list models. Single model: modelsummary(model) Unnamed list models: modelsummary(list(model1, model2)) Models labelled automatically. default label style can altered setting global option. See . Named list models: modelsummary(list(\"\"=model1, \"B\"=model2)) Models labelled using list names. Nested list models: using shape=\"rbind\" argument, models can nested list models display \"panels\" \"stacks\" regression models. See shape argument documentation examples . output filename object type (character string) Supported filename extensions: .docx, .html, .tex, .md, .txt, .csv, .xlsx, .png, .jpg Supported object types: \"default\", \"html\", \"markdown\", \"latex\", \"latex_tabular\", \"data.frame\", \"gt\", \"kableExtra\", \"huxtable\", \"flextable\", \"DT\", \"jupyter\". \"modelsummary_list\" value produces lightweight object can saved fed back modelsummary function. \"default\" output format can set \"kableExtra\", \"gt\", \"flextable\", \"huxtable\", \"DT\", \"markdown\" user choose default value, packages listed tried sequence. Session-specific configuration: options(\"modelsummary_factory_default\" = \"gt\") Persistent configuration: config_modelsummary(output = \"markdown\") Warning: Users supply file name output argument intend customize table external packages. See 'Details' section. LaTeX compilation requires booktabs siunitx packages, siunitx can disabled replaced global options. See 'Details' section. fmt format numeric values: integer, user-supplied function, modelsummary function. Integer: Number decimal digits User-supplied functions: function accepts numeric vector returns character vector length. modelsummary functions: fmt = fmt_significant(2): Two significant digits (term-level) fmt = fmt_decimal(digits = 2, pdigits = 3): Decimal digits estimate p values fmt = fmt_sprintf(\"%.3f\"): See ?sprintf fmt = fmt_term(\"(Intercept)\" = 1, \"X\" = 2): Format terms differently fmt = fmt_statistic(\"estimate\" = 1, \"r.sqared\" = 6): Format statistics differently. fmt = fmt_identity(): unformatted raw values string: Note LaTeX output: ensure proper typography, numeric entries enclosed \\num{} command, requires siunitx package loaded LaTeX preamble. behavior can altered global options. See 'Details' section. estimate single string character vector length equal number models. Valid entries include column name data.frame produced get_estimates(model), strings curly braces compatible glue package format. Examples: \"estimate\" \"{estimate} ({std.error}){stars}\" \"{estimate} [{conf.low}, {conf.high}]\" statistic vector strings glue strings select uncertainty statistics report vertically estimate. NULL omits uncertainty statistics. \"conf.int\", \"std.error\", \"statistic\", \"p.value\", \"conf.low\", \"conf.high\", . column name produced get_estimates(model) glue package strings braces, without R functions, : \"{p.value} [{conf.low}, {conf.high}]\" \"Std.Error: {std.error}\" `\"exp(estimate) * std.error\" Numbers automatically rounded converted strings. apply functions numeric values, last glue example, users must set fmt=NULL. Parentheses added automatically unless string includes glue curly braces {}. statistics supported models. See column names get_estimates(model), visit website learn add custom statistics. vcov robust standard errors manual statistics. vcov argument accepts six types input (see 'Details' 'Examples' sections ): NULL returns default uncertainty estimates model object string, vector, (named) list strings. \"iid\", \"classical\", \"constant\" aliases NULL, returns model's default uncertainty estimates. strings \"HC\", \"HC0\", \"HC1\" (alias: \"stata\"), \"HC2\", \"HC3\" (alias: \"robust\"), \"HC4\", \"HC4m\", \"HC5\", \"HAC\", \"NeweyWest\", \"Andrews\", \"panel-corrected\", \"outer-product\", \"weave\" use variance-covariance matrices computed using functions sandwich package, equivalent method. behavior functions can (sometimes must) altered passing arguments sandwich directly modelsummary ellipsis (...), safer define custom functions described next bullet. function (named) list functions return variance-covariance matrices row column names equal names coefficient estimates (e.g., stats::vcov, sandwich::vcovHC, function(x) vcovPC(x, cluster=\"country\")). formula (named) list formulas cluster variable(s) right-hand side (e.g., ~clusterid). named list length(models) variance-covariance matrices row column names equal names coefficient estimates. named list length(models) vectors names equal names coefficient estimates. See 'Examples' section . Warning: since list vectors can include arbitrary strings numbers, modelsummary automatically calculate p values. stars argument may thus use incorrect significance thresholds vcov list vectors. conf_level numeric value 0 1. confidence level use confidence intervals. Setting argument NULL extract confidence intervals, can faster models. exponentiate TRUE, FALSE, logical vector length equal number models. TRUE, estimate, conf.low, conf.high statistics exponentiated, std.error transformed exp(estimate)*std.error. stars indicate statistical significance FALSE (default): significance stars. TRUE: +=.1, *=.05, **=.01, ***=0.001 Named numeric vector custom stars c('*' = .1, '+' = .05) Note: legend inserted bottom table estimate statistic arguments use \"glue strings\" {stars}. shape NULL, formula, string determines shape table. NULL: Default shape terms rows models columns. Formula: left side determines appears rows, right side determines appears columns. formula can include one group identifier(s) display related terms together, can useful models multivariate outcomes grouped coefficients (See examples section ). group identifier(s) must column names produced : get_estimates(model). group identifier(s) can combined term identifier single column using colon represent interaction. incomplete formula supplied (e.g., ~statistic), modelsummary tries complete automatically. Goodness--fit statistics appended bottom table model right hand side formula (.e., columns). Potential shape values include: term + statistic ~ model: default term ~ model + statistic: statistics separate columns model + statistic ~ term: models rows terms columns term + response + statistic ~ model: term group id separate columns term : response + statistic ~ model: term group id single column term ~ response String: \"rbind\" \"rcollapse\" bind rows two regression tables create \"panels\" \"stacks\" regression models. models argument must (potentially named) nested list models. Unnamed nested list 2 panels: list(list(model1, model2), list(model3, model4)) Named nested list 2 panels: list(\"Panel \" = list(model1, model2), \"Panel B\" = list(model3, model4)) Named panels named models: list(\"Panel \" = list(\"()\" = model1, \"(II)\" = model2), \"Panel B\" = list(\"()\" = model3, \"(II)\" = model4)) \"rbind\": Bind rows independent regression tables \"rcollapse\": Bind rows regression tables create panel bottom \"collapse\" goodness--fit statistics identical across models. coef_map character vector. Subset, rename, reorder coefficients. Coefficients omitted vector omitted table. order vector determines order table. coef_map can named unnamed character vector. coef_map named vector, values define labels must appear table, names identify original term names stored model object: c(\"hp:mpg\"=\"HPxM/G\"). See Examples section . coef_omit integer vector regular expression identify coefficients omit (keep) table. Positive integers determine coefficients omit. Negative integers determine coefficients keep. regular expression can used omit coefficients, perl-compatible \"negative lookaheads\" can used specify coefficients keep table. Examples: c(2, 3, 5): omits second, third, fifth coefficients. c(-2, -3, -5): negative values keep second, third, fifth coefficients. \"ei\": omit coefficients matching \"ei\" substring. \"^Volume$\": omit \"Volume\" coefficient. \"ei|rc\": omit coefficients matching either \"ei\" \"rc\" substrings. \"^(?!Vol)\": keep coefficients starting \"Vol\" (inverse match using negative lookahead). \"^(?!.*ei)\": keep coefficients matching \"ei\" substring. \"^(?!.*ei|.*pt)\": keep coefficients matching either \"ei\" \"pt\" substrings. See Examples section complete code. coef_rename logical, named unnamed character vector, function Logical: TRUE renames variables based \"label\" attribute column. See Example section . Unnamed character vector length equal number coefficients final table, coef_omit applied. Named character vector: Values refer variable names appear table. Names refer original term names stored model object. Ex: c(\"hp:mpg\"=\"hp X mpg\") Function: Accepts character vector model's term names returns named vector like one described . modelsummary package supplies coef_rename() function can common cleaning tasks: modelsummary(model, coef_rename = coef_rename) gof_map rename, reorder, omit goodness--fit statistics model information. argument accepts 4 types values: NULL (default): modelsummary::gof_map dictionary used formatting, unknown statistic included. character vector: \"\", \"none\", vector statistics c(\"rmse\", \"nobs\", \"r.squared\"). Elements correspond colnames data.frame produced get_gof(model). modelsummary::gof_map default dictionary used format rename statistics. NA: excludes statistics bottom part table. data.frame 3 columns named \"raw\", \"clean\", \"fmt\". Unknown statistics omitted. See 'Examples' section . list lists, includes 3 elements named \"raw\", \"clean\", \"fmt\". Unknown statistics omitted. See 'Examples section '. gof_omit string regular expression (perl-compatible) used determine statistics omit bottom section table. \"negative lookahead\" can used specify statistics keep table. Examples: \"IC\": omit statistics matching \"IC\" substring. \"BIC|AIC\": omit statistics matching \"AIC\" \"BIC\" substrings. \"^(?!.*IC)\": keep statistics matching \"IC\" substring. group_map named unnamed character vector. Subset, rename, reorder coefficient groups specified grouping variable specified shape argument formula. argument behaves like coef_map. add_columns data.frame (tibble) number rows #' main table. default, rows appended bottom table. can define \"position\" attribute integers set columns positions. See Examples section . add_rows data.frame (tibble) number columns main table. default, rows appended bottom table. can define \"position\" attribute integers set row positions. See Examples section . align string number characters equal number columns table (e.g., align = \"lcc\"). Valid characters: l, c, r, d. \"l\": left-aligned column \"c\": centered column \"r\": right-aligned column \"d\": dot-aligned column. LaTeX/PDF output, option requires least version 3.0.25 siunitx LaTeX package. commands must appear LaTeX preamble (added automatically compiling Rmarkdown documents PDF): \\usepackage{booktabs} \\usepackage{siunitx} \\newcolumntype{d}{S[ input-open-uncertainty=, input-close-uncertainty=, parse-numbers = false, table-align-text-pre=false, table-align-text-post=false ]} notes list vector notes append bottom table. title string escape boolean TRUE escapes substitutes LaTeX/HTML characters prevent file compiling/displaying. setting affect captions notes. ... arguments passed three functions. See documentation functions lists available arguments. parameters::model_parameters extracts parameter estimates. Available arguments depend model type, include: standardize, centrality, dispersion, test, ci_method, prior, diagnostic, rope_range, power, cluster, etc. performance::model_performance extracts goodness--fit statistics. Available arguments depend model type, include: metrics, estimator, etc. kableExtra::kbl gt::gt draw tables, depending value output argument.","code":""},{"path":"https://vincentarelbundock.github.io/modelsummary/dev/reference/msummary.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"msummary() is a shortcut to modelsummary() — msummary","text":"regression table format determined output argument.","code":""},{"path":[]},{"path":"https://vincentarelbundock.github.io/modelsummary/dev/reference/msummary.html","id":"output","dir":"Reference","previous_headings":"","what":"output","title":"msummary() is a shortcut to modelsummary() — msummary","text":"modelsummary_list output lightweight format can used save model results, can fed back modelsummary later avoid extracting results . file name valid extension supplied output argument, table written immediately file. want customize table post-processing external package, need choose different output format saving mechanism. Unfortunately, approach differs package package: gt: set output=\"gt\", post-process table, use gt::gtsave function. kableExtra: set output destination format (e.g., \"latex\", \"html\", \"markdown\"), post-process table, use kableExtra::save_kable function.","code":""},{"path":"https://vincentarelbundock.github.io/modelsummary/dev/reference/msummary.html","id":"vcov","dir":"Reference","previous_headings":"","what":"vcov","title":"msummary() is a shortcut to modelsummary() — msummary","text":"use string \"robust\" \"HC0\", model must supported sandwich package. includes objects : lm, glm, survreg, coxph, mlogit, polr, hurdle, zeroinfl, . NULL, \"classical\", \"iid\", \"constant\" aliases modify uncertainty estimates simply report default standard errors stored model object. One-sided formulas ~clusterid passed sandwich::vcovCL function. Matrices functions producing variance-covariance matrices first passed lmtest. work, modelsummary attempts take square root diagonal adjust \"std.error\", uncertainty estimates adjusted. Numeric vectors formatted according fmt placed brackets. Character vectors printed given, without parentheses. model type supported lmtest package, vcov argument try use package adjust uncertainty estimates, including \"std.error\", \"statistic\", \"p.value\", \"conf.int\". model supported lmtest, \"std.error\" adjusted , example, taking square root matrix's diagonal.","code":""},{"path":"https://vincentarelbundock.github.io/modelsummary/dev/reference/msummary.html","id":"global-options","dir":"Reference","previous_headings":"","what":"Global Options","title":"msummary() is a shortcut to modelsummary() — msummary","text":"behavior modelsummary can modified setting global options. example: options(modelsummary_model_labels = \"roman\") rest section describes options .","code":""},{"path":"https://vincentarelbundock.github.io/modelsummary/dev/reference/msummary.html","id":"model-labels-default-column-names","dir":"Reference","previous_headings":"","what":"Model labels: default column names","title":"msummary() is a shortcut to modelsummary() — msummary","text":"global option changes style default column headers: options(modelsummary_model_labels = \"roman\") options(modelsummary_panel_labels = \"roman\") supported styles : \"model\", \"panel\", \"arabic\", \"letters\", \"roman\", \"(arabic)\", \"(letters)\", \"(roman)\"\" panel-specific option used shape=\"rbind\"","code":""},{"path":"https://vincentarelbundock.github.io/modelsummary/dev/reference/msummary.html","id":"table-making-packages","dir":"Reference","previous_headings":"","what":"Table-making packages","title":"msummary() is a shortcut to modelsummary() — msummary","text":"modelsummary supports 4 table-making packages: kableExtra, gt, flextable, huxtable, DT. packages overlapping functionalities. example, 3 packages can export LaTeX. change default backend used specific file format, can use options function: options(modelsummary_factory_html = 'kableExtra') options(modelsummary_factory_latex = 'gt') options(modelsummary_factory_word = 'huxtable') options(modelsummary_factory_png = 'gt')","code":""},{"path":"https://vincentarelbundock.github.io/modelsummary/dev/reference/msummary.html","id":"table-themes","dir":"Reference","previous_headings":"","what":"Table themes","title":"msummary() is a shortcut to modelsummary() — msummary","text":"Change look tables automated replicable way, using modelsummary theming functionality. See vignette: https://vincentarelbundock.github.io/modelsummary/articles/appearance.html modelsummary_theme_gt modelsummary_theme_kableExtra modelsummary_theme_huxtable modelsummary_theme_flextable modelsummary_theme_dataframe","code":""},{"path":"https://vincentarelbundock.github.io/modelsummary/dev/reference/msummary.html","id":"model-extraction-functions","dir":"Reference","previous_headings":"","what":"Model extraction functions","title":"msummary() is a shortcut to modelsummary() — msummary","text":"modelsummary can use two sets packages extract information statistical models: easystats family (performance parameters) broom. default, uses easystats first falls back broom case failure. can change order priorities include goodness--fit extracted packages setting: options(modelsummary_get = \"broom\") options(modelsummary_get = \"easystats\") options(modelsummary_get = \"\")","code":""},{"path":"https://vincentarelbundock.github.io/modelsummary/dev/reference/msummary.html","id":"formatting-numeric-entries","dir":"Reference","previous_headings":"","what":"Formatting numeric entries","title":"msummary() is a shortcut to modelsummary() — msummary","text":"default, LaTeX tables enclose numeric entries \\num{} command siunitx package. prevent behavior, enclose numbers dollar signs (LaTeX math mode), users can call: options(modelsummary_format_numeric_latex = \"plain\") options(modelsummary_format_numeric_latex = \"mathmode\") similar option can used display numerical entries using MathJax HTML tables: options(modelsummary_format_numeric_html = \"mathjax\")","code":""},{"path":"https://vincentarelbundock.github.io/modelsummary/dev/reference/msummary.html","id":"parallel-computation","dir":"Reference","previous_headings":"","what":"Parallel computation","title":"msummary() is a shortcut to modelsummary() — msummary","text":"can take long time compute extract summary statistics certain models (e.g., Bayesian). cases, users can parallelize process. Since parallelization occurs model level, speedup available tables single model. Users mac linux can launch parallel computation using built-parallel package. need supply mc.cores argument pushed forward parallel::mclapply function: users can also use future.apply package parallelize model summaries. example, use 4 cores extract results: Note \"multicore\" plan parallelizes mac linux. Windows users can use plan(multisession) instead. However, note first time modelsummary() called multisession can fair bit longer, extra costs passing data loading required packages workers. Subsequent calls modelsummary() often much faster. users reported difficult reproduce errors using future package packages. future parallelization modelsummary can disabled calling: options(\"modelsummary_future\" = FALSE)","code":"modelsummary(model_list, mc.cores = 5) library(future.apply) plan(multicore, workers = 4) options(\"modelsummary_future\" = TRUE) modelsummary(model_list)"},{"path":"https://vincentarelbundock.github.io/modelsummary/dev/reference/msummary.html","id":"examples","dir":"Reference","previous_headings":"","what":"Examples","title":"msummary() is a shortcut to modelsummary() — msummary","text":"","code":"library(modelsummary) # load data and estimate models utils::data(trees) models <- list() models[['Bivariate']] <- lm(Girth ~ Height, data = trees) models[['Multivariate']] <- lm(Girth ~ Height + Volume, data = trees) # simple table modelsummary(models) # statistic modelsummary(models, statistic = NULL) modelsummary(models, statistic = 'p.value') modelsummary(models, statistic = 'statistic') modelsummary(models, statistic = 'conf.int', conf_level = 0.99) modelsummary(models, statistic = c(\"t = {statistic}\", \"se = {std.error}\", \"conf.int\")) # estimate modelsummary(models, statistic = NULL, estimate = \"{estimate} [{conf.low}, {conf.high}]\") modelsummary(models, estimate = c(\"{estimate}{stars}\", \"{estimate} ({std.error})\")) # vcov modelsummary(models, vcov = \"robust\") modelsummary(models, vcov = list(\"classical\", \"stata\")) modelsummary(models, vcov = sandwich::vcovHC) modelsummary(models, vcov = list(stats::vcov, sandwich::vcovHC)) modelsummary(models, vcov = list(c(\"(Intercept)\"=\"\", \"Height\"=\"!\"), c(\"(Intercept)\"=\"\", \"Height\"=\"!\", \"Volume\"=\"!!\"))) # vcov with custom names modelsummary( models, vcov = list(\"Stata Corp\" = \"stata\", \"Newey Lewis & the News\" = \"NeweyWest\")) # fmt mod <- lm(mpg ~ hp + drat + qsec, data = mtcars) modelsummary(mod, fmt = 3) modelsummary(mod, fmt = fmt_significant(3)) modelsummary(mod, fmt = NULL) modelsummary(mod, fmt = fmt_decimal(4)) modelsummary(mod, fmt = fmt_sprintf(\"%.5f\")) modelsummary(mod, fmt = fmt_statistic(estimate = 4, conf.int = 1), statistic = \"conf.int\") modelsummary(mod, fmt = fmt_term(hp = 4, drat = 1, default = 2)) m <- lm(mpg ~ I(hp * 1000) + drat, data = mtcars) f <- function(x) format(x, digits = 3, nsmall = 2, scientific = FALSE, trim = TRUE) modelsummary(m, fmt = f, gof_map = NA) # coef_rename modelsummary(models, coef_rename = c('Volume' = 'Large', 'Height' = 'Tall')) modelsummary(models, coef_rename = toupper) modelsummary(models, coef_rename = coef_rename) # coef_rename = TRUE for variable labels datlab <- mtcars datlab$cyl <- factor(datlab$cyl) attr(datlab$hp, \"label\") <- \"Horsepower\" attr(datlab$cyl, \"label\") <- \"Cylinders\" modlab <- lm(mpg ~ hp * drat + cyl, data = datlab) modelsummary(modlab, coef_rename = TRUE) # coef_rename: unnamed vector of length equal to the number of terms in the final table m <- lm(hp ~ mpg + factor(cyl), data = mtcars) modelsummary(m, coef_omit = -(3:4), coef_rename = c(\"Cyl 6\", \"Cyl 8\")) # coef_map modelsummary(models, coef_map = c('Volume' = 'Large', 'Height' = 'Tall')) modelsummary(models, coef_map = c('Volume', 'Height')) # coef_omit: omit the first and second coefficients modelsummary(models, coef_omit = 1:2) # coef_omit: omit coefficients matching one substring modelsummary(models, coef_omit = \"ei\", gof_omit = \".*\") # coef_omit: omit a specific coefficient modelsummary(models, coef_omit = \"^Volume$\", gof_omit = \".*\") # coef_omit: omit coefficients matching either one of two substring #modelsummary(models, coef_omit = \"ei|rc\", gof_omit = \".*\") # coef_omit: keep coefficients starting with a substring (using a negative lookahead) #modelsummary(models, coef_omit = \"^(?!Vol)\", gof_omit = \".*\") # coef_omit: keep coefficients matching a substring modelsummary(models, coef_omit = \"^(?!.*ei|.*pt)\", gof_omit = \".*\") # shape: multinomial model library(nnet) multi <- multinom(factor(cyl) ~ mpg + hp, data = mtcars, trace = FALSE) # shape: term names and group ids in rows, models in columns modelsummary(multi, shape = response ~ model) # shape: term names and group ids in rows in a single column modelsummary(multi, shape = term : response ~ model) # shape: term names in rows and group ids in columns modelsummary(multi, shape = term ~ response:model) # shape = \"rcollapse\" panels <- list( \"Panel A: MPG\" = list( \"A\" = lm(mpg ~ hp, data = mtcars), \"B\" = lm(mpg ~ hp + factor(gear), data = mtcars)), \"Panel B: Displacement\" = list( \"A\" = lm(disp ~ hp, data = mtcars), \"C\" = lm(disp ~ hp + factor(gear), data = mtcars)) ) modelsummary( panels, shape = \"rbind\", gof_map = c(\"nobs\", \"r.squared\")) # title modelsummary(models, title = 'This is the title') # title with LaTeX label (for numbering and referencing) modelsummary(models, title = 'This is the title \\\\label{tab:description}') # add_rows rows <- tibble::tribble(~term, ~Bivariate, ~Multivariate, 'Empty row', '-', '-', 'Another empty row', '?', '?') attr(rows, 'position') <- c(1, 3) modelsummary(models, add_rows = rows) # notes modelsummary(models, notes = list('A first note', 'A second note')) # gof_map: tribble library(tibble) gm <- tribble( ~raw, ~clean, ~fmt, \"r.squared\", \"R Squared\", 5) modelsummary(models, gof_map = gm)"},{"path":"https://vincentarelbundock.github.io/modelsummary/dev/reference/msummary.html","id":"references","dir":"Reference","previous_headings":"","what":"References","title":"msummary() is a shortcut to modelsummary() — msummary","text":"Arel-Bundock V (2022). “modelsummary: Data Model Summaries R.” Journal Statistical Software, 103(1), 1-23. doi:10.18637/jss.v103.i01 .'","code":""},{"path":"https://vincentarelbundock.github.io/modelsummary/dev/reference/reexports.html","id":null,"dir":"Reference","previous_headings":"","what":"tidy generic — reexports","title":"tidy generic — reexports","text":"objects imported packages. Follow links see documentation. generics glance, tidy","code":""},{"path":"https://vincentarelbundock.github.io/modelsummary/dev/reference/rowLabels.html","id":null,"dir":"Reference","previous_headings":"","what":"Retrieve or modify the row or column labels. — rowLabels","title":"Retrieve or modify the row or column labels. — rowLabels","text":"objects imported packages. Follow links see documentation. tables rowLabels","code":""},{"path":"https://vincentarelbundock.github.io/modelsummary/dev/reference/supported_models.html","id":null,"dir":"Reference","previous_headings":"","what":"List of model objects from which modelsummary can extract estimates and\nstatistics — supported_models","title":"List of model objects from which modelsummary can extract estimates and\nstatistics — supported_models","text":"List model objects modelsummary can extract estimates statistics","code":""},{"path":"https://vincentarelbundock.github.io/modelsummary/dev/reference/supported_models.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"List of model objects from which modelsummary can extract estimates and\nstatistics — supported_models","text":"","code":"supported_models()"},{"path":"https://vincentarelbundock.github.io/modelsummary/dev/reference/tidy_custom.html","id":null,"dir":"Reference","previous_headings":"","what":"Extract custom information from a model object and turn it into a tidy\ndata.frame or tibble — tidy_custom","title":"Extract custom information from a model object and turn it into a tidy\ndata.frame or tibble — tidy_custom","text":"customize output model class lm, can define method called tidy_custom.lm returns data.frame column called \"term\", columns want use \"estimate\" \"statistic\" modelsummary() call. output method must similar result tidy(model).","code":""},{"path":"https://vincentarelbundock.github.io/modelsummary/dev/reference/tidy_custom.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Extract custom information from a model object and turn it into a tidy\ndata.frame or tibble — tidy_custom","text":"","code":"tidy_custom(x)"},{"path":"https://vincentarelbundock.github.io/modelsummary/dev/reference/tidy_custom.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Extract custom information from a model object and turn it into a tidy\ndata.frame or tibble — tidy_custom","text":"x object converted tidy data.frame tibble.","code":""},{"path":"https://vincentarelbundock.github.io/modelsummary/dev/reference/tidy_custom.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Extract custom information from a model object and turn it into a tidy\ndata.frame or tibble — tidy_custom","text":"data.frame tibble information model components.","code":""},{"path":"https://vincentarelbundock.github.io/modelsummary/dev/reference/tidy_custom_internal.default.html","id":null,"dir":"Reference","previous_headings":"","what":"Avoid namespace conflict when we want to customize glance internally and\nstill allow users to do the same with their own functions — tidy_custom_internal.default","title":"Avoid namespace conflict when we want to customize glance internally and\nstill allow users to do the same with their own functions — tidy_custom_internal.default","text":"Avoid namespace conflict want customize glance internally still allow users functions","code":""},{"path":"https://vincentarelbundock.github.io/modelsummary/dev/reference/tidy_custom_internal.default.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Avoid namespace conflict when we want to customize glance internally and\nstill allow users to do the same with their own functions — tidy_custom_internal.default","text":"","code":"# S3 method for default tidy_custom_internal(x, ...)"},{"path":"https://vincentarelbundock.github.io/modelsummary/dev/reference/tidy_custom_internal.html","id":null,"dir":"Reference","previous_headings":"","what":"Avoid namespace conflict when we want to customize glance internally and\nstill allow users to do the same with their own functions — tidy_custom_internal","title":"Avoid namespace conflict when we want to customize glance internally and\nstill allow users to do the same with their own functions — tidy_custom_internal","text":"Avoid namespace conflict want customize glance internally still allow users functions","code":""},{"path":"https://vincentarelbundock.github.io/modelsummary/dev/reference/tidy_custom_internal.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Avoid namespace conflict when we want to customize glance internally and\nstill allow users to do the same with their own functions — tidy_custom_internal","text":"","code":"tidy_custom_internal(x, ...)"},{"path":"https://vincentarelbundock.github.io/modelsummary/dev/reference/update_modelsummary.html","id":null,"dir":"Reference","previous_headings":"","what":"Update modelsummary and its dependencies — update_modelsummary","title":"Update modelsummary and its dependencies — update_modelsummary","text":"Update modelsummary dependencies latest R-Universe CRAN versions. R session needs restarted install.","code":""},{"path":"https://vincentarelbundock.github.io/modelsummary/dev/reference/update_modelsummary.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Update modelsummary and its dependencies — update_modelsummary","text":"","code":"update_modelsummary(source = \"development\")"},{"path":"https://vincentarelbundock.github.io/modelsummary/dev/reference/update_modelsummary.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Update modelsummary and its dependencies — update_modelsummary","text":"source one two strings: \"development\" \"cran\"","code":""},{"path":"https://vincentarelbundock.github.io/modelsummary/dev/news/index.html","id":"modelsummary-141-development","dir":"Changelog","previous_headings":"","what":"modelsummary 1.4.1 (development)","title":"modelsummary 1.4.1 (development)","text":"CRAN release: 2023-05-19 New: Minimal support Typst output, auto-detection Quarto documents. strip argument dvnames. s.value statistic now available whenever p.value available. See Greenland (2019). Bugs: GOF term names get escaped LaTeX. Thanks @shreyasgm reviving Issue #546.","code":""},{"path":"https://vincentarelbundock.github.io/modelsummary/dev/news/index.html","id":"modelsummary-141","dir":"Changelog","previous_headings":"","what":"modelsummary 1.4.1","title":"modelsummary 1.4.1","text":"CRAN release: 2023-05-19 New: fmt_sci() can now used fmt argument rounding scientific notation. Bugs: Group separators respect add_rows shape=\"rbind\". Thanks @lrose1 Report #626. Bad column horizontal models shape grouped estimates. Thanks @iago-pssjd Report #631. coef_rename=TRUE bug grouped estimates. Thanks @iago-pssjd Report #631. Upstream issue #881 parameters meant vcov longer used confidence intervals.","code":""},{"path":"https://vincentarelbundock.github.io/modelsummary/dev/news/index.html","id":"modelsummary-140","dir":"Changelog","previous_headings":"","what":"modelsummary 1.4.0","title":"modelsummary 1.4.0","text":"CRAN release: 2023-04-26 Built-support markdown tables. Package longer depends kableExtra. Recommends additional install formats. Persistent configuration default output format: config_modelsummary(factory_default = \"gt\") shape = \"rcollapse\" shape = \"rbind\" glance_custom() can drop GOF assigning NA: https://stackoverflow.com/questions/75215355/assigning-different-coefficient-names--goodness--fit-statistics--differen statistic available, modelsummary prints empty cell instead returning error. “\\label{tab:something}” works title even escape=TRUE Multiple fixest_multi objects supported. options(modelsummary_future = FALSE) disables future parallelism. Bug fixes: statistic=NULL now respected shape=\"rbind\". Thanks Panos Mavros report #620. get_estimates() supports vcov string shortcuts formulas. Thanks @ethans-carl report #605. Quarto Rmarkdown documents include situnix header automatically decimal alignement align=\"ddd\" escape now respected modelsummary shape=\"rbind\". Thanks @chickymonkeys report #622.","code":""},{"path":"https://vincentarelbundock.github.io/modelsummary/dev/news/index.html","id":"modelsummary-130","dir":"Changelog","previous_headings":"","what":"modelsummary 1.3.0","title":"modelsummary 1.3.0","text":"CRAN release: 2023-01-05 Breaking change: default column label style modelsummary() changed “Model 1” “(1)”. benefits : labels longer English default; use less horizontal space; eliminate “Model” redundancy. Unfortunately, break code edge cases users rely column names manipulate tables. old behavior can restored calling: options(modelsummary_model_labels=\"model\") New features: shape=\"rbind\" stack multiple regression tables create “panels” labelled groups models. fmt = fmt_decimal(2): decimal digits fmt = fmt_decimal(digits = 2, pdigits = 4): decimal digits p value-specific setting fmt = fmt_sprintf(\"%.3f\"): sprintf() decimal fmt = fmt_sprintf(\"%.3e\"): sprintf() scientific fmt = fmt_significant(3): significant digits fmt = fmt_statistic(\"estimate\" = 2, \"std.error\" = 3): statistic-specific formatting fmt = fmt_term(\"(Intercept)\" = 2, \"hp\" = 3): term-specific formatting fmt = fmt_identity(): raw values Set style global option: options(modelsummary_model_labels = \"roman\") Supported styles: “model”, “arabic”, “letters”, “roman”, “(arabic)”, “(letters)”, “(roman)”” modelplot(draw = FALSE) now returns p.value column. allows conditional aesthetics (see modelplot vignette). Better integration marginaleffects package. Bugs: fixest models returns useless “group.x” “group.y” columns. Isse #591. Thanks Adam Altmejd report.","code":""},{"path":"https://vincentarelbundock.github.io/modelsummary/dev/news/index.html","id":"modelsummary-120","dir":"Changelog","previous_headings":"","what":"modelsummary 1.2.0","title":"modelsummary 1.2.0","text":"CRAN release: 2022-11-26 Breaking change: shape output=\"dataframe\" arguments, always used group column. Now, column name variable shape formula (“response”, “component”, etc.). New features: shape can include multiple groups. coef_rename can unnamed vector length equal number terms final table, obtained coef_map coef_omit applied models merged. coef_omit accepts numeric indices. Positive values: coefficients omit. Negative values: coefficients keep. datasummary_skim: Increased maximum number variables 250. Quarto notebooks compile Word Markdown automatically. Bug fixes: Order notes preserved output format (Issue #577)","code":""},{"path":"https://vincentarelbundock.github.io/modelsummary/dev/news/index.html","id":"modelsummary-110","dir":"Changelog","previous_headings":"","what":"modelsummary 1.1.0","title":"modelsummary 1.1.0","text":"CRAN release: 2022-10-20 Breaking change: Requires siunitx version 3.0.25 LaTeX package. title argument now respects escape argument kableExtra output formats. can break tables users manually escaped titles. New features: “d” accepted decimal-alignment align argument output formats. modelsummary(mod, align = \"ld\") New update_modelsummary() function makes easy install dev versions modelsummary dependencies (mostly useful Vincent people report bugs). Rounding: display least one significant digit default. Automatic renaming haven labels modelsummary(), datasummary(), datasummary_skim() Allow output = \"filename.csv\" Allow output = \"filename.xlsx\" add_columns argument supported modelsummary() datasummary_balance supports stars argument. Allow stars confidence intervals align = \"d\" column. Bug fixes: locales, HTML minus sign created problems output. use “known” locales. Many minor bug fixes","code":""},{"path":"https://vincentarelbundock.github.io/modelsummary/dev/news/index.html","id":"modelsummary-102","dir":"Changelog","previous_headings":"","what":"modelsummary 1.0.2","title":"modelsummary 1.0.2","text":"CRAN release: 2022-07-17 Minor release fix CRAN failure","code":""},{"path":"https://vincentarelbundock.github.io/modelsummary/dev/news/index.html","id":"modelsummary-101","dir":"Changelog","previous_headings":"","what":"modelsummary 1.0.1","title":"modelsummary 1.0.1","text":"CRAN release: 2022-07-13 shape argument accepts interactions colon “:” character. combines two columns one, can useful display terms group names single column. Parallelization using parallel::mclapply. See ?modelsummary modelsummary longer computes confidence intervals necessary, can save time. Also see: conf_level=NULL Added log likelihood GOF lm glm models. Removed extraneous warnings Bug fixes","code":""},{"path":"https://vincentarelbundock.github.io/modelsummary/dev/news/index.html","id":"modelsummary-100","dir":"Changelog","previous_headings":"","what":"modelsummary 1.0.0","title":"modelsummary 1.0.0","text":"CRAN release: 2022-06-29 first major release accompanies publication article Journal Statistical Software: Arel-Bundock, Vincent (2022). “modelsummary: Data Model Summaries R.” Journal Statistical Software, 103(1), 1-23. doi:10.18637/jss.v103.i01 https://doi.org/10.18637/jss.v103.i01.’ like modelsummary, please cite JSS article tell friends . Minor changes: gof_map=\"\" includes available statistics. gof_map=\"none\" excludes statistics. Bug fixes","code":""},{"path":"https://vincentarelbundock.github.io/modelsummary/dev/news/index.html","id":"modelsummary-0111","dir":"Changelog","previous_headings":"","what":"modelsummary 0.11.1","title":"modelsummary 0.11.1","text":"CRAN release: 2022-06-11 Better printout term names mixed-effects models {brms} {stanreg} models now extracted diagnostic=NULL test=NULL default speed.","code":""},{"path":"https://vincentarelbundock.github.io/modelsummary/dev/news/index.html","id":"modelsummary-0110","dir":"Changelog","previous_headings":"","what":"modelsummary 0.11.0","title":"modelsummary 0.11.0","text":"CRAN release: 2022-06-06 Breaking changes: modelsummary_wide longer available. Use shape argument modelsummary instead. modelsummary now uses easystats packages (performance parameters) extract estimates goodness--fit statistics instead broom. can reverted setting global option: options(modelsummary_get=\"broom\"). change aims (1) increase consistency across models, (2) improve developers’ ability push bug fixes upstream necessary, (3) improve support mixed effects, bayesian, GAM models. two main drawbacks : () set printed statistics may slightly different previous versions modelsummary (b) group identifiers used shape formula also different certain models (e.g., nnet::multinom, y.level becomes response). New features: ~ statistic: statistics shown horizontally distinct columns. model ~ term: models rows terms columns. term + y.level + statistic ~ model: grouped coefficients multivariate outcome nnet::multinom y.level ~ model: partial match previous formula modelsummary(mod, fmt = list(estimate = 2, std.error = 1, rmse = 4)) modelsummary(model, fmt = NULL, estimate = \"{log(estimate)}\") Update breaking changes fixest 0.10.4 Bug fixes: group_map rename issue Residual standard error mistakenly labelled “RMSE” lm models. datasummary_skim output jpg now works escape fixes","code":""},{"path":"https://vincentarelbundock.github.io/modelsummary/dev/news/index.html","id":"modelsummary-0100","dir":"Changelog","previous_headings":"","what":"modelsummary 0.10.0","title":"modelsummary 0.10.0","text":"CRAN release: 2022-04-14 New exponentiate argument modelsummary() modelplot() gof_map accepts vector c(\"rmse\", \"nobs\", \"r.squared\") Drop rlang dependency Bug fixes","code":""},{"path":"https://vincentarelbundock.github.io/modelsummary/dev/news/index.html","id":"modelsummary-096","dir":"Changelog","previous_headings":"","what":"modelsummary 0.9.6","title":"modelsummary 0.9.6","text":"CRAN release: 2022-02-25 datasummary_balance: Accepts ~ 1 formula summarize data. Misc: documentation improvements RMSE included default models class lm","code":""},{"path":"https://vincentarelbundock.github.io/modelsummary/dev/news/index.html","id":"modelsummary-095","dir":"Changelog","previous_headings":"","what":"modelsummary 0.9.5","title":"modelsummary 0.9.5","text":"CRAN release: 2022-01-10 modelsummary: vcov strings like HC1 Robust now case-insensitive gof_map now accepts data.frame tibble fmt list-column includes functions (see Examples docs) R2 longer computed default bayesian mixed effects models. informative one-time warning printed metrics argument. datasummary_skim: Histograms now work Jupyter Bugfix: harmless error message longer printed kableExtra factory: col.names argument can now passed kableExtra::kbl … ellipsis. Misc: Many small improvements vignettes docs output = \"github_document\" now supported","code":""},{"path":"https://vincentarelbundock.github.io/modelsummary/dev/news/index.html","id":"modelsummary-094","dir":"Changelog","previous_headings":"","what":"modelsummary 0.9.4","title":"modelsummary 0.9.4","text":"CRAN release: 2021-11-05 Bug fix: siunitx rounding NA","code":""},{"path":"https://vincentarelbundock.github.io/modelsummary/dev/news/index.html","id":"modelsummary-093","dir":"Changelog","previous_headings":"","what":"modelsummary 0.9.3","title":"modelsummary 0.9.3","text":"CRAN release: 2021-11-02 modelsummary: F statistic takes account vcov argument Support group = group ~ model + term datasummary_balance: Weighted means standard deviations now supported. Counts percentages , raise warning. Misc: Bugfix: rounding LaTeX w/ siunitx NaN entries. output=‘jupyter’ longer prints extraneous TRUE notebook","code":""},{"path":"https://vincentarelbundock.github.io/modelsummary/dev/news/index.html","id":"modelsummary-092","dir":"Changelog","previous_headings":"","what":"modelsummary 0.9.2","title":"modelsummary 0.9.2","text":"CRAN release: 2021-09-29 modelsummary: Improved vcov argument handling fixest models (#357 @grantmcdermott) Fix display fixest::() variables interactions (#361 @grantmcdermott) Consistent display clustered SEs (#356, #363 #366 @grantmcdermott) datasummary_correlation: add_rows add_columns arguments now available . Misc: Global options output factories renamed: modelsummary_factory_default, modelsummary_factory_html, etc. Hot fix change R-devel behavior intersect Bug fixes: datasummary_balance: escape variable names escape=TRUE Blogdown LaTeX dependency bug output HTML","code":""},{"path":"https://vincentarelbundock.github.io/modelsummary/dev/news/index.html","id":"modelsummary-091","dir":"Changelog","previous_headings":"","what":"modelsummary 0.9.1","title":"modelsummary 0.9.1","text":"CRAN release: 2021-08-12 Breaking change: Support dcolumn dot-aligned columns deprecated. Use “d” align argument instead. changes: LaTeX output: Numeric entries wrapped \\num{} function siunitx package default. produces much nicer formatting. can disabled global option. See ?modelsummary align argument accepts “d” column dot-alignment using siunitx LaTeX package: align=\"ldd\". HTML tables display proper minus signs. New escape argument table-building functions. LaTeX output accepts threeparttable=TRUE argument ... dependency tidyr modelsummary: group: order terms formula determines order rows/columns modelsummary_wide: Note: function eventually deprecated Bugfix statistic=NULL. modelplot: Preserves order models user-supplied list datasummary_crosstab: statistic=NULL produces basic crosstab datasummary_crosstab: Default alignment “lrrrrr” consistent datasummary_* functions","code":""},{"path":"https://vincentarelbundock.github.io/modelsummary/dev/news/index.html","id":"modelsummary-081","dir":"Changelog","previous_headings":"","what":"modelsummary 0.8.1","title":"modelsummary 0.8.1","text":"CRAN release: 2021-06-17 modelsummary: Disable stars footnote options(\"modelsummary_stars_note\" = FALSE) longtable=TRUE works LaTeX output Interactions “:” longer converted “x” coef_map coef_rename used. group = model ~ term + group now supported. datasummary_skim: datasummary_skim(\"categorical\") keeps NA default. Users can convert variables factors calling datasummary_skim exclude NA. : Improved warnings bad calls: modelsummary(model1, model2) gt titles use new caption argument gt 0.3.0 function Bug fix: Overaggressive tests glue strings prevented functions inside {}","code":""},{"path":"https://vincentarelbundock.github.io/modelsummary/dev/news/index.html","id":"modelsummary-080","dir":"Changelog","previous_headings":"","what":"modelsummary 0.8.0","title":"modelsummary 0.8.0","text":"CRAN release: 2021-05-21 Breaking change: default significance markers stars=TRUE updated consistent default output base R (e.g., summary.lm). new significance thresholds : “+” p < 0.1, “” p < 0.05, ”” p < 0.01, ”” p < 0.001 datasummary_crosstab: New function produce cross-tabulations datasummary: N smart enough return either number elements subset number non-missing observations variable datasummary_balance: Keeps NAs factor variables default. Users can convert variables factor() function omit NAs automatically. modelsummary: themes can set using global options (experimental) new vcov options: “bootstrap”, “HAC”, “NeweyWest”, “Andrews”, “panel-corrected”, “weave”, “outer-product” valid get_gof (glance) now optional. … pushed sandwich, allows things like: modelsummary(model, vcov = \"bootstrap\", R = 1000, cluster = \"firm\") : Jupyter notebook support via output=\"jupyter\" Bug fixes","code":""},{"path":"https://vincentarelbundock.github.io/modelsummary/dev/news/index.html","id":"modelsummary-070","dir":"Changelog","previous_headings":"","what":"modelsummary 0.7.0","title":"modelsummary 0.7.0","text":"CRAN release: 2021-04-19 modelsummary: new arguments modelsummary: group group_map grouped parameters (e.g., outcome levels multinomial logit components gamlss model). dvnames() makes easy get dependent variable column titles (thanks @NickCH-K) output=\"modelsummary_list\" save lightweight list-based representation table can saved fed modelsummary get full table. vcov adds row note type standard errors. modelsummary accepts single model multiple vcovs. get_gof forwards … model_performance coef_map accepts unnamed vectors easy subsetting fixest::fixest_multi support options(modelsummary_get) set order extraction functions use hood (broom vs. easystats vs. ) metrics argument performance::model_performance available via modelsummary’s … ellipsis limit GOF statistics Bayesian models. users can omit stars legend note using glue strings: estimate=\"{estimate}{stars}\" output=“html” can use gt setting options(modelsummary_factory_html=\"gt\") datasummary_correlation: passes ... forward new function: datasummary_correlation_format datasummary_correlation’s method argument accepts functions “pearspear” (thanks @joachim-gassen) datasummary: datasummary functions rounding accept …, big.mark, etc. datasummary_skim: now works haven_labeled numeric faster tables bayesian models. Bug fixes lints","code":""},{"path":"https://vincentarelbundock.github.io/modelsummary/dev/news/index.html","id":"modelsummary-066","dir":"Changelog","previous_headings":"","what":"modelsummary 0.6.6","title":"modelsummary 0.6.6","text":"CRAN release: 2021-02-16 new output format: latex_tabular tidy_custom allows partial term matches modelsummary(coef_rename) accepts functions new function coef_rename use modelsummary(coef_rename=coef_rename) modelplot accepts add_rows add reference categories informative error message estimate statistic available bug fixes","code":""},{"path":"https://vincentarelbundock.github.io/modelsummary/dev/news/index.html","id":"modelsummary-065","dir":"Changelog","previous_headings":"","what":"modelsummary 0.6.5","title":"modelsummary 0.6.5","text":"CRAN release: 2021-01-07 statistic_override becomes vcov vcov accepts shortcuts: “robust”, “stata”, “HC0”, etc. vcov accepts formulas clustered SEs: ~group modelsummary_wide new “stacking” argument html horizontal rule separate estimates form gof gof_map accepts list lists. needs 3 columns. support officedown Rmd estimate accepts vector per model estimates options(modelsummary_default) can markdown, html, latex bug: passing arguments … bug: stars rounding","code":""},{"path":"https://vincentarelbundock.github.io/modelsummary/dev/news/index.html","id":"modelsummary-064","dir":"Changelog","previous_headings":"","what":"modelsummary 0.6.4","title":"modelsummary 0.6.4","text":"CRAN release: 2020-12-15 glue format estimate statistic easystats support model info extraction deprecate statistic_vertical deprecate extract_models. Use modelsummary(output=“dataframe”) instead. modelplot pushes … modelsummary(output=“dataframe”) datasummary_skim(type=“dataset”) gof_map omits default datasummary_balance uses row percentages statistic_override require list statistic_override accepts single model N function well formatted N datasummary Bug fixes","code":""},{"path":"https://vincentarelbundock.github.io/modelsummary/dev/news/index.html","id":"modelsummary-063","dir":"Changelog","previous_headings":"","what":"modelsummary 0.6.3","title":"modelsummary 0.6.3","text":"CRAN release: 2020-10-24 new function: modelsummary_wide coef_omit gof_omit use grepl(perl=TRUE) fmt accepts integer, string function respects options(OutDec=“,”) align argument modelsummary align liberal accept dcolumn alignment glance_custom methods lfe fixest bug fixes","code":""},{"path":"https://vincentarelbundock.github.io/modelsummary/dev/news/index.html","id":"modelsummary-062","dir":"Changelog","previous_headings":"","what":"modelsummary 0.6.2","title":"modelsummary 0.6.2","text":"CRAN release: 2020-09-29 new argument: coef_rename new function: datasummary_df preserve term order modelsummary refactor datasummary_balance datasummary_skim uses svg histograms instead unicode removed 5 dependencies pass … kableExtra::kbl customization test improvements internal code style bug fixes","code":""},{"path":"https://vincentarelbundock.github.io/modelsummary/dev/news/index.html","id":"modelsummary-061","dir":"Changelog","previous_headings":"","what":"modelsummary 0.6.1","title":"modelsummary 0.6.1","text":"CRAN release: 2020-09-04 bug fixes","code":""},{"path":"https://vincentarelbundock.github.io/modelsummary/dev/news/index.html","id":"modelsummary-060","dir":"Changelog","previous_headings":"","what":"modelsummary 0.6.0","title":"modelsummary 0.6.0","text":"CRAN release: 2020-09-02 default HTML output factory now kableExtra interaction “:” gsubbed “0d7” dependencies: removed 1 depends, 3 imports, 3 suggests word_document knitr works ---box bug fixes","code":""},{"path":"https://vincentarelbundock.github.io/modelsummary/dev/news/index.html","id":"modelsummary-051","dir":"Changelog","previous_headings":"","what":"modelsummary 0.5.1","title":"modelsummary 0.5.1","text":"CRAN release: 2020-08-02 glance_custom.fixest ships modelsummary","code":""},{"path":"https://vincentarelbundock.github.io/modelsummary/dev/news/index.html","id":"modelsummary-050","dir":"Changelog","previous_headings":"","what":"modelsummary 0.5.0","title":"modelsummary 0.5.0","text":"CRAN release: 2020-07-05 datasummary datasummary_skim datasummary_balance datasummary_correlation modelplot allow duplicate model names bug: can’t use coef_map multiple statistics (thanks @sbw78) bug: wrong number stars w/ statistic=‘p.value’ (thanks @torfason) output=‘data.frame’. extract longer documented.","code":""},{"path":"https://vincentarelbundock.github.io/modelsummary/dev/news/index.html","id":"modelsummary-041","dir":"Changelog","previous_headings":"","what":"modelsummary 0.4.1","title":"modelsummary 0.4.1","text":"CRAN release: 2020-06-17 add_rows now accepts data.frame “position” “section” columns add_rows_location deprecated bug sanity_output prevented overwriting files","code":""},{"path":"https://vincentarelbundock.github.io/modelsummary/dev/news/index.html","id":"modelsummary-040","dir":"Changelog","previous_headings":"","what":"modelsummary 0.4.0","title":"modelsummary 0.4.0","text":"CRAN release: 2020-06-13 huxtable support flextable support estimate argument fixest tidiers website vignette improvements gof_map additions glance_custom tidy_custom","code":""},{"path":"https://vincentarelbundock.github.io/modelsummary/dev/news/index.html","id":"modelsummary-030","dir":"Changelog","previous_headings":"","what":"modelsummary 0.3.0","title":"modelsummary 0.3.0","text":"CRAN release: 2020-05-26 ---box Rmarkdown compilation HTML, PDF, RTF kableExtra output format LaTeX Markdown Support threeparttable, colors, many LaTeX options Deprecated arguments: filename, subtitle Deprecated functions: clean_latex, knit_latex pkgdown website doc improvements mitools tidiers New tests","code":""},{"path":"https://vincentarelbundock.github.io/modelsummary/dev/news/index.html","id":"modelsummary-021","dir":"Changelog","previous_headings":"","what":"modelsummary 0.2.1","title":"modelsummary 0.2.1","text":"CRAN release: 2020-04-30 Convenience function render markdown row/column labels bug: breakage GOF omitted Clean manual @keywords internal bug: tidyr import","code":""},{"path":"https://vincentarelbundock.github.io/modelsummary/dev/news/index.html","id":"modelsummary-020","dir":"Changelog","previous_headings":"","what":"modelsummary 0.2.0","title":"modelsummary 0.2.0","text":"CRAN release: 2020-04-05 gt now available CRAN new latex_env argument knit_latex clean_latex bug gof omitted bug statistic_override functions bug caused upstream changes tab_style bug caused upstream changes filename=‘rtf’ Allow multiple rows uncertainty estimates per coefficient Preserve add_rows order Display uncertainty estimates next coefficient statistic_vertical = FALSE Better clean_latex function Can display R2 confidence intervals mice-imputed lm-models Internal functions @keywords internal avoid inclusion docs Statistic override accepts pre-formatted character vectors","code":""},{"path":"https://vincentarelbundock.github.io/modelsummary/dev/news/index.html","id":"modelsummary-010","dir":"Changelog","previous_headings":"","what":"modelsummary 0.1.0","title":"modelsummary 0.1.0","text":"CRAN release: 2019-07-15 Initial release (gt still needs installed github)","code":""}]
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | |