From 5e81ab00717ecdec4ec9d7b320db40e0f934d8ba Mon Sep 17 00:00:00 2001 From: vincentarelbundock Date: Thu, 16 May 2024 03:07:51 +0000 Subject: [PATCH] =?UTF-8?q?Deploying=20to=20gh-pages=20from=20@=20vincenta?= =?UTF-8?q?relbundock/modelsummary@b40bd237775f09dcfacb592f07b9777eb9757d5?= =?UTF-8?q?7=20=F0=9F=9A=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- man/coef_rename.html | 98 +- man/datasummary.html | 642 +- man/datasummary_balance.html | 250 +- man/datasummary_correlation.html | 358 +- man/datasummary_correlation_format.html | 64 +- man/datasummary_crosstab.html | 544 +- man/dvnames.html | 252 +- search.json | 84 +- vignettes/appearance.html | 1214 ++-- vignettes/datasummary.html | 4846 ++++++------- vignettes/get_started.html | 808 +-- vignettes/modelplot.html | 194 +- vignettes/modelsummary.html | 6330 ++++++++--------- vignettes/modelsummary_extension.html | 466 +- .../id0514m942vvnijlnihcrn.png | Bin 0 -> 1295 bytes .../id51top1lgh29wn36x1i3q.png | Bin 0 -> 1433 bytes .../id7gq3p7xrmxzgz3czxz5e.png | Bin 0 -> 1728 bytes .../idbvvzhsj7tpyk2th6f6xm.png | Bin 0 -> 2316 bytes .../idelrgotvcsxg0cj5ewz79.png | Bin 0 -> 12872 bytes .../ideq6y0kxnhl7mkj3dul50.png | Bin 0 -> 2207 bytes .../idi8gnz0s7w0v95g9caeh2.png | Bin 0 -> 2344 bytes .../idir7hvoenps9jcos2892c.png | Bin 0 -> 12855 bytes .../idiwkunjr9bokgaaske8uh.png | Bin 0 -> 1917 bytes .../ido6vuqjrohozlglxc3oah.png | Bin 0 -> 2075 bytes .../idpf8ieywfpep7fblh2nxg.png | Bin 0 -> 2676 bytes .../idqm4203et4k7rt9d9hzyj.png | Bin 0 -> 2024 bytes .../idruwrdfp1vfhcj5ks8dg1.png | Bin 0 -> 1656 bytes .../ids456uxws03qlzan7a5xl.png | Bin 0 -> 2936 bytes .../idtik5javjkduihvbp61cr.png | Bin 0 -> 1150 bytes .../iduaergfij55nl3egazed4.png | Bin 0 -> 2214 bytes .../idw88w31jtcs29h0jx3a7y.png | Bin 0 -> 1250 bytes 31 files changed, 8075 insertions(+), 8075 deletions(-) create mode 100644 vignettes/tinytable_assets/id0514m942vvnijlnihcrn.png create mode 100644 vignettes/tinytable_assets/id51top1lgh29wn36x1i3q.png create mode 100644 vignettes/tinytable_assets/id7gq3p7xrmxzgz3czxz5e.png create mode 100644 vignettes/tinytable_assets/idbvvzhsj7tpyk2th6f6xm.png create mode 100644 vignettes/tinytable_assets/idelrgotvcsxg0cj5ewz79.png create mode 100644 vignettes/tinytable_assets/ideq6y0kxnhl7mkj3dul50.png create mode 100644 vignettes/tinytable_assets/idi8gnz0s7w0v95g9caeh2.png create mode 100644 vignettes/tinytable_assets/idir7hvoenps9jcos2892c.png create mode 100644 vignettes/tinytable_assets/idiwkunjr9bokgaaske8uh.png create mode 100644 vignettes/tinytable_assets/ido6vuqjrohozlglxc3oah.png create mode 100644 vignettes/tinytable_assets/idpf8ieywfpep7fblh2nxg.png create mode 100644 vignettes/tinytable_assets/idqm4203et4k7rt9d9hzyj.png create mode 100644 vignettes/tinytable_assets/idruwrdfp1vfhcj5ks8dg1.png create mode 100644 vignettes/tinytable_assets/ids456uxws03qlzan7a5xl.png create mode 100644 vignettes/tinytable_assets/idtik5javjkduihvbp61cr.png create mode 100644 vignettes/tinytable_assets/iduaergfij55nl3egazed4.png create mode 100644 vignettes/tinytable_assets/idw88w31jtcs29h0jx3a7y.png diff --git a/man/coef_rename.html b/man/coef_rename.html index b71a2bd06..f4c5ffef4 100644 --- a/man/coef_rename.html +++ b/man/coef_rename.html @@ -459,12 +459,12 @@ -tinytable_t1yml4r8s3vt1wgfunii +tinytable_rbap4rknvkgzumrzimoe
- +
@@ -551,12 +551,12 @@ diff --git a/man/datasummary.html b/man/datasummary.html index d45d0591e..5a310d30f 100644 --- a/man/datasummary.html +++ b/man/datasummary.html @@ -653,11 +653,11 @@

-tinytable_cb8fc5hsp369x94z5o0a +tinytable_s7semkrxgev97l5nkimp
-

(1)
+
@@ -682,12 +682,12 @@

# This table uses the "mean" function as a row and the "mpg" variable as a column:
@@ -740,11 +740,11 @@ 

-tinytable_mgqzua34nrdbo0v0heu9 +tinytable_m7khicbwak6fux9qxac0
-

mean
+
@@ -769,12 +769,12 @@

# Display several variables or functions of the data using the "+"
@@ -828,12 +828,12 @@ 

-tinytable_ydb1f98fs4e1zy5fytpa +tinytable_5nbmj7vh0iruu3ozufjr
-

mpg
+
@@ -867,12 +867,12 @@

# Nest variables or statistics inside a "factor" variable using the "*" nesting
@@ -934,13 +934,13 @@ 

-tinytable_6ex7dqxtss02tkvvzr3x +tinytable_ignv475l53xdk408swtw
-

mean
+
@@ -977,12 +977,12 @@

# If you don't want to convert your original data
@@ -1047,13 +1047,13 @@ 

-tinytable_l52r23bymea3u35ybhe9 +tinytable_32pkvff7ay2rlgqbbfwy
-

4
+
@@ -1090,12 +1090,12 @@

# You can nest several variables or statistics inside a factor by using
@@ -1160,19 +1160,19 @@ 

-tinytable_7aa4ffdw2msezxtwh3hg +tinytable_n00bdt35ylfp8306esnw
-

4
+
@@ -1226,12 +1226,12 @@

# Summarize all numeric variables with 'All()'
@@ -1329,12 +1329,12 @@ 

-tinytable_pawkzn9g4hyhhyucmnml +tinytable_ricso3pa8t0vzuqh3t1d
-

+
@@ -1408,12 +1408,12 @@

# Define custom summary statistics. Your custom function should accept a vector
@@ -1500,12 +1500,12 @@ 

-tinytable_4d9z84cto2ud51troo8a +tinytable_9pat3wi7wv8h2vk57pqg
-

mean
+
@@ -1539,12 +1539,12 @@

# To handle missing values, you can pass arguments to your functions using
@@ -1604,11 +1604,11 @@ 

-tinytable_m2i8k8eiy3qx5in92i21 +tinytable_81ezsy5w7a0oyus0zl8x
-

minmax
+
@@ -1639,12 +1639,12 @@

# For convenience, 'modelsummary' supplies several convenience functions
@@ -1706,12 +1706,12 @@ 

-tinytable_e7pur5j2cizht4r7vfbd +tinytable_u7t4m9cdy5jzxj3fvtdx
-

mean
+
@@ -1745,12 +1745,12 @@

# Save your tables to a variety of output formats:
@@ -1832,12 +1832,12 @@ 

-tinytable_vzhxuj0m159outzpq0j8 +tinytable_m0d5ihrifpqu0szkmfnt
-

Mean
+
@@ -1881,12 +1881,12 @@

diff --git a/man/datasummary_balance.html b/man/datasummary_balance.html index 8f504e63c..0692bd316 100644 --- a/man/datasummary_balance.html +++ b/man/datasummary_balance.html @@ -683,19 +683,19 @@

-tinytable_ulh2ykegwv72f064kn1v +tinytable_htibnfzqgnwsx37vn4fs
-

mean
+
@@ -822,12 +822,12 @@

diff --git a/man/datasummary_correlation.html b/man/datasummary_correlation.html index b330e3146..983c48645 100644 --- a/man/datasummary_correlation.html +++ b/man/datasummary_correlation.html @@ -649,12 +649,12 @@

-tinytable_grzw8xi4ix63dmd78n0p +tinytable_6uos5z8sgk9bsnoqyd87
-

+
@@ -688,12 +688,12 @@

# clean variable names (tidyverse)
@@ -755,12 +755,12 @@ 

-tinytable_5ox0wtvehi0xjlxiovka +tinytable_lirm7rmbmb1bhm3csgcq
-

Miles / Gallon
+
@@ -794,12 +794,12 @@

# alternative methods
@@ -857,12 +857,12 @@ 

-tinytable_xqd02z3d30gyj47o4kgz +tinytable_g1h47nvfzs3b4ydipnh2
-

Miles / Gallon
+
@@ -896,12 +896,12 @@

# custom function
@@ -960,12 +960,12 @@ 

-tinytable_2olu6wk3h3qqthxs8g0z +tinytable_akw46qppai3kvnvxdcc9
-

Miles / Gallon
+
@@ -999,12 +999,12 @@

# rename columns alphabetically and include a footnote for reference
@@ -1067,12 +1067,12 @@ 

-tinytable_unbyis56d7465brso0gh +tinytable_roj4xo4qo0ukg7h53ryb
-

Miles / Gallon
+
@@ -1107,12 +1107,12 @@

# `datasummary_correlation_format`: custom function with formatting
@@ -1181,13 +1181,13 @@ 

-tinytable_290nz6nezudmuuclwueb +tinytable_dtwgcvpkx4t7hz2i19th
-

(a)
+
@@ -1230,12 +1230,12 @@

# use kableExtra and psych to color significant cells
@@ -1326,13 +1326,13 @@ 

-tinytable_mq9s8yxqc31x4l6kzddz +tinytable_aeb5nr6svrb95kerwvmv
-

mpg
+
@@ -1375,12 +1375,12 @@

diff --git a/man/datasummary_correlation_format.html b/man/datasummary_correlation_format.html index 6c02b81d8..d1e9267ba 100644 --- a/man/datasummary_correlation_format.html +++ b/man/datasummary_correlation_format.html @@ -477,13 +477,13 @@ -tinytable_392nnoahgseq58zawjya +tinytable_3kc2pfl0q9hno0z8edkj
-

vs
+
@@ -526,12 +526,12 @@ diff --git a/man/datasummary_crosstab.html b/man/datasummary_crosstab.html index 3ad9361bd..68f50388c 100644 --- a/man/datasummary_crosstab.html +++ b/man/datasummary_crosstab.html @@ -664,15 +664,15 @@

-tinytable_lf0vwp3ves3ldpvhgfhj +tinytable_byny0s6ew83pn9r1jmnp
-

mpg
+
@@ -763,12 +763,12 @@

# crosstab of two variables, showing counts only and no totals
@@ -874,14 +874,14 @@ 

-tinytable_663m5e7737wydockz4f6 +tinytable_9y0mx65dvv7t2lrbz8pl
-

cyl
+
@@ -928,12 +928,12 @@

# crosstab of three variables
@@ -1004,16 +1004,16 @@ 

-tinytable_6aeigmuvtiy8r06xetaa +tinytable_h7nqis884hosurzbrir4
-

cyl
+
@@ -1167,12 +1167,12 @@

# crosstab with two variables and column percentages 
@@ -1330,14 +1330,14 @@ 

-tinytable_a07ln2dlnp2nawgi6t0p +tinytable_th6htlsfxr7lsk6i4if1
-

am cyl
+
@@ -1377,12 +1377,12 @@

diff --git a/man/dvnames.html b/man/dvnames.html index e25979847..911502b37 100644 --- a/man/dvnames.html +++ b/man/dvnames.html @@ -428,13 +428,13 @@ -tinytable_u2hh31udbdeemx98iz83 +tinytable_772j9f8vorr2x1vfz6mc
-

am
+
@@ -528,12 +528,12 @@
# With dvnames, they are "mpg" and "mpg"
@@ -630,13 +630,13 @@
   
     
 
-tinytable_f852o222qpbpp0nismmp
+tinytable_rw10sx05a65jh3z1p9vp
 
 
-
(1)
+
@@ -730,12 +730,12 @@ diff --git a/search.json b/search.json index f4688a610..96e760643 100644 --- a/search.json +++ b/search.json @@ -26,7 +26,7 @@ "href": "vignettes/get_started.html", "title": "Getting started", "section": "", - "text": "To begin, load the modelsummary package and download data from the Rdatasets archive:\n\nlibrary(modelsummary)\nlibrary(tinytable)\n\nurl <- 'https://vincentarelbundock.github.io/Rdatasets/csv/HistData/Guerry.csv'\ndat <- read.csv(url) \ndat$Small <- dat$Pop1831 > median(dat$Pop1831)\ndat <- dat[, \n c(\"Donations\", \"Literacy\", \"Commerce\", \"Crime_pers\", \"Crime_prop\", \"Clergy\", \"Small\")\n]\n\nData Summaries\nQuick overview of the data:\n\ndatasummary_skim(dat)\n\nWarning: The `replace_na` argument was renamed `replace`.\n\n\n \n\n \n \n\ntinytable_5s5s0ho4i0d11mopqcm0\n\n\n \n\n \n Unique\n Missing Pct.\n Mean\n SD\n Min\n Median\n Max\n Histogram\n \n\n\nDonations\n 85\n 0\n 7075.5\n 5834.6\n 1246.0\n 5020.0\n 37015.0\n \n \n\nLiteracy\n 50\n 0\n 39.3\n 17.4\n 12.0\n 38.0\n 74.0\n \n \n\nCommerce\n 84\n 0\n 42.8\n 25.0\n 1.0\n 42.5\n 86.0\n \n \n\nCrime_pers\n 85\n 0\n 19754.4\n 7504.7\n 2199.0\n 18748.5\n 37014.0\n \n \n\nCrime_prop\n 86\n 0\n 7843.1\n 3051.4\n 1368.0\n 7595.0\n 20235.0\n \n \n\nClergy\n 85\n 0\n 43.4\n 25.0\n 1.0\n 43.5\n 86.0\n \n \n\nSmall\n N\n %\n \n \n \n \n \n \n \n\nFALSE\n 43\n 50.0\n \n \n \n \n \n \n \n\nTRUE\n 43\n 50.0\n \n \n \n \n \n \n \n\n\n\n\n \n\n\nBalance table (aka “Table 1”) with differences in means by subgroups:\n\ndatasummary_balance(~Small, dat)\n\n \n\n \n \n\ntinytable_l9y4jxu9shckkefbll5k\n\n\n \n\n\n \nFALSE (N=43)\nTRUE (N=43)\n \n \n\n\n \n Mean\n Std. Dev.\n Mean\n Std. Dev.\n Diff. in Means\n Std. Error\n \n\n\n\nDonations \n 7258.5 \n 6194.1\n 6892.6 \n 5519.0\n -365.9 \n 1265.2\n \n\nLiteracy \n 37.9 \n 19.1 \n 40.6 \n 15.6 \n 2.7 \n 3.8 \n \n\nCommerce \n 42.7 \n 24.6 \n 43.0 \n 25.7 \n 0.3 \n 5.4 \n \n\nCrime_pers\n 18040.6\n 7638.4\n 21468.2\n 7044.3\n 3427.7 \n 1584.6\n \n\nCrime_prop\n 8422.5 \n 3406.7\n 7263.7 \n 2559.3\n -1158.8\n 649.8 \n \n\nClergy \n 39.1 \n 26.7 \n 47.7 \n 22.7 \n 8.6 \n 5.3 \n \n\n\n\n\n \n\n\nCorrelation table:\n\ndatasummary_correlation(dat)\n\n \n\n \n \n\ntinytable_8zpjnjnivhvk23crvyu3\n\n\n \n\n \n Donations\n Literacy\n Commerce\n Crime_pers\n Crime_prop\n Clergy\n \n\n\nDonations \n 1 \n . \n . \n . \n . \n .\n \n\nLiteracy \n -.13\n 1 \n . \n . \n . \n .\n \n\nCommerce \n .30 \n -.58\n 1 \n . \n . \n .\n \n\nCrime_pers\n -.04\n -.04\n .05 \n 1 \n . \n .\n \n\nCrime_prop\n -.13\n -.37\n .41 \n .27\n 1 \n .\n \n\nClergy \n .09 \n -.17\n -.12\n .26\n -.07\n 1\n \n\n\n\n\n \n\n\nTwo variables and two statistics, nested in subgroups:\n\ndatasummary(Literacy + Commerce ~ Small * (mean + sd), dat)\n\n \n\n \n \n\ntinytable_h3xk51iw9talhwi0q5um\n\n\n \n\n\n \nFALSE\nTRUE\n\n\n \n mean\n sd\n mean\n sd\n \n\n\n\nLiteracy\n 37.88\n 19.08\n 40.63\n 15.57\n \n\nCommerce\n 42.65\n 24.59\n 42.95\n 25.75\n \n\n\n\n\n \n\n\nModel Summaries\nEstimate a linear model and display the results:\n\nmod <- lm(Donations ~ Crime_prop, data = dat)\n\nmodelsummary(mod)\n\n \n\n \n \n\ntinytable_fa6zc8q2mjc0ixwi1rfq\n\n\n \n\n \n (1)\n \n\n\n(Intercept)\n 9065.287 \n \n\n \n (1738.926)\n \n\nCrime_prop \n -0.254 \n \n\n \n (0.207) \n \n\nNum.Obs. \n 86 \n \n\nR2 \n 0.018 \n \n\nR2 Adj. \n 0.006 \n \n\nAIC \n 1739.0 \n \n\nBIC \n 1746.4 \n \n\nLog.Lik. \n -866.516 \n \n\nF \n 1.505 \n \n\nRMSE \n 5749.29 \n \n\n\n\n\n \n\n\nNow estimate five regression models, display the results side-by-side, and use the group_tt() function from the tinytable package to add column labels:\n\nlibrary(tinytable)\n\nmodels <- list(\n \"I\" = lm(Donations ~ Literacy + Clergy, data = dat),\n \"II\" = lm(Crime_pers ~ Literacy + Clergy, data = dat),\n \"III\" = lm(Crime_prop ~ Literacy + Clergy, data = dat),\n \"IV\" = glm(Crime_pers ~ Literacy + Commerce, family = poisson, data = dat),\n \"V\" = glm(Donations ~ Literacy + Commerce, family = poisson, data = dat)\n)\n\nmodelsummary(models, stars = TRUE, gof_omit = \"IC|Adj|F|RMSE|Log\") |>\n group_tt(j = list(\"Linear\" = 2:4, \"Poisson\" = 5:6))\n\n \n\n \n \n\ntinytable_quyfgid783myjatx00rr\n\n\n \n\n\n \nLinear\nPoisson\n\n\n \n I\n II\n III\n IV\n V\n \n\n+ p \n\n\n(Intercept)\n 7948.667***\n 16259.384***\n 11243.544***\n 9.876***\n 8.241***\n \n\n \n (2078.276) \n (2611.140) \n (1011.240) \n (0.003) \n (0.006) \n \n\nLiteracy \n -39.121 \n 3.680 \n -68.507*** \n 0.000***\n 0.003***\n \n\n \n (37.052) \n (46.552) \n (18.029) \n (0.000) \n (0.000) \n \n\nClergy \n 15.257 \n 77.148* \n -16.376 \n \n \n \n\n \n (25.735) \n (32.334) \n (12.522) \n \n \n \n\nCommerce \n \n \n \n 0.001***\n 0.011***\n \n\n \n \n \n \n (0.000) \n (0.000) \n \n\nNum.Obs. \n 86 \n 86 \n 86 \n 86 \n 86 \n \n\nR2 \n 0.020 \n 0.065 \n 0.152 \n \n \n \n\n\n\n\n \n\n\nNow, save it to a Microsoft Word document:\n\nmodelsummary(models, output = \"table.docx\")\n\nAnd draw a coefficient plot:\n\nols <- models[1:3]\nmodelplot(ols, coef_omit = \"Intercept\")", + "text": "To begin, load the modelsummary package and download data from the Rdatasets archive:\n\nlibrary(modelsummary)\nlibrary(tinytable)\n\nurl <- 'https://vincentarelbundock.github.io/Rdatasets/csv/HistData/Guerry.csv'\ndat <- read.csv(url) \ndat$Small <- dat$Pop1831 > median(dat$Pop1831)\ndat <- dat[, \n c(\"Donations\", \"Literacy\", \"Commerce\", \"Crime_pers\", \"Crime_prop\", \"Clergy\", \"Small\")\n]\n\nData Summaries\nQuick overview of the data:\n\ndatasummary_skim(dat)\n\nWarning: The `replace_na` argument was renamed `replace`.\n\n\n \n\n \n \n\ntinytable_fu41m92s1ycg9slfxym7\n\n\n \n\n \n Unique\n Missing Pct.\n Mean\n SD\n Min\n Median\n Max\n Histogram\n \n\n\nDonations\n 85\n 0\n 7075.5\n 5834.6\n 1246.0\n 5020.0\n 37015.0\n \n \n\nLiteracy\n 50\n 0\n 39.3\n 17.4\n 12.0\n 38.0\n 74.0\n \n \n\nCommerce\n 84\n 0\n 42.8\n 25.0\n 1.0\n 42.5\n 86.0\n \n \n\nCrime_pers\n 85\n 0\n 19754.4\n 7504.7\n 2199.0\n 18748.5\n 37014.0\n \n \n\nCrime_prop\n 86\n 0\n 7843.1\n 3051.4\n 1368.0\n 7595.0\n 20235.0\n \n \n\nClergy\n 85\n 0\n 43.4\n 25.0\n 1.0\n 43.5\n 86.0\n \n \n\nSmall\n N\n %\n \n \n \n \n \n \n \n\nFALSE\n 43\n 50.0\n \n \n \n \n \n \n \n\nTRUE\n 43\n 50.0\n \n \n \n \n \n \n \n\n\n\n\n \n\n\nBalance table (aka “Table 1”) with differences in means by subgroups:\n\ndatasummary_balance(~Small, dat)\n\n \n\n \n \n\ntinytable_jix3v2s3wx24jey8dms4\n\n\n \n\n\n \nFALSE (N=43)\nTRUE (N=43)\n \n \n\n\n \n Mean\n Std. Dev.\n Mean\n Std. Dev.\n Diff. in Means\n Std. Error\n \n\n\n\nDonations \n 7258.5 \n 6194.1\n 6892.6 \n 5519.0\n -365.9 \n 1265.2\n \n\nLiteracy \n 37.9 \n 19.1 \n 40.6 \n 15.6 \n 2.7 \n 3.8 \n \n\nCommerce \n 42.7 \n 24.6 \n 43.0 \n 25.7 \n 0.3 \n 5.4 \n \n\nCrime_pers\n 18040.6\n 7638.4\n 21468.2\n 7044.3\n 3427.7 \n 1584.6\n \n\nCrime_prop\n 8422.5 \n 3406.7\n 7263.7 \n 2559.3\n -1158.8\n 649.8 \n \n\nClergy \n 39.1 \n 26.7 \n 47.7 \n 22.7 \n 8.6 \n 5.3 \n \n\n\n\n\n \n\n\nCorrelation table:\n\ndatasummary_correlation(dat)\n\n \n\n \n \n\ntinytable_6p6juxs5bbgjbyf563kj\n\n\n \n\n \n Donations\n Literacy\n Commerce\n Crime_pers\n Crime_prop\n Clergy\n \n\n\nDonations \n 1 \n . \n . \n . \n . \n .\n \n\nLiteracy \n -.13\n 1 \n . \n . \n . \n .\n \n\nCommerce \n .30 \n -.58\n 1 \n . \n . \n .\n \n\nCrime_pers\n -.04\n -.04\n .05 \n 1 \n . \n .\n \n\nCrime_prop\n -.13\n -.37\n .41 \n .27\n 1 \n .\n \n\nClergy \n .09 \n -.17\n -.12\n .26\n -.07\n 1\n \n\n\n\n\n \n\n\nTwo variables and two statistics, nested in subgroups:\n\ndatasummary(Literacy + Commerce ~ Small * (mean + sd), dat)\n\n \n\n \n \n\ntinytable_11gc7k5h1ifepyq47x4q\n\n\n \n\n\n \nFALSE\nTRUE\n\n\n \n mean\n sd\n mean\n sd\n \n\n\n\nLiteracy\n 37.88\n 19.08\n 40.63\n 15.57\n \n\nCommerce\n 42.65\n 24.59\n 42.95\n 25.75\n \n\n\n\n\n \n\n\nModel Summaries\nEstimate a linear model and display the results:\n\nmod <- lm(Donations ~ Crime_prop, data = dat)\n\nmodelsummary(mod)\n\n \n\n \n \n\ntinytable_tmbigvd1v3gu1torosoe\n\n\n \n\n \n (1)\n \n\n\n(Intercept)\n 9065.287 \n \n\n \n (1738.926)\n \n\nCrime_prop \n -0.254 \n \n\n \n (0.207) \n \n\nNum.Obs. \n 86 \n \n\nR2 \n 0.018 \n \n\nR2 Adj. \n 0.006 \n \n\nAIC \n 1739.0 \n \n\nBIC \n 1746.4 \n \n\nLog.Lik. \n -866.516 \n \n\nF \n 1.505 \n \n\nRMSE \n 5749.29 \n \n\n\n\n\n \n\n\nNow estimate five regression models, display the results side-by-side, and use the group_tt() function from the tinytable package to add column labels:\n\nlibrary(tinytable)\n\nmodels <- list(\n \"I\" = lm(Donations ~ Literacy + Clergy, data = dat),\n \"II\" = lm(Crime_pers ~ Literacy + Clergy, data = dat),\n \"III\" = lm(Crime_prop ~ Literacy + Clergy, data = dat),\n \"IV\" = glm(Crime_pers ~ Literacy + Commerce, family = poisson, data = dat),\n \"V\" = glm(Donations ~ Literacy + Commerce, family = poisson, data = dat)\n)\n\nmodelsummary(models, stars = TRUE, gof_omit = \"IC|Adj|F|RMSE|Log\") |>\n group_tt(j = list(\"Linear\" = 2:4, \"Poisson\" = 5:6))\n\n \n\n \n \n\ntinytable_0oye7fg5i25ioctkqqb4\n\n\n \n\n\n \nLinear\nPoisson\n\n\n \n I\n II\n III\n IV\n V\n \n\n+ p \n\n\n(Intercept)\n 7948.667***\n 16259.384***\n 11243.544***\n 9.876***\n 8.241***\n \n\n \n (2078.276) \n (2611.140) \n (1011.240) \n (0.003) \n (0.006) \n \n\nLiteracy \n -39.121 \n 3.680 \n -68.507*** \n 0.000***\n 0.003***\n \n\n \n (37.052) \n (46.552) \n (18.029) \n (0.000) \n (0.000) \n \n\nClergy \n 15.257 \n 77.148* \n -16.376 \n \n \n \n\n \n (25.735) \n (32.334) \n (12.522) \n \n \n \n\nCommerce \n \n \n \n 0.001***\n 0.011***\n \n\n \n \n \n \n (0.000) \n (0.000) \n \n\nNum.Obs. \n 86 \n 86 \n 86 \n 86 \n 86 \n \n\nR2 \n 0.020 \n 0.065 \n 0.152 \n \n \n \n\n\n\n\n \n\n\nNow, save it to a Microsoft Word document:\n\nmodelsummary(models, output = \"table.docx\")\n\nAnd draw a coefficient plot:\n\nols <- models[1:3]\nmodelplot(ols, coef_omit = \"Intercept\")", "crumbs": [ "Get started", "Getting started" @@ -133,7 +133,7 @@ "href": "man/datasummary.html", "title": "modelsummary: Data and Model Summaries in R", "section": "", - "text": "Summary tables using 2-sided formulae: crosstabs, frequencies, table 1s and more.\nDescription\ndatasummary can use any summary function which produces one numeric or character value per variable. The examples section of this documentation shows how to define custom summary functions.\nmodelsummary also supplies several shortcut summary functions which can be used in datasummary() formulas: Min, Max, Mean, Median, Var, SD, NPercent, NUnique, Ncol, P0, P25, P50, P75, P100.\nSee the Details and Examples sections below, and the vignettes on the modelsummary website:\n\n\nhttps://modelsummary.com/\n\n\nhttps://modelsummary.com/articles/datasummary.html\n\nUsage\ndatasummary(\n formula,\n data,\n output = \"default\",\n fmt = 2,\n title = NULL,\n notes = NULL,\n align = NULL,\n add_columns = NULL,\n add_rows = NULL,\n sparse_header = TRUE,\n escape = TRUE,\n ...\n)\n\nArguments\n\n\n\nformula\n\n\nA two-sided formula to describe the table: rows ~ columns. See the Examples section for a mini-tutorial and the Details section for more resources. Grouping/nesting variables can appear on both sides of the formula, but all summary functions must be on one side.\n\n\n\n\ndata\n\n\nA data.frame (or tibble)\n\n\n\n\noutput\n\n\nfilename or object type (character string)\n\n\nSupported filename extensions: .docx, .html, .tex, .md, .txt, .csv, .xlsx, .png, .jpg\n\n\nSupported object types: \"default\", \"html\", \"markdown\", \"latex\", \"latex_tabular\", \"typst\", \"data.frame\", \"tinytable\", \"gt\", \"kableExtra\", \"huxtable\", \"flextable\", \"DT\", \"jupyter\". The \"modelsummary_list\" value produces a lightweight object which can be saved and fed back to the modelsummary function.\n\n\nThe \"default\" output format can be set to \"tinytable\", \"kableExtra\", \"gt\", \"flextable\", \"huxtable\", \"DT\", or \"markdown\"\n\n\nIf the user does not choose a default value, the packages listed above are tried in sequence.\n\n\nSession-specific configuration: options(“modelsummary_factory_default” = “gt”)\n\n\nPersistent configuration: config_modelsummary(output = “markdown”)\n\n\n\n\nWarning: Users should not supply a file name to the output argument if they intend to customize the table with external packages. See the ‘Details’ section.\n\n\nLaTeX compilation requires the booktabs and siunitx packages, but siunitx can be disabled or replaced with global options. See the ‘Details’ section.\n\n\n\n\n\n\nfmt\n\n\nhow to format numeric values: integer, user-supplied function, or modelsummary function.\n\n\nInteger: Number of decimal digits\n\n\nUser-supplied functions:\n\n\nAny function which accepts a numeric vector and returns a character vector of the same length.\n\n\n\n\nmodelsummary functions:\n\n\nfmt = fmt_significant(2): Two significant digits (at the term-level)\n\n\nfmt = fmt_sprintf(“%.3f”): See ?sprintf\n\n\nfmt = fmt_identity(): unformatted raw values\n\n\n\n\n\n\n\n\ntitle\n\n\nstring\n\n\n\n\nnotes\n\n\nlist or vector of notes to append to the bottom of the table.\n\n\n\n\nalign\n\n\nA string with a number of characters equal to the number of columns in the table (e.g., align = “lcc”). Valid characters: l, c, r, d.\n\n\n\"l\": left-aligned column\n\n\n\"c\": centered column\n\n\n\"r\": right-aligned column\n\n\n\"d\": dot-aligned column. For LaTeX/PDF output, this option requires at least version 3.0.25 of the siunitx LaTeX package. See the LaTeX preamble help section below for commands to insert in your LaTeX preamble.\n\n\n\n\n\n\nadd_columns\n\n\na data.frame (or tibble) with the same number of rows as your main table.\n\n\n\n\nadd_rows\n\n\na data.frame (or tibble) with the same number of columns as your main table. By default, rows are appended to the bottom of the table. You can define a \"position\" attribute of integers to set the row positions. See Examples section below.\n\n\n\n\nsparse_header\n\n\nTRUE or FALSE. TRUE eliminates column headers which have a unique label across all columns, except for the row immediately above the data. FALSE keeps all headers. The order in which terms are entered in the formula determines the order in which headers appear. For example, x~mean*z will print the mean-related header above the z-related header.’\n\n\n\n\nescape\n\n\nboolean TRUE escapes or substitutes LaTeX/HTML characters which could prevent the file from compiling/displaying. TRUE escapes all cells, captions, and notes. Users can have more fine-grained control by setting escape=FALSE and using an external command such as: modelsummary(model, “latex”) |> tinytable::format_tt(tab, j=1:5, escape=TRUE)\n\n\n\n\n…\n\n\nall other arguments are passed through to the table-making functions tinytable::tt, kableExtra::kbl, gt::gt, DT::datatable, etc. depending on the output argument. This allows users to pass arguments directly to datasummary in order to affect the behavior of other functions behind the scenes.\n\n\nDetails\nVisit the ‘modelsummary’ website for more usage examples: https://modelsummary.com\nThe ‘datasummary’ function is a thin wrapper around the ‘tabular’ function from the ‘tables’ package. More details about table-making formulas can be found in the ‘tables’ package documentation: ?tables::tabular\nHierarchical or \"nested\" column labels are only available for these output formats: tinytable, kableExtra, gt, html, rtf, and LaTeX. When saving tables to other formats, nested labels will be combined to a \"flat\" header.\nGlobal Options\nThe behavior of modelsummary can be modified by setting global options. For example:\n\n\noptions(modelsummary_model_labels = “roman”)\n\n\nThe rest of this section describes each of the options above.\n\nModel labels: default column names\n\nThese global option changes the style of the default column headers:\n\n\noptions(modelsummary_model_labels = “roman”)\n\n\noptions(modelsummary_panel_labels = “roman”)\n\n\nThe supported styles are: \"model\", \"panel\", \"arabic\", \"letters\", \"roman\", \"(arabic)\", \"(letters)\", \"(roman)\"\nThe panel-specific option is only used when shape=“rbind”\n\nTable-making packages\n\nmodelsummary supports 6 table-making packages: tinytable, kableExtra, gt, flextable, huxtable, and DT. Some of these packages have overlapping functionalities. To change the default backend used for a specific file format, you can use ’ the options function:\noptions(modelsummary_factory_html = ‘kableExtra’) options(modelsummary_factory_latex = ‘gt’) options(modelsummary_factory_word = ‘huxtable’) options(modelsummary_factory_png = ‘gt’)\n\nTable themes\n\nChange the look of tables in an automated and replicable way, using the modelsummary theming functionality. See the vignette: https://modelsummary.com/articles/appearance.html\n\n\nmodelsummary_theme_gt\n\n\nmodelsummary_theme_kableExtra\n\n\nmodelsummary_theme_huxtable\n\n\nmodelsummary_theme_flextable\n\n\nmodelsummary_theme_dataframe\n\n\n\nModel extraction functions\n\nmodelsummary can use two sets of packages to extract information from statistical models: the easystats family (performance and parameters) and broom. By default, it uses easystats first and then falls back on broom in case of failure. You can change the order of priorities or include goodness-of-fit extracted by both packages by setting:\noptions(modelsummary_get = “easystats”)\noptions(modelsummary_get = “broom”)\noptions(modelsummary_get = “all”)\n\nFormatting numeric entries\n\nBy default, LaTeX tables enclose all numeric entries in the command from the siunitx package. To prevent this behavior, or to enclose numbers in dollar signs (for LaTeX math mode), users can call:\noptions(modelsummary_format_numeric_latex = “plain”)\noptions(modelsummary_format_numeric_latex = “mathmode”)\nA similar option can be used to display numerical entries using MathJax in HTML tables:\noptions(modelsummary_format_numeric_html = “mathjax”)\n\nLaTeX preamble\n\nWhen creating LaTeX via the tinytable backend (default in version 2.0.0 and later), it is useful to include the following commands in the LaTeX preamble of your documents. Note that they are added automatically when compiling Rmarkdown or Quarto documents.\n[3]{}\nExamples\n\nlibrary(modelsummary)\n\nlibrary(modelsummary)\n\n# The left-hand side of the formula describes rows, and the right-hand side\n# describes columns. This table uses the \"mpg\" variable as a row and the \"mean\"\n# function as a column:\n\ndatasummary(mpg ~ mean, data = mtcars)\n\n \n\n \n \n\ntinytable_cb8fc5hsp369x94z5o0a\n\n\n \n\n \n mean\n \n\nmpg\n 20.09\n \n\n\n\n \n\n# This table uses the \"mean\" function as a row and the \"mpg\" variable as a column:\n\ndatasummary(mean ~ mpg, data = mtcars)\n\n \n\n \n \n\ntinytable_mgqzua34nrdbo0v0heu9\n\n\n \n\n \n mpg\n \n\nmean\n 20.09\n \n\n\n\n \n\n# Display several variables or functions of the data using the \"+\"\n# concatenation operator. This table has 2 rows and 2 columns:\n\ndatasummary(hp + mpg ~ mean + sd, data = mtcars)\n\n \n\n \n \n\ntinytable_ydb1f98fs4e1zy5fytpa\n\n\n \n\n \n mean\n sd\n \n\n\nhp \n 146.69\n 68.56\n \n\nmpg\n 20.09 \n 6.03 \n \n\n\n\n\n \n\n# Nest variables or statistics inside a \"factor\" variable using the \"*\" nesting\n# operator. This table shows the mean of \"hp\" and \"mpg\" for each value of\n# \"cyl\":\n\nmtcars$cyl <- as.factor(mtcars$cyl)\ndatasummary(hp + mpg ~ cyl * mean, data = mtcars)\n\n \n\n \n \n\ntinytable_6ex7dqxtss02tkvvzr3x\n\n\n \n\n \n 4\n 6\n 8\n \n\n\nhp \n 82.64\n 122.29\n 209.21\n \n\nmpg\n 26.66\n 19.74 \n 15.10 \n \n\n\n\n\n \n\n# If you don't want to convert your original data\n# to factors, you can use the 'Factor()'\n# function inside 'datasummary' to obtain an identical result:\n\ndatasummary(hp + mpg ~ Factor(cyl) * mean, data = mtcars)\n\n \n\n \n \n\ntinytable_l52r23bymea3u35ybhe9\n\n\n \n\n \n 4\n 6\n 8\n \n\n\nhp \n 82.64\n 122.29\n 209.21\n \n\nmpg\n 26.66\n 19.74 \n 15.10 \n \n\n\n\n\n \n\n# You can nest several variables or statistics inside a factor by using\n# parentheses. This table shows the mean and the standard deviation for each\n# subset of \"cyl\":\n\ndatasummary(hp + mpg ~ cyl * (mean + sd), data = mtcars)\n\n \n\n \n \n\ntinytable_7aa4ffdw2msezxtwh3hg\n\n\n \n\n\n \n4\n6\n8\n\n\n \n mean\n sd\n mean\n sd\n mean\n sd\n \n\n\n\nhp \n 82.64\n 20.93\n 122.29\n 24.26\n 209.21\n 50.98\n \n\nmpg\n 26.66\n 4.51 \n 19.74 \n 1.45 \n 15.10 \n 2.56 \n \n\n\n\n\n \n\n# Summarize all numeric variables with 'All()'\ndatasummary(All(mtcars) ~ mean + sd, data = mtcars)\n\n \n\n \n \n\ntinytable_pawkzn9g4hyhhyucmnml\n\n\n \n\n \n mean\n sd\n \n\n\nmpg \n 20.09 \n 6.03 \n \n\ndisp\n 230.72\n 123.94\n \n\nhp \n 146.69\n 68.56 \n \n\ndrat\n 3.60 \n 0.53 \n \n\nwt \n 3.22 \n 0.98 \n \n\nqsec\n 17.85 \n 1.79 \n \n\nvs \n 0.44 \n 0.50 \n \n\nam \n 0.41 \n 0.50 \n \n\ngear\n 3.69 \n 0.74 \n \n\ncarb\n 2.81 \n 1.62 \n \n\n\n\n\n \n\n# Define custom summary statistics. Your custom function should accept a vector\n# of numeric values and return a single numeric or string value:\n\nminmax <- function(x) sprintf(\"[%.2f, %.2f]\", min(x), max(x))\nmean_na <- function(x) mean(x, na.rm = TRUE)\n\ndatasummary(hp + mpg ~ minmax + mean_na, data = mtcars)\n\n \n\n \n \n\ntinytable_4d9z84cto2ud51troo8a\n\n\n \n\n \n minmax\n mean_na\n \n\n\nhp \n [52.00, 335.00]\n 146.69\n \n\nmpg\n [10.40, 33.90] \n 20.09 \n \n\n\n\n\n \n\n# To handle missing values, you can pass arguments to your functions using\n# '*Arguments()'\n\ndatasummary(hp + mpg ~ mean * Arguments(na.rm = TRUE), data = mtcars)\n\n \n\n \n \n\ntinytable_m2i8k8eiy3qx5in92i21\n\n\n \n\n \n mean\n \n\n\nhp \n 146.69\n \n\nmpg\n 20.09 \n \n\n\n\n\n \n\n# For convenience, 'modelsummary' supplies several convenience functions\n# with the argument `na.rm=TRUE` by default: Mean, Median, Min, Max, SD, Var,\n# P0, P25, P50, P75, P100, NUnique, Histogram\n\n#datasummary(hp + mpg ~ Mean + SD + Histogram, data = mtcars)\n\n# These functions also accept a 'fmt' argument which allows you to\n# round/format the results\n\ndatasummary(hp + mpg ~ Mean * Arguments(fmt = \"%.3f\") + SD * Arguments(fmt = \"%.1f\"), data = mtcars)\n\n \n\n \n \n\ntinytable_e7pur5j2cizht4r7vfbd\n\n\n \n\n \n Mean\n SD\n \n\n\nhp \n 146.688\n 68.6\n \n\nmpg\n 20.091 \n 6.0 \n \n\n\n\n\n \n\n# Save your tables to a variety of output formats:\nf <- hp + mpg ~ Mean + SD\n#datasummary(f, data = mtcars, output = 'table.html')\n#datasummary(f, data = mtcars, output = 'table.tex')\n#datasummary(f, data = mtcars, output = 'table.md')\n#datasummary(f, data = mtcars, output = 'table.docx')\n#datasummary(f, data = mtcars, output = 'table.pptx')\n#datasummary(f, data = mtcars, output = 'table.jpg')\n#datasummary(f, data = mtcars, output = 'table.png')\n\n# Display human-readable code\n#datasummary(f, data = mtcars, output = 'html')\n#datasummary(f, data = mtcars, output = 'markdown')\n#datasummary(f, data = mtcars, output = 'latex')\n\n# Return a table object to customize using a table-making package\n#datasummary(f, data = mtcars, output = 'tinytable')\n#datasummary(f, data = mtcars, output = 'gt')\n#datasummary(f, data = mtcars, output = 'kableExtra')\n#datasummary(f, data = mtcars, output = 'flextable')\n#datasummary(f, data = mtcars, output = 'huxtable')\n\n# add_rows\nnew_rows <- data.frame(a = 1:2, b = 2:3, c = 4:5)\nattr(new_rows, 'position') <- c(1, 3)\ndatasummary(mpg + hp ~ mean + sd, data = mtcars, add_rows = new_rows)\n\n \n\n \n \n\ntinytable_vzhxuj0m159outzpq0j8\n\n\n \n\n \n mean\n sd\n \n\n\n1.00\n 2.00 \n 4.00 \n \n\nmpg \n 20.09 \n 6.03 \n \n\n2.00\n 3.00 \n 5.00 \n \n\nhp \n 146.69\n 68.56", + "text": "Summary tables using 2-sided formulae: crosstabs, frequencies, table 1s and more.\nDescription\ndatasummary can use any summary function which produces one numeric or character value per variable. The examples section of this documentation shows how to define custom summary functions.\nmodelsummary also supplies several shortcut summary functions which can be used in datasummary() formulas: Min, Max, Mean, Median, Var, SD, NPercent, NUnique, Ncol, P0, P25, P50, P75, P100.\nSee the Details and Examples sections below, and the vignettes on the modelsummary website:\n\n\nhttps://modelsummary.com/\n\n\nhttps://modelsummary.com/articles/datasummary.html\n\nUsage\ndatasummary(\n formula,\n data,\n output = \"default\",\n fmt = 2,\n title = NULL,\n notes = NULL,\n align = NULL,\n add_columns = NULL,\n add_rows = NULL,\n sparse_header = TRUE,\n escape = TRUE,\n ...\n)\n\nArguments\n\n\n\nformula\n\n\nA two-sided formula to describe the table: rows ~ columns. See the Examples section for a mini-tutorial and the Details section for more resources. Grouping/nesting variables can appear on both sides of the formula, but all summary functions must be on one side.\n\n\n\n\ndata\n\n\nA data.frame (or tibble)\n\n\n\n\noutput\n\n\nfilename or object type (character string)\n\n\nSupported filename extensions: .docx, .html, .tex, .md, .txt, .csv, .xlsx, .png, .jpg\n\n\nSupported object types: \"default\", \"html\", \"markdown\", \"latex\", \"latex_tabular\", \"typst\", \"data.frame\", \"tinytable\", \"gt\", \"kableExtra\", \"huxtable\", \"flextable\", \"DT\", \"jupyter\". The \"modelsummary_list\" value produces a lightweight object which can be saved and fed back to the modelsummary function.\n\n\nThe \"default\" output format can be set to \"tinytable\", \"kableExtra\", \"gt\", \"flextable\", \"huxtable\", \"DT\", or \"markdown\"\n\n\nIf the user does not choose a default value, the packages listed above are tried in sequence.\n\n\nSession-specific configuration: options(“modelsummary_factory_default” = “gt”)\n\n\nPersistent configuration: config_modelsummary(output = “markdown”)\n\n\n\n\nWarning: Users should not supply a file name to the output argument if they intend to customize the table with external packages. See the ‘Details’ section.\n\n\nLaTeX compilation requires the booktabs and siunitx packages, but siunitx can be disabled or replaced with global options. See the ‘Details’ section.\n\n\n\n\n\n\nfmt\n\n\nhow to format numeric values: integer, user-supplied function, or modelsummary function.\n\n\nInteger: Number of decimal digits\n\n\nUser-supplied functions:\n\n\nAny function which accepts a numeric vector and returns a character vector of the same length.\n\n\n\n\nmodelsummary functions:\n\n\nfmt = fmt_significant(2): Two significant digits (at the term-level)\n\n\nfmt = fmt_sprintf(“%.3f”): See ?sprintf\n\n\nfmt = fmt_identity(): unformatted raw values\n\n\n\n\n\n\n\n\ntitle\n\n\nstring\n\n\n\n\nnotes\n\n\nlist or vector of notes to append to the bottom of the table.\n\n\n\n\nalign\n\n\nA string with a number of characters equal to the number of columns in the table (e.g., align = “lcc”). Valid characters: l, c, r, d.\n\n\n\"l\": left-aligned column\n\n\n\"c\": centered column\n\n\n\"r\": right-aligned column\n\n\n\"d\": dot-aligned column. For LaTeX/PDF output, this option requires at least version 3.0.25 of the siunitx LaTeX package. See the LaTeX preamble help section below for commands to insert in your LaTeX preamble.\n\n\n\n\n\n\nadd_columns\n\n\na data.frame (or tibble) with the same number of rows as your main table.\n\n\n\n\nadd_rows\n\n\na data.frame (or tibble) with the same number of columns as your main table. By default, rows are appended to the bottom of the table. You can define a \"position\" attribute of integers to set the row positions. See Examples section below.\n\n\n\n\nsparse_header\n\n\nTRUE or FALSE. TRUE eliminates column headers which have a unique label across all columns, except for the row immediately above the data. FALSE keeps all headers. The order in which terms are entered in the formula determines the order in which headers appear. For example, x~mean*z will print the mean-related header above the z-related header.’\n\n\n\n\nescape\n\n\nboolean TRUE escapes or substitutes LaTeX/HTML characters which could prevent the file from compiling/displaying. TRUE escapes all cells, captions, and notes. Users can have more fine-grained control by setting escape=FALSE and using an external command such as: modelsummary(model, “latex”) |> tinytable::format_tt(tab, j=1:5, escape=TRUE)\n\n\n\n\n…\n\n\nall other arguments are passed through to the table-making functions tinytable::tt, kableExtra::kbl, gt::gt, DT::datatable, etc. depending on the output argument. This allows users to pass arguments directly to datasummary in order to affect the behavior of other functions behind the scenes.\n\n\nDetails\nVisit the ‘modelsummary’ website for more usage examples: https://modelsummary.com\nThe ‘datasummary’ function is a thin wrapper around the ‘tabular’ function from the ‘tables’ package. More details about table-making formulas can be found in the ‘tables’ package documentation: ?tables::tabular\nHierarchical or \"nested\" column labels are only available for these output formats: tinytable, kableExtra, gt, html, rtf, and LaTeX. When saving tables to other formats, nested labels will be combined to a \"flat\" header.\nGlobal Options\nThe behavior of modelsummary can be modified by setting global options. For example:\n\n\noptions(modelsummary_model_labels = “roman”)\n\n\nThe rest of this section describes each of the options above.\n\nModel labels: default column names\n\nThese global option changes the style of the default column headers:\n\n\noptions(modelsummary_model_labels = “roman”)\n\n\noptions(modelsummary_panel_labels = “roman”)\n\n\nThe supported styles are: \"model\", \"panel\", \"arabic\", \"letters\", \"roman\", \"(arabic)\", \"(letters)\", \"(roman)\"\nThe panel-specific option is only used when shape=“rbind”\n\nTable-making packages\n\nmodelsummary supports 6 table-making packages: tinytable, kableExtra, gt, flextable, huxtable, and DT. Some of these packages have overlapping functionalities. To change the default backend used for a specific file format, you can use ’ the options function:\noptions(modelsummary_factory_html = ‘kableExtra’) options(modelsummary_factory_latex = ‘gt’) options(modelsummary_factory_word = ‘huxtable’) options(modelsummary_factory_png = ‘gt’)\n\nTable themes\n\nChange the look of tables in an automated and replicable way, using the modelsummary theming functionality. See the vignette: https://modelsummary.com/articles/appearance.html\n\n\nmodelsummary_theme_gt\n\n\nmodelsummary_theme_kableExtra\n\n\nmodelsummary_theme_huxtable\n\n\nmodelsummary_theme_flextable\n\n\nmodelsummary_theme_dataframe\n\n\n\nModel extraction functions\n\nmodelsummary can use two sets of packages to extract information from statistical models: the easystats family (performance and parameters) and broom. By default, it uses easystats first and then falls back on broom in case of failure. You can change the order of priorities or include goodness-of-fit extracted by both packages by setting:\noptions(modelsummary_get = “easystats”)\noptions(modelsummary_get = “broom”)\noptions(modelsummary_get = “all”)\n\nFormatting numeric entries\n\nBy default, LaTeX tables enclose all numeric entries in the command from the siunitx package. To prevent this behavior, or to enclose numbers in dollar signs (for LaTeX math mode), users can call:\noptions(modelsummary_format_numeric_latex = “plain”)\noptions(modelsummary_format_numeric_latex = “mathmode”)\nA similar option can be used to display numerical entries using MathJax in HTML tables:\noptions(modelsummary_format_numeric_html = “mathjax”)\n\nLaTeX preamble\n\nWhen creating LaTeX via the tinytable backend (default in version 2.0.0 and later), it is useful to include the following commands in the LaTeX preamble of your documents. Note that they are added automatically when compiling Rmarkdown or Quarto documents.\n[3]{}\nExamples\n\nlibrary(modelsummary)\n\nlibrary(modelsummary)\n\n# The left-hand side of the formula describes rows, and the right-hand side\n# describes columns. This table uses the \"mpg\" variable as a row and the \"mean\"\n# function as a column:\n\ndatasummary(mpg ~ mean, data = mtcars)\n\n \n\n \n \n\ntinytable_s7semkrxgev97l5nkimp\n\n\n \n\n \n mean\n \n\nmpg\n 20.09\n \n\n\n\n \n\n# This table uses the \"mean\" function as a row and the \"mpg\" variable as a column:\n\ndatasummary(mean ~ mpg, data = mtcars)\n\n \n\n \n \n\ntinytable_m7khicbwak6fux9qxac0\n\n\n \n\n \n mpg\n \n\nmean\n 20.09\n \n\n\n\n \n\n# Display several variables or functions of the data using the \"+\"\n# concatenation operator. This table has 2 rows and 2 columns:\n\ndatasummary(hp + mpg ~ mean + sd, data = mtcars)\n\n \n\n \n \n\ntinytable_5nbmj7vh0iruu3ozufjr\n\n\n \n\n \n mean\n sd\n \n\n\nhp \n 146.69\n 68.56\n \n\nmpg\n 20.09 \n 6.03 \n \n\n\n\n\n \n\n# Nest variables or statistics inside a \"factor\" variable using the \"*\" nesting\n# operator. This table shows the mean of \"hp\" and \"mpg\" for each value of\n# \"cyl\":\n\nmtcars$cyl <- as.factor(mtcars$cyl)\ndatasummary(hp + mpg ~ cyl * mean, data = mtcars)\n\n \n\n \n \n\ntinytable_ignv475l53xdk408swtw\n\n\n \n\n \n 4\n 6\n 8\n \n\n\nhp \n 82.64\n 122.29\n 209.21\n \n\nmpg\n 26.66\n 19.74 \n 15.10 \n \n\n\n\n\n \n\n# If you don't want to convert your original data\n# to factors, you can use the 'Factor()'\n# function inside 'datasummary' to obtain an identical result:\n\ndatasummary(hp + mpg ~ Factor(cyl) * mean, data = mtcars)\n\n \n\n \n \n\ntinytable_32pkvff7ay2rlgqbbfwy\n\n\n \n\n \n 4\n 6\n 8\n \n\n\nhp \n 82.64\n 122.29\n 209.21\n \n\nmpg\n 26.66\n 19.74 \n 15.10 \n \n\n\n\n\n \n\n# You can nest several variables or statistics inside a factor by using\n# parentheses. This table shows the mean and the standard deviation for each\n# subset of \"cyl\":\n\ndatasummary(hp + mpg ~ cyl * (mean + sd), data = mtcars)\n\n \n\n \n \n\ntinytable_n00bdt35ylfp8306esnw\n\n\n \n\n\n \n4\n6\n8\n\n\n \n mean\n sd\n mean\n sd\n mean\n sd\n \n\n\n\nhp \n 82.64\n 20.93\n 122.29\n 24.26\n 209.21\n 50.98\n \n\nmpg\n 26.66\n 4.51 \n 19.74 \n 1.45 \n 15.10 \n 2.56 \n \n\n\n\n\n \n\n# Summarize all numeric variables with 'All()'\ndatasummary(All(mtcars) ~ mean + sd, data = mtcars)\n\n \n\n \n \n\ntinytable_ricso3pa8t0vzuqh3t1d\n\n\n \n\n \n mean\n sd\n \n\n\nmpg \n 20.09 \n 6.03 \n \n\ndisp\n 230.72\n 123.94\n \n\nhp \n 146.69\n 68.56 \n \n\ndrat\n 3.60 \n 0.53 \n \n\nwt \n 3.22 \n 0.98 \n \n\nqsec\n 17.85 \n 1.79 \n \n\nvs \n 0.44 \n 0.50 \n \n\nam \n 0.41 \n 0.50 \n \n\ngear\n 3.69 \n 0.74 \n \n\ncarb\n 2.81 \n 1.62 \n \n\n\n\n\n \n\n# Define custom summary statistics. Your custom function should accept a vector\n# of numeric values and return a single numeric or string value:\n\nminmax <- function(x) sprintf(\"[%.2f, %.2f]\", min(x), max(x))\nmean_na <- function(x) mean(x, na.rm = TRUE)\n\ndatasummary(hp + mpg ~ minmax + mean_na, data = mtcars)\n\n \n\n \n \n\ntinytable_9pat3wi7wv8h2vk57pqg\n\n\n \n\n \n minmax\n mean_na\n \n\n\nhp \n [52.00, 335.00]\n 146.69\n \n\nmpg\n [10.40, 33.90] \n 20.09 \n \n\n\n\n\n \n\n# To handle missing values, you can pass arguments to your functions using\n# '*Arguments()'\n\ndatasummary(hp + mpg ~ mean * Arguments(na.rm = TRUE), data = mtcars)\n\n \n\n \n \n\ntinytable_81ezsy5w7a0oyus0zl8x\n\n\n \n\n \n mean\n \n\n\nhp \n 146.69\n \n\nmpg\n 20.09 \n \n\n\n\n\n \n\n# For convenience, 'modelsummary' supplies several convenience functions\n# with the argument `na.rm=TRUE` by default: Mean, Median, Min, Max, SD, Var,\n# P0, P25, P50, P75, P100, NUnique, Histogram\n\n#datasummary(hp + mpg ~ Mean + SD + Histogram, data = mtcars)\n\n# These functions also accept a 'fmt' argument which allows you to\n# round/format the results\n\ndatasummary(hp + mpg ~ Mean * Arguments(fmt = \"%.3f\") + SD * Arguments(fmt = \"%.1f\"), data = mtcars)\n\n \n\n \n \n\ntinytable_u7t4m9cdy5jzxj3fvtdx\n\n\n \n\n \n Mean\n SD\n \n\n\nhp \n 146.688\n 68.6\n \n\nmpg\n 20.091 \n 6.0 \n \n\n\n\n\n \n\n# Save your tables to a variety of output formats:\nf <- hp + mpg ~ Mean + SD\n#datasummary(f, data = mtcars, output = 'table.html')\n#datasummary(f, data = mtcars, output = 'table.tex')\n#datasummary(f, data = mtcars, output = 'table.md')\n#datasummary(f, data = mtcars, output = 'table.docx')\n#datasummary(f, data = mtcars, output = 'table.pptx')\n#datasummary(f, data = mtcars, output = 'table.jpg')\n#datasummary(f, data = mtcars, output = 'table.png')\n\n# Display human-readable code\n#datasummary(f, data = mtcars, output = 'html')\n#datasummary(f, data = mtcars, output = 'markdown')\n#datasummary(f, data = mtcars, output = 'latex')\n\n# Return a table object to customize using a table-making package\n#datasummary(f, data = mtcars, output = 'tinytable')\n#datasummary(f, data = mtcars, output = 'gt')\n#datasummary(f, data = mtcars, output = 'kableExtra')\n#datasummary(f, data = mtcars, output = 'flextable')\n#datasummary(f, data = mtcars, output = 'huxtable')\n\n# add_rows\nnew_rows <- data.frame(a = 1:2, b = 2:3, c = 4:5)\nattr(new_rows, 'position') <- c(1, 3)\ndatasummary(mpg + hp ~ mean + sd, data = mtcars, add_rows = new_rows)\n\n \n\n \n \n\ntinytable_m0d5ihrifpqu0szkmfnt\n\n\n \n\n \n mean\n sd\n \n\n\n1.00\n 2.00 \n 4.00 \n \n\nmpg \n 20.09 \n 6.03 \n \n\n2.00\n 3.00 \n 5.00 \n \n\nhp \n 146.69\n 68.56", "crumbs": [ "Get started", "Functions", @@ -171,7 +171,7 @@ "href": "man/datasummary_crosstab.html", "title": "modelsummary: Data and Model Summaries in R", "section": "", - "text": "Convenience function to tabulate counts, cell percentages, and row/column percentages for categorical variables. See the Details section for a description of the internal design. For more complex cross tabulations, use datasummary directly. See the Details and Examples sections below, and the vignettes on the modelsummary website:\n\n\nhttps://modelsummary.com/\n\n\nhttps://modelsummary.com/articles/datasummary.html\n\n\ndatasummary_crosstab(\n formula,\n statistic = 1 ~ 1 + N + Percent(\"row\"),\n data,\n output = \"default\",\n fmt = 1,\n title = NULL,\n notes = NULL,\n align = NULL,\n add_columns = NULL,\n add_rows = NULL,\n sparse_header = TRUE,\n escape = TRUE,\n ...\n)\n\n\n\n\n\nformula\n\n\nA two-sided formula to describe the table: rows ~ columns, where rows and columns are variables in the data. Rows and columns may contain interactions, e.g., var1 * var2 ~ var3.\n\n\n\n\nstatistic\n\n\nA formula of the form 1 ~ 1 + N + Percent(“row”). The left-hand side may only be empty or contain a 1 to include row totals. The right-hand side may contain: 1 for column totals, N for counts, Percent() for cell percentages, Percent(“row”) for row percentages, Percent(“col”) for column percentages.\n\n\n\n\ndata\n\n\nA data.frame (or tibble)\n\n\n\n\noutput\n\n\nfilename or object type (character string)\n\n\nSupported filename extensions: .docx, .html, .tex, .md, .txt, .csv, .xlsx, .png, .jpg\n\n\nSupported object types: \"default\", \"html\", \"markdown\", \"latex\", \"latex_tabular\", \"typst\", \"data.frame\", \"tinytable\", \"gt\", \"kableExtra\", \"huxtable\", \"flextable\", \"DT\", \"jupyter\". The \"modelsummary_list\" value produces a lightweight object which can be saved and fed back to the modelsummary function.\n\n\nThe \"default\" output format can be set to \"tinytable\", \"kableExtra\", \"gt\", \"flextable\", \"huxtable\", \"DT\", or \"markdown\"\n\n\nIf the user does not choose a default value, the packages listed above are tried in sequence.\n\n\nSession-specific configuration: options(“modelsummary_factory_default” = “gt”)\n\n\nPersistent configuration: config_modelsummary(output = “markdown”)\n\n\n\n\nWarning: Users should not supply a file name to the output argument if they intend to customize the table with external packages. See the ‘Details’ section.\n\n\nLaTeX compilation requires the booktabs and siunitx packages, but siunitx can be disabled or replaced with global options. See the ‘Details’ section.\n\n\n\n\n\n\nfmt\n\n\nhow to format numeric values: integer, user-supplied function, or modelsummary function.\n\n\nInteger: Number of decimal digits\n\n\nUser-supplied functions:\n\n\nAny function which accepts a numeric vector and returns a character vector of the same length.\n\n\n\n\nmodelsummary functions:\n\n\nfmt = fmt_significant(2): Two significant digits (at the term-level)\n\n\nfmt = fmt_sprintf(“%.3f”): See ?sprintf\n\n\nfmt = fmt_identity(): unformatted raw values\n\n\n\n\n\n\n\n\ntitle\n\n\nstring\n\n\n\n\nnotes\n\n\nlist or vector of notes to append to the bottom of the table.\n\n\n\n\nalign\n\n\nA string with a number of characters equal to the number of columns in the table (e.g., align = “lcc”). Valid characters: l, c, r, d.\n\n\n\"l\": left-aligned column\n\n\n\"c\": centered column\n\n\n\"r\": right-aligned column\n\n\n\"d\": dot-aligned column. For LaTeX/PDF output, this option requires at least version 3.0.25 of the siunitx LaTeX package. See the LaTeX preamble help section below for commands to insert in your LaTeX preamble.\n\n\n\n\n\n\nadd_columns\n\n\na data.frame (or tibble) with the same number of rows as your main table.\n\n\n\n\nadd_rows\n\n\na data.frame (or tibble) with the same number of columns as your main table. By default, rows are appended to the bottom of the table. You can define a \"position\" attribute of integers to set the row positions. See Examples section below.\n\n\n\n\nsparse_header\n\n\nTRUE or FALSE. TRUE eliminates column headers which have a unique label across all columns, except for the row immediately above the data. FALSE keeps all headers. The order in which terms are entered in the formula determines the order in which headers appear. For example, x~mean*z will print the mean-related header above the z-related header.’\n\n\n\n\nescape\n\n\nboolean TRUE escapes or substitutes LaTeX/HTML characters which could prevent the file from compiling/displaying. TRUE escapes all cells, captions, and notes. Users can have more fine-grained control by setting escape=FALSE and using an external command such as: modelsummary(model, “latex”) |> tinytable::format_tt(tab, j=1:5, escape=TRUE)\n\n\n\n\n…\n\n\nall other arguments are passed through to the table-making functions tinytable::tt, kableExtra::kbl, gt::gt, DT::datatable, etc. depending on the output argument. This allows users to pass arguments directly to datasummary in order to affect the behavior of other functions behind the scenes.\n\n\n\ndatasummary_crosstab is a wrapper around the datasummary function. This wrapper works by creating a customized formula and by feeding it to datasummary. The customized formula comes in two parts.\nFirst, we take a two-sided formula supplied by the formula argument. All variables of that formula are wrapped in a Factor() call to ensure that the variables are treated as categorical.\nSecond, the statistic argument gives a two-sided formula which specifies the statistics to include in the table. datasummary_crosstab modifies this formula automatically to include \"clean\" labels.\nFinally, the formula and statistic formulas are combined into a single formula which is fed directly to the datasummary function to produce the table.\nVariables in formula are automatically wrapped in Factor().\n\nThe behavior of modelsummary can be modified by setting global options. For example:\n\n\noptions(modelsummary_model_labels = “roman”)\n\n\nThe rest of this section describes each of the options above.\n\nThese global option changes the style of the default column headers:\n\n\noptions(modelsummary_model_labels = “roman”)\n\n\noptions(modelsummary_panel_labels = “roman”)\n\n\nThe supported styles are: \"model\", \"panel\", \"arabic\", \"letters\", \"roman\", \"(arabic)\", \"(letters)\", \"(roman)\"\nThe panel-specific option is only used when shape=“rbind”\n\nmodelsummary supports 6 table-making packages: tinytable, kableExtra, gt, flextable, huxtable, and DT. Some of these packages have overlapping functionalities. To change the default backend used for a specific file format, you can use ’ the options function:\noptions(modelsummary_factory_html = ‘kableExtra’) options(modelsummary_factory_latex = ‘gt’) options(modelsummary_factory_word = ‘huxtable’) options(modelsummary_factory_png = ‘gt’)\n\nChange the look of tables in an automated and replicable way, using the modelsummary theming functionality. See the vignette: https://modelsummary.com/articles/appearance.html\n\n\nmodelsummary_theme_gt\n\n\nmodelsummary_theme_kableExtra\n\n\nmodelsummary_theme_huxtable\n\n\nmodelsummary_theme_flextable\n\n\nmodelsummary_theme_dataframe\n\n\n\nmodelsummary can use two sets of packages to extract information from statistical models: the easystats family (performance and parameters) and broom. By default, it uses easystats first and then falls back on broom in case of failure. You can change the order of priorities or include goodness-of-fit extracted by both packages by setting:\noptions(modelsummary_get = “easystats”)\noptions(modelsummary_get = “broom”)\noptions(modelsummary_get = “all”)\n\nBy default, LaTeX tables enclose all numeric entries in the command from the siunitx package. To prevent this behavior, or to enclose numbers in dollar signs (for LaTeX math mode), users can call:\noptions(modelsummary_format_numeric_latex = “plain”)\noptions(modelsummary_format_numeric_latex = “mathmode”)\nA similar option can be used to display numerical entries using MathJax in HTML tables:\noptions(modelsummary_format_numeric_html = “mathjax”)\n\nWhen creating LaTeX via the tinytable backend (default in version 2.0.0 and later), it is useful to include the following commands in the LaTeX preamble of your documents. Note that they are added automatically when compiling Rmarkdown or Quarto documents.\n[3]{}\n\n\nlibrary(modelsummary)\n\nlibrary(modelsummary)\n\n# crosstab of two variables, showing counts, row percentages, and row/column totals\ndatasummary_crosstab(cyl ~ gear, data = mtcars)\n\n \n\n \n \n\ntinytable_lf0vwp3ves3ldpvhgfhj\n\n\n \n\ncyl\n \n 3\n 4\n 5\n All\n \n\n\n4 \n N \n 1 \n 8 \n 2 \n 11 \n \n\n \n % row\n 9.1 \n 72.7\n 18.2\n 100.0\n \n\n6 \n N \n 2 \n 4 \n 1 \n 7 \n \n\n \n % row\n 28.6\n 57.1\n 14.3\n 100.0\n \n\n8 \n N \n 12 \n 0 \n 2 \n 14 \n \n\n \n % row\n 85.7\n 0.0 \n 14.3\n 100.0\n \n\nAll\n N \n 15 \n 12 \n 5 \n 32 \n \n\n \n % row\n 46.9\n 37.5\n 15.6\n 100.0\n \n\n\n\n\n \n\n# crosstab of two variables, showing counts only and no totals\ndatasummary_crosstab(cyl ~ gear, statistic = ~ N, data = mtcars)\n\n \n\n \n \n\ntinytable_663m5e7737wydockz4f6\n\n\n \n\ncyl\n \n 3\n 4\n 5\n \n\n\n4\n N\n 1 \n 8\n 2\n \n\n6\n N\n 2 \n 4\n 1\n \n\n8\n N\n 12\n 0\n 2\n \n\n\n\n\n \n\n# crosstab of three variables\n datasummary_crosstab(am * cyl ~ gear, data = mtcars)\n\n \n\n \n \n\ntinytable_6aeigmuvtiy8r06xetaa\n\n\n \n\nam\n cyl\n \n 3\n 4\n 5\n All\n \n\n\n0\n 4 \n N \n 1 \n 2 \n 0 \n 3 \n \n\n \n \n % row\n 33.3 \n 66.7\n 0.0 \n 100.0\n \n\n \n 6 \n N \n 2 \n 2 \n 0 \n 4 \n \n\n \n \n % row\n 50.0 \n 50.0\n 0.0 \n 100.0\n \n\n \n 8 \n N \n 12 \n 0 \n 0 \n 12 \n \n\n \n \n % row\n 100.0\n 0.0 \n 0.0 \n 100.0\n \n\n1\n 4 \n N \n 0 \n 6 \n 2 \n 8 \n \n\n \n \n % row\n 0.0 \n 75.0\n 25.0 \n 100.0\n \n\n \n 6 \n N \n 0 \n 2 \n 1 \n 3 \n \n\n \n \n % row\n 0.0 \n 66.7\n 33.3 \n 100.0\n \n\n \n 8 \n N \n 0 \n 0 \n 2 \n 2 \n \n\n \n \n % row\n 0.0 \n 0.0 \n 100.0\n 100.0\n \n\n \n All\n N \n 15 \n 12 \n 5 \n 32 \n \n\n \n \n % row\n 46.9 \n 37.5\n 15.6 \n 100.0\n \n\n\n\n\n \n\n# crosstab with two variables and column percentages \ndatasummary_crosstab(am ~ gear, statistic = ~ Percent(\"col\"), data = mtcars)\n\n \n\n \n \n\ntinytable_a07ln2dlnp2nawgi6t0p\n\n\n \n\nam\n \n 3\n 4\n 5\n \n\n\n0\n % col\n 100.0\n 33.3\n 0.0 \n \n\n1\n % col\n 0.0 \n 66.7\n 100.0", + "text": "Convenience function to tabulate counts, cell percentages, and row/column percentages for categorical variables. See the Details section for a description of the internal design. For more complex cross tabulations, use datasummary directly. See the Details and Examples sections below, and the vignettes on the modelsummary website:\n\n\nhttps://modelsummary.com/\n\n\nhttps://modelsummary.com/articles/datasummary.html\n\n\ndatasummary_crosstab(\n formula,\n statistic = 1 ~ 1 + N + Percent(\"row\"),\n data,\n output = \"default\",\n fmt = 1,\n title = NULL,\n notes = NULL,\n align = NULL,\n add_columns = NULL,\n add_rows = NULL,\n sparse_header = TRUE,\n escape = TRUE,\n ...\n)\n\n\n\n\n\nformula\n\n\nA two-sided formula to describe the table: rows ~ columns, where rows and columns are variables in the data. Rows and columns may contain interactions, e.g., var1 * var2 ~ var3.\n\n\n\n\nstatistic\n\n\nA formula of the form 1 ~ 1 + N + Percent(“row”). The left-hand side may only be empty or contain a 1 to include row totals. The right-hand side may contain: 1 for column totals, N for counts, Percent() for cell percentages, Percent(“row”) for row percentages, Percent(“col”) for column percentages.\n\n\n\n\ndata\n\n\nA data.frame (or tibble)\n\n\n\n\noutput\n\n\nfilename or object type (character string)\n\n\nSupported filename extensions: .docx, .html, .tex, .md, .txt, .csv, .xlsx, .png, .jpg\n\n\nSupported object types: \"default\", \"html\", \"markdown\", \"latex\", \"latex_tabular\", \"typst\", \"data.frame\", \"tinytable\", \"gt\", \"kableExtra\", \"huxtable\", \"flextable\", \"DT\", \"jupyter\". The \"modelsummary_list\" value produces a lightweight object which can be saved and fed back to the modelsummary function.\n\n\nThe \"default\" output format can be set to \"tinytable\", \"kableExtra\", \"gt\", \"flextable\", \"huxtable\", \"DT\", or \"markdown\"\n\n\nIf the user does not choose a default value, the packages listed above are tried in sequence.\n\n\nSession-specific configuration: options(“modelsummary_factory_default” = “gt”)\n\n\nPersistent configuration: config_modelsummary(output = “markdown”)\n\n\n\n\nWarning: Users should not supply a file name to the output argument if they intend to customize the table with external packages. See the ‘Details’ section.\n\n\nLaTeX compilation requires the booktabs and siunitx packages, but siunitx can be disabled or replaced with global options. See the ‘Details’ section.\n\n\n\n\n\n\nfmt\n\n\nhow to format numeric values: integer, user-supplied function, or modelsummary function.\n\n\nInteger: Number of decimal digits\n\n\nUser-supplied functions:\n\n\nAny function which accepts a numeric vector and returns a character vector of the same length.\n\n\n\n\nmodelsummary functions:\n\n\nfmt = fmt_significant(2): Two significant digits (at the term-level)\n\n\nfmt = fmt_sprintf(“%.3f”): See ?sprintf\n\n\nfmt = fmt_identity(): unformatted raw values\n\n\n\n\n\n\n\n\ntitle\n\n\nstring\n\n\n\n\nnotes\n\n\nlist or vector of notes to append to the bottom of the table.\n\n\n\n\nalign\n\n\nA string with a number of characters equal to the number of columns in the table (e.g., align = “lcc”). Valid characters: l, c, r, d.\n\n\n\"l\": left-aligned column\n\n\n\"c\": centered column\n\n\n\"r\": right-aligned column\n\n\n\"d\": dot-aligned column. For LaTeX/PDF output, this option requires at least version 3.0.25 of the siunitx LaTeX package. See the LaTeX preamble help section below for commands to insert in your LaTeX preamble.\n\n\n\n\n\n\nadd_columns\n\n\na data.frame (or tibble) with the same number of rows as your main table.\n\n\n\n\nadd_rows\n\n\na data.frame (or tibble) with the same number of columns as your main table. By default, rows are appended to the bottom of the table. You can define a \"position\" attribute of integers to set the row positions. See Examples section below.\n\n\n\n\nsparse_header\n\n\nTRUE or FALSE. TRUE eliminates column headers which have a unique label across all columns, except for the row immediately above the data. FALSE keeps all headers. The order in which terms are entered in the formula determines the order in which headers appear. For example, x~mean*z will print the mean-related header above the z-related header.’\n\n\n\n\nescape\n\n\nboolean TRUE escapes or substitutes LaTeX/HTML characters which could prevent the file from compiling/displaying. TRUE escapes all cells, captions, and notes. Users can have more fine-grained control by setting escape=FALSE and using an external command such as: modelsummary(model, “latex”) |> tinytable::format_tt(tab, j=1:5, escape=TRUE)\n\n\n\n\n…\n\n\nall other arguments are passed through to the table-making functions tinytable::tt, kableExtra::kbl, gt::gt, DT::datatable, etc. depending on the output argument. This allows users to pass arguments directly to datasummary in order to affect the behavior of other functions behind the scenes.\n\n\n\ndatasummary_crosstab is a wrapper around the datasummary function. This wrapper works by creating a customized formula and by feeding it to datasummary. The customized formula comes in two parts.\nFirst, we take a two-sided formula supplied by the formula argument. All variables of that formula are wrapped in a Factor() call to ensure that the variables are treated as categorical.\nSecond, the statistic argument gives a two-sided formula which specifies the statistics to include in the table. datasummary_crosstab modifies this formula automatically to include \"clean\" labels.\nFinally, the formula and statistic formulas are combined into a single formula which is fed directly to the datasummary function to produce the table.\nVariables in formula are automatically wrapped in Factor().\n\nThe behavior of modelsummary can be modified by setting global options. For example:\n\n\noptions(modelsummary_model_labels = “roman”)\n\n\nThe rest of this section describes each of the options above.\n\nThese global option changes the style of the default column headers:\n\n\noptions(modelsummary_model_labels = “roman”)\n\n\noptions(modelsummary_panel_labels = “roman”)\n\n\nThe supported styles are: \"model\", \"panel\", \"arabic\", \"letters\", \"roman\", \"(arabic)\", \"(letters)\", \"(roman)\"\nThe panel-specific option is only used when shape=“rbind”\n\nmodelsummary supports 6 table-making packages: tinytable, kableExtra, gt, flextable, huxtable, and DT. Some of these packages have overlapping functionalities. To change the default backend used for a specific file format, you can use ’ the options function:\noptions(modelsummary_factory_html = ‘kableExtra’) options(modelsummary_factory_latex = ‘gt’) options(modelsummary_factory_word = ‘huxtable’) options(modelsummary_factory_png = ‘gt’)\n\nChange the look of tables in an automated and replicable way, using the modelsummary theming functionality. See the vignette: https://modelsummary.com/articles/appearance.html\n\n\nmodelsummary_theme_gt\n\n\nmodelsummary_theme_kableExtra\n\n\nmodelsummary_theme_huxtable\n\n\nmodelsummary_theme_flextable\n\n\nmodelsummary_theme_dataframe\n\n\n\nmodelsummary can use two sets of packages to extract information from statistical models: the easystats family (performance and parameters) and broom. By default, it uses easystats first and then falls back on broom in case of failure. You can change the order of priorities or include goodness-of-fit extracted by both packages by setting:\noptions(modelsummary_get = “easystats”)\noptions(modelsummary_get = “broom”)\noptions(modelsummary_get = “all”)\n\nBy default, LaTeX tables enclose all numeric entries in the command from the siunitx package. To prevent this behavior, or to enclose numbers in dollar signs (for LaTeX math mode), users can call:\noptions(modelsummary_format_numeric_latex = “plain”)\noptions(modelsummary_format_numeric_latex = “mathmode”)\nA similar option can be used to display numerical entries using MathJax in HTML tables:\noptions(modelsummary_format_numeric_html = “mathjax”)\n\nWhen creating LaTeX via the tinytable backend (default in version 2.0.0 and later), it is useful to include the following commands in the LaTeX preamble of your documents. Note that they are added automatically when compiling Rmarkdown or Quarto documents.\n[3]{}\n\n\nlibrary(modelsummary)\n\nlibrary(modelsummary)\n\n# crosstab of two variables, showing counts, row percentages, and row/column totals\ndatasummary_crosstab(cyl ~ gear, data = mtcars)\n\n \n\n \n \n\ntinytable_byny0s6ew83pn9r1jmnp\n\n\n \n\ncyl\n \n 3\n 4\n 5\n All\n \n\n\n4 \n N \n 1 \n 8 \n 2 \n 11 \n \n\n \n % row\n 9.1 \n 72.7\n 18.2\n 100.0\n \n\n6 \n N \n 2 \n 4 \n 1 \n 7 \n \n\n \n % row\n 28.6\n 57.1\n 14.3\n 100.0\n \n\n8 \n N \n 12 \n 0 \n 2 \n 14 \n \n\n \n % row\n 85.7\n 0.0 \n 14.3\n 100.0\n \n\nAll\n N \n 15 \n 12 \n 5 \n 32 \n \n\n \n % row\n 46.9\n 37.5\n 15.6\n 100.0\n \n\n\n\n\n \n\n# crosstab of two variables, showing counts only and no totals\ndatasummary_crosstab(cyl ~ gear, statistic = ~ N, data = mtcars)\n\n \n\n \n \n\ntinytable_9y0mx65dvv7t2lrbz8pl\n\n\n \n\ncyl\n \n 3\n 4\n 5\n \n\n\n4\n N\n 1 \n 8\n 2\n \n\n6\n N\n 2 \n 4\n 1\n \n\n8\n N\n 12\n 0\n 2\n \n\n\n\n\n \n\n# crosstab of three variables\n datasummary_crosstab(am * cyl ~ gear, data = mtcars)\n\n \n\n \n \n\ntinytable_h7nqis884hosurzbrir4\n\n\n \n\nam\n cyl\n \n 3\n 4\n 5\n All\n \n\n\n0\n 4 \n N \n 1 \n 2 \n 0 \n 3 \n \n\n \n \n % row\n 33.3 \n 66.7\n 0.0 \n 100.0\n \n\n \n 6 \n N \n 2 \n 2 \n 0 \n 4 \n \n\n \n \n % row\n 50.0 \n 50.0\n 0.0 \n 100.0\n \n\n \n 8 \n N \n 12 \n 0 \n 0 \n 12 \n \n\n \n \n % row\n 100.0\n 0.0 \n 0.0 \n 100.0\n \n\n1\n 4 \n N \n 0 \n 6 \n 2 \n 8 \n \n\n \n \n % row\n 0.0 \n 75.0\n 25.0 \n 100.0\n \n\n \n 6 \n N \n 0 \n 2 \n 1 \n 3 \n \n\n \n \n % row\n 0.0 \n 66.7\n 33.3 \n 100.0\n \n\n \n 8 \n N \n 0 \n 0 \n 2 \n 2 \n \n\n \n \n % row\n 0.0 \n 0.0 \n 100.0\n 100.0\n \n\n \n All\n N \n 15 \n 12 \n 5 \n 32 \n \n\n \n \n % row\n 46.9 \n 37.5\n 15.6 \n 100.0\n \n\n\n\n\n \n\n# crosstab with two variables and column percentages \ndatasummary_crosstab(am ~ gear, statistic = ~ Percent(\"col\"), data = mtcars)\n\n \n\n \n \n\ntinytable_th6htlsfxr7lsk6i4if1\n\n\n \n\nam\n \n 3\n 4\n 5\n \n\n\n0\n % col\n 100.0\n 33.3\n 0.0 \n \n\n1\n % col\n 0.0 \n 66.7\n 100.0", "crumbs": [ "Get started", "Functions", @@ -183,7 +183,7 @@ "href": "man/datasummary_crosstab.html#cross-tabulations-for-categorical-variables", "title": "modelsummary: Data and Model Summaries in R", "section": "", - "text": "Convenience function to tabulate counts, cell percentages, and row/column percentages for categorical variables. See the Details section for a description of the internal design. For more complex cross tabulations, use datasummary directly. See the Details and Examples sections below, and the vignettes on the modelsummary website:\n\n\nhttps://modelsummary.com/\n\n\nhttps://modelsummary.com/articles/datasummary.html\n\n\ndatasummary_crosstab(\n formula,\n statistic = 1 ~ 1 + N + Percent(\"row\"),\n data,\n output = \"default\",\n fmt = 1,\n title = NULL,\n notes = NULL,\n align = NULL,\n add_columns = NULL,\n add_rows = NULL,\n sparse_header = TRUE,\n escape = TRUE,\n ...\n)\n\n\n\n\n\nformula\n\n\nA two-sided formula to describe the table: rows ~ columns, where rows and columns are variables in the data. Rows and columns may contain interactions, e.g., var1 * var2 ~ var3.\n\n\n\n\nstatistic\n\n\nA formula of the form 1 ~ 1 + N + Percent(“row”). The left-hand side may only be empty or contain a 1 to include row totals. The right-hand side may contain: 1 for column totals, N for counts, Percent() for cell percentages, Percent(“row”) for row percentages, Percent(“col”) for column percentages.\n\n\n\n\ndata\n\n\nA data.frame (or tibble)\n\n\n\n\noutput\n\n\nfilename or object type (character string)\n\n\nSupported filename extensions: .docx, .html, .tex, .md, .txt, .csv, .xlsx, .png, .jpg\n\n\nSupported object types: \"default\", \"html\", \"markdown\", \"latex\", \"latex_tabular\", \"typst\", \"data.frame\", \"tinytable\", \"gt\", \"kableExtra\", \"huxtable\", \"flextable\", \"DT\", \"jupyter\". The \"modelsummary_list\" value produces a lightweight object which can be saved and fed back to the modelsummary function.\n\n\nThe \"default\" output format can be set to \"tinytable\", \"kableExtra\", \"gt\", \"flextable\", \"huxtable\", \"DT\", or \"markdown\"\n\n\nIf the user does not choose a default value, the packages listed above are tried in sequence.\n\n\nSession-specific configuration: options(“modelsummary_factory_default” = “gt”)\n\n\nPersistent configuration: config_modelsummary(output = “markdown”)\n\n\n\n\nWarning: Users should not supply a file name to the output argument if they intend to customize the table with external packages. See the ‘Details’ section.\n\n\nLaTeX compilation requires the booktabs and siunitx packages, but siunitx can be disabled or replaced with global options. See the ‘Details’ section.\n\n\n\n\n\n\nfmt\n\n\nhow to format numeric values: integer, user-supplied function, or modelsummary function.\n\n\nInteger: Number of decimal digits\n\n\nUser-supplied functions:\n\n\nAny function which accepts a numeric vector and returns a character vector of the same length.\n\n\n\n\nmodelsummary functions:\n\n\nfmt = fmt_significant(2): Two significant digits (at the term-level)\n\n\nfmt = fmt_sprintf(“%.3f”): See ?sprintf\n\n\nfmt = fmt_identity(): unformatted raw values\n\n\n\n\n\n\n\n\ntitle\n\n\nstring\n\n\n\n\nnotes\n\n\nlist or vector of notes to append to the bottom of the table.\n\n\n\n\nalign\n\n\nA string with a number of characters equal to the number of columns in the table (e.g., align = “lcc”). Valid characters: l, c, r, d.\n\n\n\"l\": left-aligned column\n\n\n\"c\": centered column\n\n\n\"r\": right-aligned column\n\n\n\"d\": dot-aligned column. For LaTeX/PDF output, this option requires at least version 3.0.25 of the siunitx LaTeX package. See the LaTeX preamble help section below for commands to insert in your LaTeX preamble.\n\n\n\n\n\n\nadd_columns\n\n\na data.frame (or tibble) with the same number of rows as your main table.\n\n\n\n\nadd_rows\n\n\na data.frame (or tibble) with the same number of columns as your main table. By default, rows are appended to the bottom of the table. You can define a \"position\" attribute of integers to set the row positions. See Examples section below.\n\n\n\n\nsparse_header\n\n\nTRUE or FALSE. TRUE eliminates column headers which have a unique label across all columns, except for the row immediately above the data. FALSE keeps all headers. The order in which terms are entered in the formula determines the order in which headers appear. For example, x~mean*z will print the mean-related header above the z-related header.’\n\n\n\n\nescape\n\n\nboolean TRUE escapes or substitutes LaTeX/HTML characters which could prevent the file from compiling/displaying. TRUE escapes all cells, captions, and notes. Users can have more fine-grained control by setting escape=FALSE and using an external command such as: modelsummary(model, “latex”) |> tinytable::format_tt(tab, j=1:5, escape=TRUE)\n\n\n\n\n…\n\n\nall other arguments are passed through to the table-making functions tinytable::tt, kableExtra::kbl, gt::gt, DT::datatable, etc. depending on the output argument. This allows users to pass arguments directly to datasummary in order to affect the behavior of other functions behind the scenes.\n\n\n\ndatasummary_crosstab is a wrapper around the datasummary function. This wrapper works by creating a customized formula and by feeding it to datasummary. The customized formula comes in two parts.\nFirst, we take a two-sided formula supplied by the formula argument. All variables of that formula are wrapped in a Factor() call to ensure that the variables are treated as categorical.\nSecond, the statistic argument gives a two-sided formula which specifies the statistics to include in the table. datasummary_crosstab modifies this formula automatically to include \"clean\" labels.\nFinally, the formula and statistic formulas are combined into a single formula which is fed directly to the datasummary function to produce the table.\nVariables in formula are automatically wrapped in Factor().\n\nThe behavior of modelsummary can be modified by setting global options. For example:\n\n\noptions(modelsummary_model_labels = “roman”)\n\n\nThe rest of this section describes each of the options above.\n\nThese global option changes the style of the default column headers:\n\n\noptions(modelsummary_model_labels = “roman”)\n\n\noptions(modelsummary_panel_labels = “roman”)\n\n\nThe supported styles are: \"model\", \"panel\", \"arabic\", \"letters\", \"roman\", \"(arabic)\", \"(letters)\", \"(roman)\"\nThe panel-specific option is only used when shape=“rbind”\n\nmodelsummary supports 6 table-making packages: tinytable, kableExtra, gt, flextable, huxtable, and DT. Some of these packages have overlapping functionalities. To change the default backend used for a specific file format, you can use ’ the options function:\noptions(modelsummary_factory_html = ‘kableExtra’) options(modelsummary_factory_latex = ‘gt’) options(modelsummary_factory_word = ‘huxtable’) options(modelsummary_factory_png = ‘gt’)\n\nChange the look of tables in an automated and replicable way, using the modelsummary theming functionality. See the vignette: https://modelsummary.com/articles/appearance.html\n\n\nmodelsummary_theme_gt\n\n\nmodelsummary_theme_kableExtra\n\n\nmodelsummary_theme_huxtable\n\n\nmodelsummary_theme_flextable\n\n\nmodelsummary_theme_dataframe\n\n\n\nmodelsummary can use two sets of packages to extract information from statistical models: the easystats family (performance and parameters) and broom. By default, it uses easystats first and then falls back on broom in case of failure. You can change the order of priorities or include goodness-of-fit extracted by both packages by setting:\noptions(modelsummary_get = “easystats”)\noptions(modelsummary_get = “broom”)\noptions(modelsummary_get = “all”)\n\nBy default, LaTeX tables enclose all numeric entries in the command from the siunitx package. To prevent this behavior, or to enclose numbers in dollar signs (for LaTeX math mode), users can call:\noptions(modelsummary_format_numeric_latex = “plain”)\noptions(modelsummary_format_numeric_latex = “mathmode”)\nA similar option can be used to display numerical entries using MathJax in HTML tables:\noptions(modelsummary_format_numeric_html = “mathjax”)\n\nWhen creating LaTeX via the tinytable backend (default in version 2.0.0 and later), it is useful to include the following commands in the LaTeX preamble of your documents. Note that they are added automatically when compiling Rmarkdown or Quarto documents.\n[3]{}\n\n\nlibrary(modelsummary)\n\nlibrary(modelsummary)\n\n# crosstab of two variables, showing counts, row percentages, and row/column totals\ndatasummary_crosstab(cyl ~ gear, data = mtcars)\n\n \n\n \n \n\ntinytable_lf0vwp3ves3ldpvhgfhj\n\n\n \n\ncyl\n \n 3\n 4\n 5\n All\n \n\n\n4 \n N \n 1 \n 8 \n 2 \n 11 \n \n\n \n % row\n 9.1 \n 72.7\n 18.2\n 100.0\n \n\n6 \n N \n 2 \n 4 \n 1 \n 7 \n \n\n \n % row\n 28.6\n 57.1\n 14.3\n 100.0\n \n\n8 \n N \n 12 \n 0 \n 2 \n 14 \n \n\n \n % row\n 85.7\n 0.0 \n 14.3\n 100.0\n \n\nAll\n N \n 15 \n 12 \n 5 \n 32 \n \n\n \n % row\n 46.9\n 37.5\n 15.6\n 100.0\n \n\n\n\n\n \n\n# crosstab of two variables, showing counts only and no totals\ndatasummary_crosstab(cyl ~ gear, statistic = ~ N, data = mtcars)\n\n \n\n \n \n\ntinytable_663m5e7737wydockz4f6\n\n\n \n\ncyl\n \n 3\n 4\n 5\n \n\n\n4\n N\n 1 \n 8\n 2\n \n\n6\n N\n 2 \n 4\n 1\n \n\n8\n N\n 12\n 0\n 2\n \n\n\n\n\n \n\n# crosstab of three variables\n datasummary_crosstab(am * cyl ~ gear, data = mtcars)\n\n \n\n \n \n\ntinytable_6aeigmuvtiy8r06xetaa\n\n\n \n\nam\n cyl\n \n 3\n 4\n 5\n All\n \n\n\n0\n 4 \n N \n 1 \n 2 \n 0 \n 3 \n \n\n \n \n % row\n 33.3 \n 66.7\n 0.0 \n 100.0\n \n\n \n 6 \n N \n 2 \n 2 \n 0 \n 4 \n \n\n \n \n % row\n 50.0 \n 50.0\n 0.0 \n 100.0\n \n\n \n 8 \n N \n 12 \n 0 \n 0 \n 12 \n \n\n \n \n % row\n 100.0\n 0.0 \n 0.0 \n 100.0\n \n\n1\n 4 \n N \n 0 \n 6 \n 2 \n 8 \n \n\n \n \n % row\n 0.0 \n 75.0\n 25.0 \n 100.0\n \n\n \n 6 \n N \n 0 \n 2 \n 1 \n 3 \n \n\n \n \n % row\n 0.0 \n 66.7\n 33.3 \n 100.0\n \n\n \n 8 \n N \n 0 \n 0 \n 2 \n 2 \n \n\n \n \n % row\n 0.0 \n 0.0 \n 100.0\n 100.0\n \n\n \n All\n N \n 15 \n 12 \n 5 \n 32 \n \n\n \n \n % row\n 46.9 \n 37.5\n 15.6 \n 100.0\n \n\n\n\n\n \n\n# crosstab with two variables and column percentages \ndatasummary_crosstab(am ~ gear, statistic = ~ Percent(\"col\"), data = mtcars)\n\n \n\n \n \n\ntinytable_a07ln2dlnp2nawgi6t0p\n\n\n \n\nam\n \n 3\n 4\n 5\n \n\n\n0\n % col\n 100.0\n 33.3\n 0.0 \n \n\n1\n % col\n 0.0 \n 66.7\n 100.0", + "text": "Convenience function to tabulate counts, cell percentages, and row/column percentages for categorical variables. See the Details section for a description of the internal design. For more complex cross tabulations, use datasummary directly. See the Details and Examples sections below, and the vignettes on the modelsummary website:\n\n\nhttps://modelsummary.com/\n\n\nhttps://modelsummary.com/articles/datasummary.html\n\n\ndatasummary_crosstab(\n formula,\n statistic = 1 ~ 1 + N + Percent(\"row\"),\n data,\n output = \"default\",\n fmt = 1,\n title = NULL,\n notes = NULL,\n align = NULL,\n add_columns = NULL,\n add_rows = NULL,\n sparse_header = TRUE,\n escape = TRUE,\n ...\n)\n\n\n\n\n\nformula\n\n\nA two-sided formula to describe the table: rows ~ columns, where rows and columns are variables in the data. Rows and columns may contain interactions, e.g., var1 * var2 ~ var3.\n\n\n\n\nstatistic\n\n\nA formula of the form 1 ~ 1 + N + Percent(“row”). The left-hand side may only be empty or contain a 1 to include row totals. The right-hand side may contain: 1 for column totals, N for counts, Percent() for cell percentages, Percent(“row”) for row percentages, Percent(“col”) for column percentages.\n\n\n\n\ndata\n\n\nA data.frame (or tibble)\n\n\n\n\noutput\n\n\nfilename or object type (character string)\n\n\nSupported filename extensions: .docx, .html, .tex, .md, .txt, .csv, .xlsx, .png, .jpg\n\n\nSupported object types: \"default\", \"html\", \"markdown\", \"latex\", \"latex_tabular\", \"typst\", \"data.frame\", \"tinytable\", \"gt\", \"kableExtra\", \"huxtable\", \"flextable\", \"DT\", \"jupyter\". The \"modelsummary_list\" value produces a lightweight object which can be saved and fed back to the modelsummary function.\n\n\nThe \"default\" output format can be set to \"tinytable\", \"kableExtra\", \"gt\", \"flextable\", \"huxtable\", \"DT\", or \"markdown\"\n\n\nIf the user does not choose a default value, the packages listed above are tried in sequence.\n\n\nSession-specific configuration: options(“modelsummary_factory_default” = “gt”)\n\n\nPersistent configuration: config_modelsummary(output = “markdown”)\n\n\n\n\nWarning: Users should not supply a file name to the output argument if they intend to customize the table with external packages. See the ‘Details’ section.\n\n\nLaTeX compilation requires the booktabs and siunitx packages, but siunitx can be disabled or replaced with global options. See the ‘Details’ section.\n\n\n\n\n\n\nfmt\n\n\nhow to format numeric values: integer, user-supplied function, or modelsummary function.\n\n\nInteger: Number of decimal digits\n\n\nUser-supplied functions:\n\n\nAny function which accepts a numeric vector and returns a character vector of the same length.\n\n\n\n\nmodelsummary functions:\n\n\nfmt = fmt_significant(2): Two significant digits (at the term-level)\n\n\nfmt = fmt_sprintf(“%.3f”): See ?sprintf\n\n\nfmt = fmt_identity(): unformatted raw values\n\n\n\n\n\n\n\n\ntitle\n\n\nstring\n\n\n\n\nnotes\n\n\nlist or vector of notes to append to the bottom of the table.\n\n\n\n\nalign\n\n\nA string with a number of characters equal to the number of columns in the table (e.g., align = “lcc”). Valid characters: l, c, r, d.\n\n\n\"l\": left-aligned column\n\n\n\"c\": centered column\n\n\n\"r\": right-aligned column\n\n\n\"d\": dot-aligned column. For LaTeX/PDF output, this option requires at least version 3.0.25 of the siunitx LaTeX package. See the LaTeX preamble help section below for commands to insert in your LaTeX preamble.\n\n\n\n\n\n\nadd_columns\n\n\na data.frame (or tibble) with the same number of rows as your main table.\n\n\n\n\nadd_rows\n\n\na data.frame (or tibble) with the same number of columns as your main table. By default, rows are appended to the bottom of the table. You can define a \"position\" attribute of integers to set the row positions. See Examples section below.\n\n\n\n\nsparse_header\n\n\nTRUE or FALSE. TRUE eliminates column headers which have a unique label across all columns, except for the row immediately above the data. FALSE keeps all headers. The order in which terms are entered in the formula determines the order in which headers appear. For example, x~mean*z will print the mean-related header above the z-related header.’\n\n\n\n\nescape\n\n\nboolean TRUE escapes or substitutes LaTeX/HTML characters which could prevent the file from compiling/displaying. TRUE escapes all cells, captions, and notes. Users can have more fine-grained control by setting escape=FALSE and using an external command such as: modelsummary(model, “latex”) |> tinytable::format_tt(tab, j=1:5, escape=TRUE)\n\n\n\n\n…\n\n\nall other arguments are passed through to the table-making functions tinytable::tt, kableExtra::kbl, gt::gt, DT::datatable, etc. depending on the output argument. This allows users to pass arguments directly to datasummary in order to affect the behavior of other functions behind the scenes.\n\n\n\ndatasummary_crosstab is a wrapper around the datasummary function. This wrapper works by creating a customized formula and by feeding it to datasummary. The customized formula comes in two parts.\nFirst, we take a two-sided formula supplied by the formula argument. All variables of that formula are wrapped in a Factor() call to ensure that the variables are treated as categorical.\nSecond, the statistic argument gives a two-sided formula which specifies the statistics to include in the table. datasummary_crosstab modifies this formula automatically to include \"clean\" labels.\nFinally, the formula and statistic formulas are combined into a single formula which is fed directly to the datasummary function to produce the table.\nVariables in formula are automatically wrapped in Factor().\n\nThe behavior of modelsummary can be modified by setting global options. For example:\n\n\noptions(modelsummary_model_labels = “roman”)\n\n\nThe rest of this section describes each of the options above.\n\nThese global option changes the style of the default column headers:\n\n\noptions(modelsummary_model_labels = “roman”)\n\n\noptions(modelsummary_panel_labels = “roman”)\n\n\nThe supported styles are: \"model\", \"panel\", \"arabic\", \"letters\", \"roman\", \"(arabic)\", \"(letters)\", \"(roman)\"\nThe panel-specific option is only used when shape=“rbind”\n\nmodelsummary supports 6 table-making packages: tinytable, kableExtra, gt, flextable, huxtable, and DT. Some of these packages have overlapping functionalities. To change the default backend used for a specific file format, you can use ’ the options function:\noptions(modelsummary_factory_html = ‘kableExtra’) options(modelsummary_factory_latex = ‘gt’) options(modelsummary_factory_word = ‘huxtable’) options(modelsummary_factory_png = ‘gt’)\n\nChange the look of tables in an automated and replicable way, using the modelsummary theming functionality. See the vignette: https://modelsummary.com/articles/appearance.html\n\n\nmodelsummary_theme_gt\n\n\nmodelsummary_theme_kableExtra\n\n\nmodelsummary_theme_huxtable\n\n\nmodelsummary_theme_flextable\n\n\nmodelsummary_theme_dataframe\n\n\n\nmodelsummary can use two sets of packages to extract information from statistical models: the easystats family (performance and parameters) and broom. By default, it uses easystats first and then falls back on broom in case of failure. You can change the order of priorities or include goodness-of-fit extracted by both packages by setting:\noptions(modelsummary_get = “easystats”)\noptions(modelsummary_get = “broom”)\noptions(modelsummary_get = “all”)\n\nBy default, LaTeX tables enclose all numeric entries in the command from the siunitx package. To prevent this behavior, or to enclose numbers in dollar signs (for LaTeX math mode), users can call:\noptions(modelsummary_format_numeric_latex = “plain”)\noptions(modelsummary_format_numeric_latex = “mathmode”)\nA similar option can be used to display numerical entries using MathJax in HTML tables:\noptions(modelsummary_format_numeric_html = “mathjax”)\n\nWhen creating LaTeX via the tinytable backend (default in version 2.0.0 and later), it is useful to include the following commands in the LaTeX preamble of your documents. Note that they are added automatically when compiling Rmarkdown or Quarto documents.\n[3]{}\n\n\nlibrary(modelsummary)\n\nlibrary(modelsummary)\n\n# crosstab of two variables, showing counts, row percentages, and row/column totals\ndatasummary_crosstab(cyl ~ gear, data = mtcars)\n\n \n\n \n \n\ntinytable_byny0s6ew83pn9r1jmnp\n\n\n \n\ncyl\n \n 3\n 4\n 5\n All\n \n\n\n4 \n N \n 1 \n 8 \n 2 \n 11 \n \n\n \n % row\n 9.1 \n 72.7\n 18.2\n 100.0\n \n\n6 \n N \n 2 \n 4 \n 1 \n 7 \n \n\n \n % row\n 28.6\n 57.1\n 14.3\n 100.0\n \n\n8 \n N \n 12 \n 0 \n 2 \n 14 \n \n\n \n % row\n 85.7\n 0.0 \n 14.3\n 100.0\n \n\nAll\n N \n 15 \n 12 \n 5 \n 32 \n \n\n \n % row\n 46.9\n 37.5\n 15.6\n 100.0\n \n\n\n\n\n \n\n# crosstab of two variables, showing counts only and no totals\ndatasummary_crosstab(cyl ~ gear, statistic = ~ N, data = mtcars)\n\n \n\n \n \n\ntinytable_9y0mx65dvv7t2lrbz8pl\n\n\n \n\ncyl\n \n 3\n 4\n 5\n \n\n\n4\n N\n 1 \n 8\n 2\n \n\n6\n N\n 2 \n 4\n 1\n \n\n8\n N\n 12\n 0\n 2\n \n\n\n\n\n \n\n# crosstab of three variables\n datasummary_crosstab(am * cyl ~ gear, data = mtcars)\n\n \n\n \n \n\ntinytable_h7nqis884hosurzbrir4\n\n\n \n\nam\n cyl\n \n 3\n 4\n 5\n All\n \n\n\n0\n 4 \n N \n 1 \n 2 \n 0 \n 3 \n \n\n \n \n % row\n 33.3 \n 66.7\n 0.0 \n 100.0\n \n\n \n 6 \n N \n 2 \n 2 \n 0 \n 4 \n \n\n \n \n % row\n 50.0 \n 50.0\n 0.0 \n 100.0\n \n\n \n 8 \n N \n 12 \n 0 \n 0 \n 12 \n \n\n \n \n % row\n 100.0\n 0.0 \n 0.0 \n 100.0\n \n\n1\n 4 \n N \n 0 \n 6 \n 2 \n 8 \n \n\n \n \n % row\n 0.0 \n 75.0\n 25.0 \n 100.0\n \n\n \n 6 \n N \n 0 \n 2 \n 1 \n 3 \n \n\n \n \n % row\n 0.0 \n 66.7\n 33.3 \n 100.0\n \n\n \n 8 \n N \n 0 \n 0 \n 2 \n 2 \n \n\n \n \n % row\n 0.0 \n 0.0 \n 100.0\n 100.0\n \n\n \n All\n N \n 15 \n 12 \n 5 \n 32 \n \n\n \n \n % row\n 46.9 \n 37.5\n 15.6 \n 100.0\n \n\n\n\n\n \n\n# crosstab with two variables and column percentages \ndatasummary_crosstab(am ~ gear, statistic = ~ Percent(\"col\"), data = mtcars)\n\n \n\n \n \n\ntinytable_th6htlsfxr7lsk6i4if1\n\n\n \n\nam\n \n 3\n 4\n 5\n \n\n\n0\n % col\n 100.0\n 33.3\n 0.0 \n \n\n1\n % col\n 0.0 \n 66.7\n 100.0", "crumbs": [ "Get started", "Functions", @@ -273,7 +273,7 @@ "href": "man/dvnames.html", "title": "modelsummary: Data and Model Summaries in R", "section": "", - "text": "A convenience function for use with a regression model or list of regression models. Returns a named list of models, where the names are the models’ respective dependent variables. Pass your list of models to dvnames before sending to modelsummary to automatically get dependent variable-titled columns.\n\ndvnames(models, number = FALSE, strip = FALSE, fill = \"Model\")\n\n\n\n\n\nmodels\n\n\nA regression model or list of regression models\n\n\n\n\nnumber\n\n\nShould the models be numbered (1), (2), etc., in addition to their dependent variable names?\n\n\n\n\nstrip\n\n\nboolean FALSE returns the dependent variable names as they appear in the model. TRUE returns the dependent variable names as they appear in the data, without transformations.\n\n\n\n\nfill\n\n\nIf insight::find_response() cannot find a response, the column title to use in its place. Set to ’ ’ to leave blank.\n\n\n\n\nlibrary(modelsummary)\n\n\nm1 <- lm(mpg ~ hp, data = mtcars)\nm2 <- lm(mpg ~ hp + wt, data = mtcars)\n\n# Without dvnames, column names are (1) and (2)\nmodelsummary(list(m1, m2))\n\n \n\n \n \n\ntinytable_u2hh31udbdeemx98iz83\n\n\n \n\n \n (1)\n (2)\n \n\n\n(Intercept)\n 30.099 \n 37.227 \n \n\n \n (1.634)\n (1.599)\n \n\nhp \n -0.068 \n -0.032 \n \n\n \n (0.010)\n (0.009)\n \n\nwt \n \n -3.878 \n \n\n \n \n (0.633)\n \n\nNum.Obs. \n 32 \n 32 \n \n\nR2 \n 0.602 \n 0.827 \n \n\nR2 Adj. \n 0.589 \n 0.815 \n \n\nAIC \n 181.2 \n 156.7 \n \n\nBIC \n 185.6 \n 162.5 \n \n\nLog.Lik. \n -87.619\n -74.326\n \n\nF \n 45.460 \n 69.211 \n \n\nRMSE \n 3.74 \n 2.47 \n \n\n\n\n\n \n\n# With dvnames, they are \"mpg\" and \"mpg\"\nmodelsummary(dvnames(list(m1,m2)))\n\n \n\n \n \n\ntinytable_f852o222qpbpp0nismmp\n\n\n \n\n \n mpg\n mpg \n \n\n\n(Intercept)\n 30.099 \n 37.227 \n \n\n \n (1.634)\n (1.599)\n \n\nhp \n -0.068 \n -0.032 \n \n\n \n (0.010)\n (0.009)\n \n\nwt \n \n -3.878 \n \n\n \n \n (0.633)\n \n\nNum.Obs. \n 32 \n 32 \n \n\nR2 \n 0.602 \n 0.827 \n \n\nR2 Adj. \n 0.589 \n 0.815 \n \n\nAIC \n 181.2 \n 156.7 \n \n\nBIC \n 185.6 \n 162.5 \n \n\nLog.Lik. \n -87.619\n -74.326\n \n\nF \n 45.460 \n 69.211 \n \n\nRMSE \n 3.74 \n 2.47", + "text": "A convenience function for use with a regression model or list of regression models. Returns a named list of models, where the names are the models’ respective dependent variables. Pass your list of models to dvnames before sending to modelsummary to automatically get dependent variable-titled columns.\n\ndvnames(models, number = FALSE, strip = FALSE, fill = \"Model\")\n\n\n\n\n\nmodels\n\n\nA regression model or list of regression models\n\n\n\n\nnumber\n\n\nShould the models be numbered (1), (2), etc., in addition to their dependent variable names?\n\n\n\n\nstrip\n\n\nboolean FALSE returns the dependent variable names as they appear in the model. TRUE returns the dependent variable names as they appear in the data, without transformations.\n\n\n\n\nfill\n\n\nIf insight::find_response() cannot find a response, the column title to use in its place. Set to ’ ’ to leave blank.\n\n\n\n\nlibrary(modelsummary)\n\n\nm1 <- lm(mpg ~ hp, data = mtcars)\nm2 <- lm(mpg ~ hp + wt, data = mtcars)\n\n# Without dvnames, column names are (1) and (2)\nmodelsummary(list(m1, m2))\n\n \n\n \n \n\ntinytable_772j9f8vorr2x1vfz6mc\n\n\n \n\n \n (1)\n (2)\n \n\n\n(Intercept)\n 30.099 \n 37.227 \n \n\n \n (1.634)\n (1.599)\n \n\nhp \n -0.068 \n -0.032 \n \n\n \n (0.010)\n (0.009)\n \n\nwt \n \n -3.878 \n \n\n \n \n (0.633)\n \n\nNum.Obs. \n 32 \n 32 \n \n\nR2 \n 0.602 \n 0.827 \n \n\nR2 Adj. \n 0.589 \n 0.815 \n \n\nAIC \n 181.2 \n 156.7 \n \n\nBIC \n 185.6 \n 162.5 \n \n\nLog.Lik. \n -87.619\n -74.326\n \n\nF \n 45.460 \n 69.211 \n \n\nRMSE \n 3.74 \n 2.47 \n \n\n\n\n\n \n\n# With dvnames, they are \"mpg\" and \"mpg\"\nmodelsummary(dvnames(list(m1,m2)))\n\n \n\n \n \n\ntinytable_rw10sx05a65jh3z1p9vp\n\n\n \n\n \n mpg\n mpg \n \n\n\n(Intercept)\n 30.099 \n 37.227 \n \n\n \n (1.634)\n (1.599)\n \n\nhp \n -0.068 \n -0.032 \n \n\n \n (0.010)\n (0.009)\n \n\nwt \n \n -3.878 \n \n\n \n \n (0.633)\n \n\nNum.Obs. \n 32 \n 32 \n \n\nR2 \n 0.602 \n 0.827 \n \n\nR2 Adj. \n 0.589 \n 0.815 \n \n\nAIC \n 181.2 \n 156.7 \n \n\nBIC \n 185.6 \n 162.5 \n \n\nLog.Lik. \n -87.619\n -74.326\n \n\nF \n 45.460 \n 69.211 \n \n\nRMSE \n 3.74 \n 2.47", "crumbs": [ "Get started", "Functions", @@ -286,7 +286,7 @@ "href": "man/dvnames.html#title-models-with-their-dependent-variables", "title": "modelsummary: Data and Model Summaries in R", "section": "", - "text": "A convenience function for use with a regression model or list of regression models. Returns a named list of models, where the names are the models’ respective dependent variables. Pass your list of models to dvnames before sending to modelsummary to automatically get dependent variable-titled columns.\n\ndvnames(models, number = FALSE, strip = FALSE, fill = \"Model\")\n\n\n\n\n\nmodels\n\n\nA regression model or list of regression models\n\n\n\n\nnumber\n\n\nShould the models be numbered (1), (2), etc., in addition to their dependent variable names?\n\n\n\n\nstrip\n\n\nboolean FALSE returns the dependent variable names as they appear in the model. TRUE returns the dependent variable names as they appear in the data, without transformations.\n\n\n\n\nfill\n\n\nIf insight::find_response() cannot find a response, the column title to use in its place. Set to ’ ’ to leave blank.\n\n\n\n\nlibrary(modelsummary)\n\n\nm1 <- lm(mpg ~ hp, data = mtcars)\nm2 <- lm(mpg ~ hp + wt, data = mtcars)\n\n# Without dvnames, column names are (1) and (2)\nmodelsummary(list(m1, m2))\n\n \n\n \n \n\ntinytable_u2hh31udbdeemx98iz83\n\n\n \n\n \n (1)\n (2)\n \n\n\n(Intercept)\n 30.099 \n 37.227 \n \n\n \n (1.634)\n (1.599)\n \n\nhp \n -0.068 \n -0.032 \n \n\n \n (0.010)\n (0.009)\n \n\nwt \n \n -3.878 \n \n\n \n \n (0.633)\n \n\nNum.Obs. \n 32 \n 32 \n \n\nR2 \n 0.602 \n 0.827 \n \n\nR2 Adj. \n 0.589 \n 0.815 \n \n\nAIC \n 181.2 \n 156.7 \n \n\nBIC \n 185.6 \n 162.5 \n \n\nLog.Lik. \n -87.619\n -74.326\n \n\nF \n 45.460 \n 69.211 \n \n\nRMSE \n 3.74 \n 2.47 \n \n\n\n\n\n \n\n# With dvnames, they are \"mpg\" and \"mpg\"\nmodelsummary(dvnames(list(m1,m2)))\n\n \n\n \n \n\ntinytable_f852o222qpbpp0nismmp\n\n\n \n\n \n mpg\n mpg \n \n\n\n(Intercept)\n 30.099 \n 37.227 \n \n\n \n (1.634)\n (1.599)\n \n\nhp \n -0.068 \n -0.032 \n \n\n \n (0.010)\n (0.009)\n \n\nwt \n \n -3.878 \n \n\n \n \n (0.633)\n \n\nNum.Obs. \n 32 \n 32 \n \n\nR2 \n 0.602 \n 0.827 \n \n\nR2 Adj. \n 0.589 \n 0.815 \n \n\nAIC \n 181.2 \n 156.7 \n \n\nBIC \n 185.6 \n 162.5 \n \n\nLog.Lik. \n -87.619\n -74.326\n \n\nF \n 45.460 \n 69.211 \n \n\nRMSE \n 3.74 \n 2.47", + "text": "A convenience function for use with a regression model or list of regression models. Returns a named list of models, where the names are the models’ respective dependent variables. Pass your list of models to dvnames before sending to modelsummary to automatically get dependent variable-titled columns.\n\ndvnames(models, number = FALSE, strip = FALSE, fill = \"Model\")\n\n\n\n\n\nmodels\n\n\nA regression model or list of regression models\n\n\n\n\nnumber\n\n\nShould the models be numbered (1), (2), etc., in addition to their dependent variable names?\n\n\n\n\nstrip\n\n\nboolean FALSE returns the dependent variable names as they appear in the model. TRUE returns the dependent variable names as they appear in the data, without transformations.\n\n\n\n\nfill\n\n\nIf insight::find_response() cannot find a response, the column title to use in its place. Set to ’ ’ to leave blank.\n\n\n\n\nlibrary(modelsummary)\n\n\nm1 <- lm(mpg ~ hp, data = mtcars)\nm2 <- lm(mpg ~ hp + wt, data = mtcars)\n\n# Without dvnames, column names are (1) and (2)\nmodelsummary(list(m1, m2))\n\n \n\n \n \n\ntinytable_772j9f8vorr2x1vfz6mc\n\n\n \n\n \n (1)\n (2)\n \n\n\n(Intercept)\n 30.099 \n 37.227 \n \n\n \n (1.634)\n (1.599)\n \n\nhp \n -0.068 \n -0.032 \n \n\n \n (0.010)\n (0.009)\n \n\nwt \n \n -3.878 \n \n\n \n \n (0.633)\n \n\nNum.Obs. \n 32 \n 32 \n \n\nR2 \n 0.602 \n 0.827 \n \n\nR2 Adj. \n 0.589 \n 0.815 \n \n\nAIC \n 181.2 \n 156.7 \n \n\nBIC \n 185.6 \n 162.5 \n \n\nLog.Lik. \n -87.619\n -74.326\n \n\nF \n 45.460 \n 69.211 \n \n\nRMSE \n 3.74 \n 2.47 \n \n\n\n\n\n \n\n# With dvnames, they are \"mpg\" and \"mpg\"\nmodelsummary(dvnames(list(m1,m2)))\n\n \n\n \n \n\ntinytable_rw10sx05a65jh3z1p9vp\n\n\n \n\n \n mpg\n mpg \n \n\n\n(Intercept)\n 30.099 \n 37.227 \n \n\n \n (1.634)\n (1.599)\n \n\nhp \n -0.068 \n -0.032 \n \n\n \n (0.010)\n (0.009)\n \n\nwt \n \n -3.878 \n \n\n \n \n (0.633)\n \n\nNum.Obs. \n 32 \n 32 \n \n\nR2 \n 0.602 \n 0.827 \n \n\nR2 Adj. \n 0.589 \n 0.815 \n \n\nAIC \n 181.2 \n 156.7 \n \n\nBIC \n 185.6 \n 162.5 \n \n\nLog.Lik. \n -87.619\n -74.326\n \n\nF \n 45.460 \n 69.211 \n \n\nRMSE \n 3.74 \n 2.47", "crumbs": [ "Get started", "Functions", @@ -323,7 +323,7 @@ "href": "man/coef_rename.html", "title": "modelsummary: Data and Model Summaries in R", "section": "", - "text": "A convenience function which can be passed to the coef_rename argument of the modelsummary function.\n\ncoef_rename(\n x,\n factor = TRUE,\n factor_name = TRUE,\n backticks = TRUE,\n titlecase = TRUE,\n underscore = TRUE,\n asis = TRUE\n)\n\n\n\n\n\nx\n\n\ncharacter vector of term names to transform\n\n\n\n\nfactor\n\n\nboolean remove the \"factor()\" label\n\n\n\n\nfactor_name\n\n\nboolean remove the \"factor()\" label and the name of the variable\n\n\n\n\nbackticks\n\n\nboolean remove backticks\n\n\n\n\ntitlecase\n\n\nboolean convert to title case\n\n\n\n\nunderscore\n\n\nboolean replace underscores by spaces\n\n\n\n\nasis\n\n\nboolean remove the I from as-is formula calls\n\n\n\n\nlibrary(modelsummary)\n\nlibrary(modelsummary)\ndat <- mtcars\ndat$horse_power <- dat$hp\nmod <- lm(mpg ~ horse_power + factor(cyl), dat)\nmodelsummary(mod, coef_rename = coef_rename)\n\n \n\n \n \n\ntinytable_t1yml4r8s3vt1wgfunii\n\n\n \n\n \n (1)\n \n\n\n(Intercept)\n 28.650 \n \n\n \n (1.588)\n \n\nHorse Power\n -0.024 \n \n\n \n (0.015)\n \n\n6 \n -5.968 \n \n\n \n (1.639)\n \n\n8 \n -8.521 \n \n\n \n (2.326)\n \n\nNum.Obs. \n 32 \n \n\nR2 \n 0.754 \n \n\nR2 Adj. \n 0.727 \n \n\nAIC \n 169.9 \n \n\nBIC \n 177.2 \n \n\nLog.Lik. \n -79.948\n \n\nF \n 28.585 \n \n\nRMSE \n 2.94", + "text": "A convenience function which can be passed to the coef_rename argument of the modelsummary function.\n\ncoef_rename(\n x,\n factor = TRUE,\n factor_name = TRUE,\n backticks = TRUE,\n titlecase = TRUE,\n underscore = TRUE,\n asis = TRUE\n)\n\n\n\n\n\nx\n\n\ncharacter vector of term names to transform\n\n\n\n\nfactor\n\n\nboolean remove the \"factor()\" label\n\n\n\n\nfactor_name\n\n\nboolean remove the \"factor()\" label and the name of the variable\n\n\n\n\nbackticks\n\n\nboolean remove backticks\n\n\n\n\ntitlecase\n\n\nboolean convert to title case\n\n\n\n\nunderscore\n\n\nboolean replace underscores by spaces\n\n\n\n\nasis\n\n\nboolean remove the I from as-is formula calls\n\n\n\n\nlibrary(modelsummary)\n\nlibrary(modelsummary)\ndat <- mtcars\ndat$horse_power <- dat$hp\nmod <- lm(mpg ~ horse_power + factor(cyl), dat)\nmodelsummary(mod, coef_rename = coef_rename)\n\n \n\n \n \n\ntinytable_rbap4rknvkgzumrzimoe\n\n\n \n\n \n (1)\n \n\n\n(Intercept)\n 28.650 \n \n\n \n (1.588)\n \n\nHorse Power\n -0.024 \n \n\n \n (0.015)\n \n\n6 \n -5.968 \n \n\n \n (1.639)\n \n\n8 \n -8.521 \n \n\n \n (2.326)\n \n\nNum.Obs. \n 32 \n \n\nR2 \n 0.754 \n \n\nR2 Adj. \n 0.727 \n \n\nAIC \n 169.9 \n \n\nBIC \n 177.2 \n \n\nLog.Lik. \n -79.948\n \n\nF \n 28.585 \n \n\nRMSE \n 2.94", "crumbs": [ "Get started", "Functions", @@ -336,7 +336,7 @@ "href": "man/coef_rename.html#rename-model-terms", "title": "modelsummary: Data and Model Summaries in R", "section": "", - "text": "A convenience function which can be passed to the coef_rename argument of the modelsummary function.\n\ncoef_rename(\n x,\n factor = TRUE,\n factor_name = TRUE,\n backticks = TRUE,\n titlecase = TRUE,\n underscore = TRUE,\n asis = TRUE\n)\n\n\n\n\n\nx\n\n\ncharacter vector of term names to transform\n\n\n\n\nfactor\n\n\nboolean remove the \"factor()\" label\n\n\n\n\nfactor_name\n\n\nboolean remove the \"factor()\" label and the name of the variable\n\n\n\n\nbackticks\n\n\nboolean remove backticks\n\n\n\n\ntitlecase\n\n\nboolean convert to title case\n\n\n\n\nunderscore\n\n\nboolean replace underscores by spaces\n\n\n\n\nasis\n\n\nboolean remove the I from as-is formula calls\n\n\n\n\nlibrary(modelsummary)\n\nlibrary(modelsummary)\ndat <- mtcars\ndat$horse_power <- dat$hp\nmod <- lm(mpg ~ horse_power + factor(cyl), dat)\nmodelsummary(mod, coef_rename = coef_rename)\n\n \n\n \n \n\ntinytable_t1yml4r8s3vt1wgfunii\n\n\n \n\n \n (1)\n \n\n\n(Intercept)\n 28.650 \n \n\n \n (1.588)\n \n\nHorse Power\n -0.024 \n \n\n \n (0.015)\n \n\n6 \n -5.968 \n \n\n \n (1.639)\n \n\n8 \n -8.521 \n \n\n \n (2.326)\n \n\nNum.Obs. \n 32 \n \n\nR2 \n 0.754 \n \n\nR2 Adj. \n 0.727 \n \n\nAIC \n 169.9 \n \n\nBIC \n 177.2 \n \n\nLog.Lik. \n -79.948\n \n\nF \n 28.585 \n \n\nRMSE \n 2.94", + "text": "A convenience function which can be passed to the coef_rename argument of the modelsummary function.\n\ncoef_rename(\n x,\n factor = TRUE,\n factor_name = TRUE,\n backticks = TRUE,\n titlecase = TRUE,\n underscore = TRUE,\n asis = TRUE\n)\n\n\n\n\n\nx\n\n\ncharacter vector of term names to transform\n\n\n\n\nfactor\n\n\nboolean remove the \"factor()\" label\n\n\n\n\nfactor_name\n\n\nboolean remove the \"factor()\" label and the name of the variable\n\n\n\n\nbackticks\n\n\nboolean remove backticks\n\n\n\n\ntitlecase\n\n\nboolean convert to title case\n\n\n\n\nunderscore\n\n\nboolean replace underscores by spaces\n\n\n\n\nasis\n\n\nboolean remove the I from as-is formula calls\n\n\n\n\nlibrary(modelsummary)\n\nlibrary(modelsummary)\ndat <- mtcars\ndat$horse_power <- dat$hp\nmod <- lm(mpg ~ horse_power + factor(cyl), dat)\nmodelsummary(mod, coef_rename = coef_rename)\n\n \n\n \n \n\ntinytable_rbap4rknvkgzumrzimoe\n\n\n \n\n \n (1)\n \n\n\n(Intercept)\n 28.650 \n \n\n \n (1.588)\n \n\nHorse Power\n -0.024 \n \n\n \n (0.015)\n \n\n6 \n -5.968 \n \n\n \n (1.639)\n \n\n8 \n -8.521 \n \n\n \n (2.326)\n \n\nNum.Obs. \n 32 \n \n\nR2 \n 0.754 \n \n\nR2 Adj. \n 0.727 \n \n\nAIC \n 169.9 \n \n\nBIC \n 177.2 \n \n\nLog.Lik. \n -79.948\n \n\nF \n 28.585 \n \n\nRMSE \n 2.94", "crumbs": [ "Get started", "Functions", @@ -1043,7 +1043,7 @@ "href": "man/datasummary_correlation_format.html", "title": "modelsummary: Data and Model Summaries in R", "section": "", - "text": "Mostly for internal use, but can be useful when users supply a function to the method argument of datasummary_correlation.\n\ndatasummary_correlation_format(\n x,\n fmt,\n leading_zero = FALSE,\n diagonal = NULL,\n upper_triangle = NULL\n)\n\n\n\n\n\nx\n\n\nsquare numeric matrix\n\n\n\n\nfmt\n\n\nhow to format numeric values: integer, user-supplied function, or modelsummary function.\n\n\nInteger: Number of decimal digits\n\n\nUser-supplied functions:\n\n\nAny function which accepts a numeric vector and returns a character vector of the same length.\n\n\n\n\nmodelsummary functions:\n\n\nfmt = fmt_significant(2): Two significant digits (at the term-level)\n\n\nfmt = fmt_sprintf(“%.3f”): See ?sprintf\n\n\nfmt = fmt_identity(): unformatted raw values\n\n\n\n\n\n\n\n\nleading_zero\n\n\nboolean. If FALSE, leading zeros are removed\n\n\n\n\ndiagonal\n\n\ncharacter or NULL. If character, all elements of the diagonal are replaced by the same character (e.g., \"1\").\n\n\n\n\nupper_triangle\n\n\ncharacter or NULL. If character, all elements of the upper triangle are replaced by the same character (e.g., \"\" or \".\").\n\n\n\n\nlibrary(modelsummary)\n\nlibrary(modelsummary)\n\ndat <- mtcars[, c(\"mpg\", \"hp\", \"disp\")]\n\ncor_fun <- function(x) {\n out <- cor(x, method = \"kendall\")\n datasummary_correlation_format(\n out,\n fmt = 2,\n upper_triangle = \"x\",\n diagonal = \".\")\n}\n\ndatasummary_correlation(dat, method = cor_fun)\n\n \n\n \n \n\ntinytable_392nnoahgseq58zawjya\n\n\n \n\n \n mpg\n hp\n disp\n \n\n\nmpg \n . \n x \n x\n \n\nhp \n -.74\n . \n x\n \n\ndisp\n -.77\n .67\n .", + "text": "Mostly for internal use, but can be useful when users supply a function to the method argument of datasummary_correlation.\n\ndatasummary_correlation_format(\n x,\n fmt,\n leading_zero = FALSE,\n diagonal = NULL,\n upper_triangle = NULL\n)\n\n\n\n\n\nx\n\n\nsquare numeric matrix\n\n\n\n\nfmt\n\n\nhow to format numeric values: integer, user-supplied function, or modelsummary function.\n\n\nInteger: Number of decimal digits\n\n\nUser-supplied functions:\n\n\nAny function which accepts a numeric vector and returns a character vector of the same length.\n\n\n\n\nmodelsummary functions:\n\n\nfmt = fmt_significant(2): Two significant digits (at the term-level)\n\n\nfmt = fmt_sprintf(“%.3f”): See ?sprintf\n\n\nfmt = fmt_identity(): unformatted raw values\n\n\n\n\n\n\n\n\nleading_zero\n\n\nboolean. If FALSE, leading zeros are removed\n\n\n\n\ndiagonal\n\n\ncharacter or NULL. If character, all elements of the diagonal are replaced by the same character (e.g., \"1\").\n\n\n\n\nupper_triangle\n\n\ncharacter or NULL. If character, all elements of the upper triangle are replaced by the same character (e.g., \"\" or \".\").\n\n\n\n\nlibrary(modelsummary)\n\nlibrary(modelsummary)\n\ndat <- mtcars[, c(\"mpg\", \"hp\", \"disp\")]\n\ncor_fun <- function(x) {\n out <- cor(x, method = \"kendall\")\n datasummary_correlation_format(\n out,\n fmt = 2,\n upper_triangle = \"x\",\n diagonal = \".\")\n}\n\ndatasummary_correlation(dat, method = cor_fun)\n\n \n\n \n \n\ntinytable_3kc2pfl0q9hno0z8edkj\n\n\n \n\n \n mpg\n hp\n disp\n \n\n\nmpg \n . \n x \n x\n \n\nhp \n -.74\n . \n x\n \n\ndisp\n -.77\n .67\n .", "crumbs": [ "Get started", "Functions", @@ -1056,7 +1056,7 @@ "href": "man/datasummary_correlation_format.html#format-the-content-of-a-correlation-table", "title": "modelsummary: Data and Model Summaries in R", "section": "", - "text": "Mostly for internal use, but can be useful when users supply a function to the method argument of datasummary_correlation.\n\ndatasummary_correlation_format(\n x,\n fmt,\n leading_zero = FALSE,\n diagonal = NULL,\n upper_triangle = NULL\n)\n\n\n\n\n\nx\n\n\nsquare numeric matrix\n\n\n\n\nfmt\n\n\nhow to format numeric values: integer, user-supplied function, or modelsummary function.\n\n\nInteger: Number of decimal digits\n\n\nUser-supplied functions:\n\n\nAny function which accepts a numeric vector and returns a character vector of the same length.\n\n\n\n\nmodelsummary functions:\n\n\nfmt = fmt_significant(2): Two significant digits (at the term-level)\n\n\nfmt = fmt_sprintf(“%.3f”): See ?sprintf\n\n\nfmt = fmt_identity(): unformatted raw values\n\n\n\n\n\n\n\n\nleading_zero\n\n\nboolean. If FALSE, leading zeros are removed\n\n\n\n\ndiagonal\n\n\ncharacter or NULL. If character, all elements of the diagonal are replaced by the same character (e.g., \"1\").\n\n\n\n\nupper_triangle\n\n\ncharacter or NULL. If character, all elements of the upper triangle are replaced by the same character (e.g., \"\" or \".\").\n\n\n\n\nlibrary(modelsummary)\n\nlibrary(modelsummary)\n\ndat <- mtcars[, c(\"mpg\", \"hp\", \"disp\")]\n\ncor_fun <- function(x) {\n out <- cor(x, method = \"kendall\")\n datasummary_correlation_format(\n out,\n fmt = 2,\n upper_triangle = \"x\",\n diagonal = \".\")\n}\n\ndatasummary_correlation(dat, method = cor_fun)\n\n \n\n \n \n\ntinytable_392nnoahgseq58zawjya\n\n\n \n\n \n mpg\n hp\n disp\n \n\n\nmpg \n . \n x \n x\n \n\nhp \n -.74\n . \n x\n \n\ndisp\n -.77\n .67\n .", + "text": "Mostly for internal use, but can be useful when users supply a function to the method argument of datasummary_correlation.\n\ndatasummary_correlation_format(\n x,\n fmt,\n leading_zero = FALSE,\n diagonal = NULL,\n upper_triangle = NULL\n)\n\n\n\n\n\nx\n\n\nsquare numeric matrix\n\n\n\n\nfmt\n\n\nhow to format numeric values: integer, user-supplied function, or modelsummary function.\n\n\nInteger: Number of decimal digits\n\n\nUser-supplied functions:\n\n\nAny function which accepts a numeric vector and returns a character vector of the same length.\n\n\n\n\nmodelsummary functions:\n\n\nfmt = fmt_significant(2): Two significant digits (at the term-level)\n\n\nfmt = fmt_sprintf(“%.3f”): See ?sprintf\n\n\nfmt = fmt_identity(): unformatted raw values\n\n\n\n\n\n\n\n\nleading_zero\n\n\nboolean. If FALSE, leading zeros are removed\n\n\n\n\ndiagonal\n\n\ncharacter or NULL. If character, all elements of the diagonal are replaced by the same character (e.g., \"1\").\n\n\n\n\nupper_triangle\n\n\ncharacter or NULL. If character, all elements of the upper triangle are replaced by the same character (e.g., \"\" or \".\").\n\n\n\n\nlibrary(modelsummary)\n\nlibrary(modelsummary)\n\ndat <- mtcars[, c(\"mpg\", \"hp\", \"disp\")]\n\ncor_fun <- function(x) {\n out <- cor(x, method = \"kendall\")\n datasummary_correlation_format(\n out,\n fmt = 2,\n upper_triangle = \"x\",\n diagonal = \".\")\n}\n\ndatasummary_correlation(dat, method = cor_fun)\n\n \n\n \n \n\ntinytable_3kc2pfl0q9hno0z8edkj\n\n\n \n\n \n mpg\n hp\n disp\n \n\n\nmpg \n . \n x \n x\n \n\nhp \n -.74\n . \n x\n \n\ndisp\n -.77\n .67\n .", "crumbs": [ "Get started", "Functions", @@ -1069,7 +1069,7 @@ "href": "man/datasummary_balance.html", "title": "modelsummary: Data and Model Summaries in R", "section": "", - "text": "Balance table: Summary statistics for different subsets of the data (e.g., control and treatment groups)\nDescription\nCreates balance tables with summary statistics for different subsets of the data (e.g., control and treatment groups). It can also be used to create summary tables for full data sets. See the Details and Examples sections below, and the vignettes on the modelsummary website:\n\n\nhttps://modelsummary.com/\n\n\nhttps://modelsummary.com/articles/datasummary.html\n\nUsage\ndatasummary_balance(\n formula,\n data,\n output = \"default\",\n fmt = fmt_decimal(digits = 1, pdigits = 3),\n title = NULL,\n notes = NULL,\n align = NULL,\n stars = FALSE,\n add_columns = NULL,\n add_rows = NULL,\n dinm = TRUE,\n dinm_statistic = \"std.error\",\n escape = TRUE,\n ...\n)\n\nArguments\n\n\n\nformula\n\n\n\n\n~1: show summary statistics for the full dataset\n\n\none-sided formula: with the \"condition\" or \"column\" variable on the right-hand side.\n\n\ntwo-side formula: with the subset of variables to summarize on the left-hand side and the condition variable on the right-hand side.\n\n\n\n\n\n\ndata\n\n\nA data.frame (or tibble). If this data includes columns called \"blocks\", \"clusters\", and/or \"weights\", the \"estimatr\" package will consider them when calculating the difference in means. If there is a weights column, the reported mean and standard errors will also be weighted.\n\n\n\n\noutput\n\n\nfilename or object type (character string)\n\n\nSupported filename extensions: .docx, .html, .tex, .md, .txt, .csv, .xlsx, .png, .jpg\n\n\nSupported object types: \"default\", \"html\", \"markdown\", \"latex\", \"latex_tabular\", \"typst\", \"data.frame\", \"tinytable\", \"gt\", \"kableExtra\", \"huxtable\", \"flextable\", \"DT\", \"jupyter\". The \"modelsummary_list\" value produces a lightweight object which can be saved and fed back to the modelsummary function.\n\n\nThe \"default\" output format can be set to \"tinytable\", \"kableExtra\", \"gt\", \"flextable\", \"huxtable\", \"DT\", or \"markdown\"\n\n\nIf the user does not choose a default value, the packages listed above are tried in sequence.\n\n\nSession-specific configuration: options(“modelsummary_factory_default” = “gt”)\n\n\nPersistent configuration: config_modelsummary(output = “markdown”)\n\n\n\n\nWarning: Users should not supply a file name to the output argument if they intend to customize the table with external packages. See the ‘Details’ section.\n\n\nLaTeX compilation requires the booktabs and siunitx packages, but siunitx can be disabled or replaced with global options. See the ‘Details’ section.\n\n\n\n\n\n\nfmt\n\n\nhow to format numeric values: integer, user-supplied function, or modelsummary function.\n\n\nInteger: Number of decimal digits\n\n\nUser-supplied functions:\n\n\nAny function which accepts a numeric vector and returns a character vector of the same length.\n\n\n\n\nmodelsummary functions:\n\n\nfmt = fmt_significant(2): Two significant digits (at the term-level)\n\n\nfmt = fmt_sprintf(“%.3f”): See ?sprintf\n\n\nfmt = fmt_identity(): unformatted raw values\n\n\n\n\n\n\n\n\ntitle\n\n\nstring\n\n\n\n\nnotes\n\n\nlist or vector of notes to append to the bottom of the table.\n\n\n\n\nalign\n\n\nA string with a number of characters equal to the number of columns in the table (e.g., align = “lcc”). Valid characters: l, c, r, d.\n\n\n\"l\": left-aligned column\n\n\n\"c\": centered column\n\n\n\"r\": right-aligned column\n\n\n\"d\": dot-aligned column. For LaTeX/PDF output, this option requires at least version 3.0.25 of the siunitx LaTeX package. See the LaTeX preamble help section below for commands to insert in your LaTeX preamble.\n\n\n\n\n\n\nstars\n\n\nto indicate statistical significance\n\n\nFALSE (default): no significance stars.\n\n\nTRUE: +=.1, =.05, =.01, =0.001\n\n\nNamed numeric vector for custom stars such as c(’*’ = .1, ‘+’ = .05)\n\n\nNote: a legend will not be inserted at the bottom of the table when the estimate or statistic arguments use \"glue strings\" with stars.\n\n\n\n\n\n\nadd_columns\n\n\na data.frame (or tibble) with the same number of rows as your main table.\n\n\n\n\nadd_rows\n\n\na data.frame (or tibble) with the same number of columns as your main table. By default, rows are appended to the bottom of the table. You can define a \"position\" attribute of integers to set the row positions. See Examples section below.\n\n\n\n\ndinm\n\n\nTRUE calculates a difference in means with uncertainty estimates. This option is only available if the estimatr package is installed. If data includes columns named \"blocks\", \"clusters\", or \"weights\", this information will be taken into account automatically by estimatr::difference_in_means.\n\n\n\n\ndinm_statistic\n\n\nstring: \"std.error\" or \"p.value\"\n\n\n\n\nescape\n\n\nboolean TRUE escapes or substitutes LaTeX/HTML characters which could prevent the file from compiling/displaying. TRUE escapes all cells, captions, and notes. Users can have more fine-grained control by setting escape=FALSE and using an external command such as: modelsummary(model, “latex”) |> tinytable::format_tt(tab, j=1:5, escape=TRUE)\n\n\n\n\n…\n\n\nall other arguments are passed through to the table-making functions tinytable::tt, kableExtra::kbl, gt::gt, DT::datatable, etc. depending on the output argument. This allows users to pass arguments directly to datasummary in order to affect the behavior of other functions behind the scenes.\n\n\nGlobal Options\nThe behavior of modelsummary can be modified by setting global options. For example:\n\n\noptions(modelsummary_model_labels = “roman”)\n\n\nThe rest of this section describes each of the options above.\n\nModel labels: default column names\n\nThese global option changes the style of the default column headers:\n\n\noptions(modelsummary_model_labels = “roman”)\n\n\noptions(modelsummary_panel_labels = “roman”)\n\n\nThe supported styles are: \"model\", \"panel\", \"arabic\", \"letters\", \"roman\", \"(arabic)\", \"(letters)\", \"(roman)\"\nThe panel-specific option is only used when shape=“rbind”\n\nTable-making packages\n\nmodelsummary supports 6 table-making packages: tinytable, kableExtra, gt, flextable, huxtable, and DT. Some of these packages have overlapping functionalities. To change the default backend used for a specific file format, you can use ’ the options function:\noptions(modelsummary_factory_html = ‘kableExtra’) options(modelsummary_factory_latex = ‘gt’) options(modelsummary_factory_word = ‘huxtable’) options(modelsummary_factory_png = ‘gt’)\n\nTable themes\n\nChange the look of tables in an automated and replicable way, using the modelsummary theming functionality. See the vignette: https://modelsummary.com/articles/appearance.html\n\n\nmodelsummary_theme_gt\n\n\nmodelsummary_theme_kableExtra\n\n\nmodelsummary_theme_huxtable\n\n\nmodelsummary_theme_flextable\n\n\nmodelsummary_theme_dataframe\n\n\n\nModel extraction functions\n\nmodelsummary can use two sets of packages to extract information from statistical models: the easystats family (performance and parameters) and broom. By default, it uses easystats first and then falls back on broom in case of failure. You can change the order of priorities or include goodness-of-fit extracted by both packages by setting:\noptions(modelsummary_get = “easystats”)\noptions(modelsummary_get = “broom”)\noptions(modelsummary_get = “all”)\n\nFormatting numeric entries\n\nBy default, LaTeX tables enclose all numeric entries in the command from the siunitx package. To prevent this behavior, or to enclose numbers in dollar signs (for LaTeX math mode), users can call:\noptions(modelsummary_format_numeric_latex = “plain”)\noptions(modelsummary_format_numeric_latex = “mathmode”)\nA similar option can be used to display numerical entries using MathJax in HTML tables:\noptions(modelsummary_format_numeric_html = “mathjax”)\n\nLaTeX preamble\n\nWhen creating LaTeX via the tinytable backend (default in version 2.0.0 and later), it is useful to include the following commands in the LaTeX preamble of your documents. Note that they are added automatically when compiling Rmarkdown or Quarto documents.\n[3]{}\nExamples\n\nlibrary(modelsummary)\n\nlibrary(modelsummary)\ndatasummary_balance(~am, mtcars)\n\n \n\n \n \n\ntinytable_ulh2ykegwv72f064kn1v\n\n\n \n\n\n \n0\n1\n \n \n\n\n \n Mean\n Std. Dev.\n Mean\n Std. Dev.\n Diff. in Means\n Std. Error\n \n\n\n\nmpg \n 17.1 \n 3.8 \n 24.4 \n 6.2 \n 7.2 \n 1.9 \n \n\ncyl \n 6.9 \n 1.5 \n 5.1 \n 1.6 \n -1.9 \n 0.6 \n \n\ndisp\n 290.4\n 110.2\n 143.5\n 87.2\n -146.8\n 35.0\n \n\nhp \n 160.3\n 53.9 \n 126.8\n 84.1\n -33.4 \n 26.4\n \n\ndrat\n 3.3 \n 0.4 \n 4.0 \n 0.4 \n 0.8 \n 0.1 \n \n\nwt \n 3.8 \n 0.8 \n 2.4 \n 0.6 \n -1.4 \n 0.2 \n \n\nqsec\n 18.2 \n 1.8 \n 17.4 \n 1.8 \n -0.8 \n 0.6 \n \n\nvs \n 0.4 \n 0.5 \n 0.5 \n 0.5 \n 0.2 \n 0.2 \n \n\ngear\n 3.2 \n 0.4 \n 4.4 \n 0.5 \n 1.2 \n 0.2 \n \n\ncarb\n 2.7 \n 1.1 \n 2.9 \n 2.2 \n 0.2 \n 0.7", + "text": "Balance table: Summary statistics for different subsets of the data (e.g., control and treatment groups)\nDescription\nCreates balance tables with summary statistics for different subsets of the data (e.g., control and treatment groups). It can also be used to create summary tables for full data sets. See the Details and Examples sections below, and the vignettes on the modelsummary website:\n\n\nhttps://modelsummary.com/\n\n\nhttps://modelsummary.com/articles/datasummary.html\n\nUsage\ndatasummary_balance(\n formula,\n data,\n output = \"default\",\n fmt = fmt_decimal(digits = 1, pdigits = 3),\n title = NULL,\n notes = NULL,\n align = NULL,\n stars = FALSE,\n add_columns = NULL,\n add_rows = NULL,\n dinm = TRUE,\n dinm_statistic = \"std.error\",\n escape = TRUE,\n ...\n)\n\nArguments\n\n\n\nformula\n\n\n\n\n~1: show summary statistics for the full dataset\n\n\none-sided formula: with the \"condition\" or \"column\" variable on the right-hand side.\n\n\ntwo-side formula: with the subset of variables to summarize on the left-hand side and the condition variable on the right-hand side.\n\n\n\n\n\n\ndata\n\n\nA data.frame (or tibble). If this data includes columns called \"blocks\", \"clusters\", and/or \"weights\", the \"estimatr\" package will consider them when calculating the difference in means. If there is a weights column, the reported mean and standard errors will also be weighted.\n\n\n\n\noutput\n\n\nfilename or object type (character string)\n\n\nSupported filename extensions: .docx, .html, .tex, .md, .txt, .csv, .xlsx, .png, .jpg\n\n\nSupported object types: \"default\", \"html\", \"markdown\", \"latex\", \"latex_tabular\", \"typst\", \"data.frame\", \"tinytable\", \"gt\", \"kableExtra\", \"huxtable\", \"flextable\", \"DT\", \"jupyter\". The \"modelsummary_list\" value produces a lightweight object which can be saved and fed back to the modelsummary function.\n\n\nThe \"default\" output format can be set to \"tinytable\", \"kableExtra\", \"gt\", \"flextable\", \"huxtable\", \"DT\", or \"markdown\"\n\n\nIf the user does not choose a default value, the packages listed above are tried in sequence.\n\n\nSession-specific configuration: options(“modelsummary_factory_default” = “gt”)\n\n\nPersistent configuration: config_modelsummary(output = “markdown”)\n\n\n\n\nWarning: Users should not supply a file name to the output argument if they intend to customize the table with external packages. See the ‘Details’ section.\n\n\nLaTeX compilation requires the booktabs and siunitx packages, but siunitx can be disabled or replaced with global options. See the ‘Details’ section.\n\n\n\n\n\n\nfmt\n\n\nhow to format numeric values: integer, user-supplied function, or modelsummary function.\n\n\nInteger: Number of decimal digits\n\n\nUser-supplied functions:\n\n\nAny function which accepts a numeric vector and returns a character vector of the same length.\n\n\n\n\nmodelsummary functions:\n\n\nfmt = fmt_significant(2): Two significant digits (at the term-level)\n\n\nfmt = fmt_sprintf(“%.3f”): See ?sprintf\n\n\nfmt = fmt_identity(): unformatted raw values\n\n\n\n\n\n\n\n\ntitle\n\n\nstring\n\n\n\n\nnotes\n\n\nlist or vector of notes to append to the bottom of the table.\n\n\n\n\nalign\n\n\nA string with a number of characters equal to the number of columns in the table (e.g., align = “lcc”). Valid characters: l, c, r, d.\n\n\n\"l\": left-aligned column\n\n\n\"c\": centered column\n\n\n\"r\": right-aligned column\n\n\n\"d\": dot-aligned column. For LaTeX/PDF output, this option requires at least version 3.0.25 of the siunitx LaTeX package. See the LaTeX preamble help section below for commands to insert in your LaTeX preamble.\n\n\n\n\n\n\nstars\n\n\nto indicate statistical significance\n\n\nFALSE (default): no significance stars.\n\n\nTRUE: +=.1, =.05, =.01, =0.001\n\n\nNamed numeric vector for custom stars such as c(’*’ = .1, ‘+’ = .05)\n\n\nNote: a legend will not be inserted at the bottom of the table when the estimate or statistic arguments use \"glue strings\" with stars.\n\n\n\n\n\n\nadd_columns\n\n\na data.frame (or tibble) with the same number of rows as your main table.\n\n\n\n\nadd_rows\n\n\na data.frame (or tibble) with the same number of columns as your main table. By default, rows are appended to the bottom of the table. You can define a \"position\" attribute of integers to set the row positions. See Examples section below.\n\n\n\n\ndinm\n\n\nTRUE calculates a difference in means with uncertainty estimates. This option is only available if the estimatr package is installed. If data includes columns named \"blocks\", \"clusters\", or \"weights\", this information will be taken into account automatically by estimatr::difference_in_means.\n\n\n\n\ndinm_statistic\n\n\nstring: \"std.error\" or \"p.value\"\n\n\n\n\nescape\n\n\nboolean TRUE escapes or substitutes LaTeX/HTML characters which could prevent the file from compiling/displaying. TRUE escapes all cells, captions, and notes. Users can have more fine-grained control by setting escape=FALSE and using an external command such as: modelsummary(model, “latex”) |> tinytable::format_tt(tab, j=1:5, escape=TRUE)\n\n\n\n\n…\n\n\nall other arguments are passed through to the table-making functions tinytable::tt, kableExtra::kbl, gt::gt, DT::datatable, etc. depending on the output argument. This allows users to pass arguments directly to datasummary in order to affect the behavior of other functions behind the scenes.\n\n\nGlobal Options\nThe behavior of modelsummary can be modified by setting global options. For example:\n\n\noptions(modelsummary_model_labels = “roman”)\n\n\nThe rest of this section describes each of the options above.\n\nModel labels: default column names\n\nThese global option changes the style of the default column headers:\n\n\noptions(modelsummary_model_labels = “roman”)\n\n\noptions(modelsummary_panel_labels = “roman”)\n\n\nThe supported styles are: \"model\", \"panel\", \"arabic\", \"letters\", \"roman\", \"(arabic)\", \"(letters)\", \"(roman)\"\nThe panel-specific option is only used when shape=“rbind”\n\nTable-making packages\n\nmodelsummary supports 6 table-making packages: tinytable, kableExtra, gt, flextable, huxtable, and DT. Some of these packages have overlapping functionalities. To change the default backend used for a specific file format, you can use ’ the options function:\noptions(modelsummary_factory_html = ‘kableExtra’) options(modelsummary_factory_latex = ‘gt’) options(modelsummary_factory_word = ‘huxtable’) options(modelsummary_factory_png = ‘gt’)\n\nTable themes\n\nChange the look of tables in an automated and replicable way, using the modelsummary theming functionality. See the vignette: https://modelsummary.com/articles/appearance.html\n\n\nmodelsummary_theme_gt\n\n\nmodelsummary_theme_kableExtra\n\n\nmodelsummary_theme_huxtable\n\n\nmodelsummary_theme_flextable\n\n\nmodelsummary_theme_dataframe\n\n\n\nModel extraction functions\n\nmodelsummary can use two sets of packages to extract information from statistical models: the easystats family (performance and parameters) and broom. By default, it uses easystats first and then falls back on broom in case of failure. You can change the order of priorities or include goodness-of-fit extracted by both packages by setting:\noptions(modelsummary_get = “easystats”)\noptions(modelsummary_get = “broom”)\noptions(modelsummary_get = “all”)\n\nFormatting numeric entries\n\nBy default, LaTeX tables enclose all numeric entries in the command from the siunitx package. To prevent this behavior, or to enclose numbers in dollar signs (for LaTeX math mode), users can call:\noptions(modelsummary_format_numeric_latex = “plain”)\noptions(modelsummary_format_numeric_latex = “mathmode”)\nA similar option can be used to display numerical entries using MathJax in HTML tables:\noptions(modelsummary_format_numeric_html = “mathjax”)\n\nLaTeX preamble\n\nWhen creating LaTeX via the tinytable backend (default in version 2.0.0 and later), it is useful to include the following commands in the LaTeX preamble of your documents. Note that they are added automatically when compiling Rmarkdown or Quarto documents.\n[3]{}\nExamples\n\nlibrary(modelsummary)\n\nlibrary(modelsummary)\ndatasummary_balance(~am, mtcars)\n\n \n\n \n \n\ntinytable_htibnfzqgnwsx37vn4fs\n\n\n \n\n\n \n0\n1\n \n \n\n\n \n Mean\n Std. Dev.\n Mean\n Std. Dev.\n Diff. in Means\n Std. Error\n \n\n\n\nmpg \n 17.1 \n 3.8 \n 24.4 \n 6.2 \n 7.2 \n 1.9 \n \n\ncyl \n 6.9 \n 1.5 \n 5.1 \n 1.6 \n -1.9 \n 0.6 \n \n\ndisp\n 290.4\n 110.2\n 143.5\n 87.2\n -146.8\n 35.0\n \n\nhp \n 160.3\n 53.9 \n 126.8\n 84.1\n -33.4 \n 26.4\n \n\ndrat\n 3.3 \n 0.4 \n 4.0 \n 0.4 \n 0.8 \n 0.1 \n \n\nwt \n 3.8 \n 0.8 \n 2.4 \n 0.6 \n -1.4 \n 0.2 \n \n\nqsec\n 18.2 \n 1.8 \n 17.4 \n 1.8 \n -0.8 \n 0.6 \n \n\nvs \n 0.4 \n 0.5 \n 0.5 \n 0.5 \n 0.2 \n 0.2 \n \n\ngear\n 3.2 \n 0.4 \n 4.4 \n 0.5 \n 1.2 \n 0.2 \n \n\ncarb\n 2.7 \n 1.1 \n 2.9 \n 2.2 \n 0.2 \n 0.7", "crumbs": [ "Get started", "Functions", @@ -1081,7 +1081,7 @@ "href": "man/datasummary_correlation.html", "title": "modelsummary: Data and Model Summaries in R", "section": "", - "text": "The names of the variables displayed in the correlation table are the names of the columns in the data. You can rename those columns (with or without spaces) to produce a table of human-readable variables. See the Details and Examples sections below, and the vignettes on the modelsummary website:\n\n\nhttps://modelsummary.com/\n\n\nhttps://modelsummary.com/articles/datasummary.html\n\n\ndatasummary_correlation(\n data,\n output = \"default\",\n method = \"pearson\",\n fmt = 2,\n align = NULL,\n add_rows = NULL,\n add_columns = NULL,\n title = NULL,\n notes = NULL,\n escape = TRUE,\n ...\n)\n\n\n\n\n\ndata\n\n\nA data.frame (or tibble)\n\n\n\n\noutput\n\n\nfilename or object type (character string)\n\n\nSupported filename extensions: .docx, .html, .tex, .md, .txt, .csv, .xlsx, .png, .jpg\n\n\nSupported object types: \"default\", \"html\", \"markdown\", \"latex\", \"latex_tabular\", \"typst\", \"data.frame\", \"tinytable\", \"gt\", \"kableExtra\", \"huxtable\", \"flextable\", \"DT\", \"jupyter\". The \"modelsummary_list\" value produces a lightweight object which can be saved and fed back to the modelsummary function.\n\n\nThe \"default\" output format can be set to \"tinytable\", \"kableExtra\", \"gt\", \"flextable\", \"huxtable\", \"DT\", or \"markdown\"\n\n\nIf the user does not choose a default value, the packages listed above are tried in sequence.\n\n\nSession-specific configuration: options(“modelsummary_factory_default” = “gt”)\n\n\nPersistent configuration: config_modelsummary(output = “markdown”)\n\n\n\n\nWarning: Users should not supply a file name to the output argument if they intend to customize the table with external packages. See the ‘Details’ section.\n\n\nLaTeX compilation requires the booktabs and siunitx packages, but siunitx can be disabled or replaced with global options. See the ‘Details’ section.\n\n\n\n\n\n\nmethod\n\n\ncharacter or function\n\n\ncharacter: \"pearson\", \"kendall\", \"spearman\", or \"pearspear\" (Pearson correlations above and Spearman correlations below the diagonal)\n\n\nfunction: takes a data.frame with numeric columns and returns a square matrix or data.frame with unique row.names and colnames corresponding to variable names. Note that the datasummary_correlation_format can often be useful for formatting the output of custom correlation functions.\n\n\n\n\n\n\nfmt\n\n\nhow to format numeric values: integer, user-supplied function, or modelsummary function.\n\n\nInteger: Number of decimal digits\n\n\nUser-supplied functions:\n\n\nAny function which accepts a numeric vector and returns a character vector of the same length.\n\n\n\n\nmodelsummary functions:\n\n\nfmt = fmt_significant(2): Two significant digits (at the term-level)\n\n\nfmt = fmt_sprintf(“%.3f”): See ?sprintf\n\n\nfmt = fmt_identity(): unformatted raw values\n\n\n\n\n\n\n\n\nalign\n\n\nA string with a number of characters equal to the number of columns in the table (e.g., align = “lcc”). Valid characters: l, c, r, d.\n\n\n\"l\": left-aligned column\n\n\n\"c\": centered column\n\n\n\"r\": right-aligned column\n\n\n\"d\": dot-aligned column. For LaTeX/PDF output, this option requires at least version 3.0.25 of the siunitx LaTeX package. See the LaTeX preamble help section below for commands to insert in your LaTeX preamble.\n\n\n\n\n\n\nadd_rows\n\n\na data.frame (or tibble) with the same number of columns as your main table. By default, rows are appended to the bottom of the table. You can define a \"position\" attribute of integers to set the row positions. See Examples section below.\n\n\n\n\nadd_columns\n\n\na data.frame (or tibble) with the same number of rows as your main table.\n\n\n\n\ntitle\n\n\nstring\n\n\n\n\nnotes\n\n\nlist or vector of notes to append to the bottom of the table.\n\n\n\n\nescape\n\n\nboolean TRUE escapes or substitutes LaTeX/HTML characters which could prevent the file from compiling/displaying. TRUE escapes all cells, captions, and notes. Users can have more fine-grained control by setting escape=FALSE and using an external command such as: modelsummary(model, “latex”) |> tinytable::format_tt(tab, j=1:5, escape=TRUE)\n\n\n\n\n…\n\n\nother parameters are passed through to the table-making packages.\n\n\n\nThe behavior of modelsummary can be modified by setting global options. For example:\n\n\noptions(modelsummary_model_labels = “roman”)\n\n\nThe rest of this section describes each of the options above.\n\nThese global option changes the style of the default column headers:\n\n\noptions(modelsummary_model_labels = “roman”)\n\n\noptions(modelsummary_panel_labels = “roman”)\n\n\nThe supported styles are: \"model\", \"panel\", \"arabic\", \"letters\", \"roman\", \"(arabic)\", \"(letters)\", \"(roman)\"\nThe panel-specific option is only used when shape=“rbind”\n\nmodelsummary supports 6 table-making packages: tinytable, kableExtra, gt, flextable, huxtable, and DT. Some of these packages have overlapping functionalities. To change the default backend used for a specific file format, you can use ’ the options function:\noptions(modelsummary_factory_html = ‘kableExtra’) options(modelsummary_factory_latex = ‘gt’) options(modelsummary_factory_word = ‘huxtable’) options(modelsummary_factory_png = ‘gt’)\n\nChange the look of tables in an automated and replicable way, using the modelsummary theming functionality. See the vignette: https://modelsummary.com/articles/appearance.html\n\n\nmodelsummary_theme_gt\n\n\nmodelsummary_theme_kableExtra\n\n\nmodelsummary_theme_huxtable\n\n\nmodelsummary_theme_flextable\n\n\nmodelsummary_theme_dataframe\n\n\n\nmodelsummary can use two sets of packages to extract information from statistical models: the easystats family (performance and parameters) and broom. By default, it uses easystats first and then falls back on broom in case of failure. You can change the order of priorities or include goodness-of-fit extracted by both packages by setting:\noptions(modelsummary_get = “easystats”)\noptions(modelsummary_get = “broom”)\noptions(modelsummary_get = “all”)\n\nBy default, LaTeX tables enclose all numeric entries in the command from the siunitx package. To prevent this behavior, or to enclose numbers in dollar signs (for LaTeX math mode), users can call:\noptions(modelsummary_format_numeric_latex = “plain”)\noptions(modelsummary_format_numeric_latex = “mathmode”)\nA similar option can be used to display numerical entries using MathJax in HTML tables:\noptions(modelsummary_format_numeric_html = “mathjax”)\n\nWhen creating LaTeX via the tinytable backend (default in version 2.0.0 and later), it is useful to include the following commands in the LaTeX preamble of your documents. Note that they are added automatically when compiling Rmarkdown or Quarto documents.\n[3]{}\n\n\nlibrary(modelsummary)\n\nlibrary(modelsummary)\n\n# clean variable names (base R)\ndat <- mtcars[, c(\"mpg\", \"hp\")]\ncolnames(dat) <- c(\"Miles / Gallon\", \"Horse Power\")\ndatasummary_correlation(dat)\n\n \n\n \n \n\ntinytable_grzw8xi4ix63dmd78n0p\n\n\n \n\n \n Miles / Gallon\n Horse Power\n \n\n\nMiles / Gallon\n 1 \n .\n \n\nHorse Power \n -.78\n 1\n \n\n\n\n\n \n\n# clean variable names (tidyverse)\nlibrary(tidyverse)\ndat <- mtcars %>%\n select(`Miles / Gallon` = mpg,\n `Horse Power` = hp)\ndatasummary_correlation(dat)\n\n \n\n \n \n\ntinytable_5ox0wtvehi0xjlxiovka\n\n\n \n\n \n Miles / Gallon\n Horse Power\n \n\n\nMiles / Gallon\n 1 \n .\n \n\nHorse Power \n -.78\n 1\n \n\n\n\n\n \n\n# alternative methods\ndatasummary_correlation(dat, method = \"pearspear\")\n\n \n\n \n \n\ntinytable_xqd02z3d30gyj47o4kgz\n\n\n \n\n \n Miles / Gallon\n Horse Power\n \n\n\nMiles / Gallon\n 1 \n -.78\n \n\nHorse Power \n -.89\n 1 \n \n\n\n\n\n \n\n# custom function\ncor_fun <- function(x) cor(x, method = \"kendall\")\ndatasummary_correlation(dat, method = cor_fun)\n\n \n\n \n \n\ntinytable_2olu6wk3h3qqthxs8g0z\n\n\n \n\n \n Miles / Gallon\n Horse Power\n \n\n\nMiles / Gallon\n 1.00\n -.74\n \n\nHorse Power \n -.74\n 1.00\n \n\n\n\n\n \n\n# rename columns alphabetically and include a footnote for reference\nnote <- sprintf(\"(%s) %s\", letters[1:ncol(dat)], colnames(dat))\nnote <- paste(note, collapse = \"; \")\n\ncolnames(dat) <- sprintf(\"(%s)\", letters[1:ncol(dat)])\n\ndatasummary_correlation(dat, notes = note)\n\n \n\n \n \n\ntinytable_unbyis56d7465brso0gh\n\n\n \n\n \n (a)\n (b)\n \n(a) Miles / Gallon; (b) Horse Power\n\n\n(a)\n 1 \n .\n \n\n(b)\n -.78\n 1\n \n\n\n\n\n \n\n# `datasummary_correlation_format`: custom function with formatting\ndat <- mtcars[, c(\"mpg\", \"hp\", \"disp\")]\n\ncor_fun <- function(x) {\n out <- cor(x, method = \"kendall\")\n datasummary_correlation_format(\n out,\n fmt = 2,\n upper_triangle = \"x\",\n diagonal = \".\")\n}\n\ndatasummary_correlation(dat, method = cor_fun)\n\n \n\n \n \n\ntinytable_290nz6nezudmuuclwueb\n\n\n \n\n \n mpg\n hp\n disp\n \n\n\nmpg \n . \n x \n x\n \n\nhp \n -.74\n . \n x\n \n\ndisp\n -.77\n .67\n .\n \n\n\n\n\n \n\n# use kableExtra and psych to color significant cells\nlibrary(psych)\nlibrary(kableExtra)\n\ndat <- mtcars[, c(\"vs\", \"hp\", \"gear\")]\n\ncor_fun <- function(dat) {\n # compute correlations and format them\n correlations <- data.frame(cor(dat))\n correlations <- datasummary_correlation_format(correlations, fmt = 2)\n\n # calculate pvalues using the `psych` package\n pvalues <- psych::corr.test(dat)$p\n\n # use `kableExtra::cell_spec` to color significant cells\n for (i in 1:nrow(correlations)) {\n for (j in 1:ncol(correlations)) {\n if (pvalues[i, j] < 0.05 && i != j) {\n correlations[i, j] <- cell_spec(correlations[i, j], background = \"pink\")\n }\n }\n }\n return(correlations)\n}\n\n# The `escape=FALSE` is important here!\ndatasummary_correlation(dat, method = cor_fun, escape = FALSE)\n\n \n\n \n \n\ntinytable_mq9s8yxqc31x4l6kzddz\n\n\n \n\n \n vs\n hp\n gear\n \n\n\nvs \n 1.00 \n -.72\n .21 \n \n\nhp \n -.72\n 1.00 \n -.13\n \n\ngear\n .21 \n -.13 \n 1.00", + "text": "The names of the variables displayed in the correlation table are the names of the columns in the data. You can rename those columns (with or without spaces) to produce a table of human-readable variables. See the Details and Examples sections below, and the vignettes on the modelsummary website:\n\n\nhttps://modelsummary.com/\n\n\nhttps://modelsummary.com/articles/datasummary.html\n\n\ndatasummary_correlation(\n data,\n output = \"default\",\n method = \"pearson\",\n fmt = 2,\n align = NULL,\n add_rows = NULL,\n add_columns = NULL,\n title = NULL,\n notes = NULL,\n escape = TRUE,\n ...\n)\n\n\n\n\n\ndata\n\n\nA data.frame (or tibble)\n\n\n\n\noutput\n\n\nfilename or object type (character string)\n\n\nSupported filename extensions: .docx, .html, .tex, .md, .txt, .csv, .xlsx, .png, .jpg\n\n\nSupported object types: \"default\", \"html\", \"markdown\", \"latex\", \"latex_tabular\", \"typst\", \"data.frame\", \"tinytable\", \"gt\", \"kableExtra\", \"huxtable\", \"flextable\", \"DT\", \"jupyter\". The \"modelsummary_list\" value produces a lightweight object which can be saved and fed back to the modelsummary function.\n\n\nThe \"default\" output format can be set to \"tinytable\", \"kableExtra\", \"gt\", \"flextable\", \"huxtable\", \"DT\", or \"markdown\"\n\n\nIf the user does not choose a default value, the packages listed above are tried in sequence.\n\n\nSession-specific configuration: options(“modelsummary_factory_default” = “gt”)\n\n\nPersistent configuration: config_modelsummary(output = “markdown”)\n\n\n\n\nWarning: Users should not supply a file name to the output argument if they intend to customize the table with external packages. See the ‘Details’ section.\n\n\nLaTeX compilation requires the booktabs and siunitx packages, but siunitx can be disabled or replaced with global options. See the ‘Details’ section.\n\n\n\n\n\n\nmethod\n\n\ncharacter or function\n\n\ncharacter: \"pearson\", \"kendall\", \"spearman\", or \"pearspear\" (Pearson correlations above and Spearman correlations below the diagonal)\n\n\nfunction: takes a data.frame with numeric columns and returns a square matrix or data.frame with unique row.names and colnames corresponding to variable names. Note that the datasummary_correlation_format can often be useful for formatting the output of custom correlation functions.\n\n\n\n\n\n\nfmt\n\n\nhow to format numeric values: integer, user-supplied function, or modelsummary function.\n\n\nInteger: Number of decimal digits\n\n\nUser-supplied functions:\n\n\nAny function which accepts a numeric vector and returns a character vector of the same length.\n\n\n\n\nmodelsummary functions:\n\n\nfmt = fmt_significant(2): Two significant digits (at the term-level)\n\n\nfmt = fmt_sprintf(“%.3f”): See ?sprintf\n\n\nfmt = fmt_identity(): unformatted raw values\n\n\n\n\n\n\n\n\nalign\n\n\nA string with a number of characters equal to the number of columns in the table (e.g., align = “lcc”). Valid characters: l, c, r, d.\n\n\n\"l\": left-aligned column\n\n\n\"c\": centered column\n\n\n\"r\": right-aligned column\n\n\n\"d\": dot-aligned column. For LaTeX/PDF output, this option requires at least version 3.0.25 of the siunitx LaTeX package. See the LaTeX preamble help section below for commands to insert in your LaTeX preamble.\n\n\n\n\n\n\nadd_rows\n\n\na data.frame (or tibble) with the same number of columns as your main table. By default, rows are appended to the bottom of the table. You can define a \"position\" attribute of integers to set the row positions. See Examples section below.\n\n\n\n\nadd_columns\n\n\na data.frame (or tibble) with the same number of rows as your main table.\n\n\n\n\ntitle\n\n\nstring\n\n\n\n\nnotes\n\n\nlist or vector of notes to append to the bottom of the table.\n\n\n\n\nescape\n\n\nboolean TRUE escapes or substitutes LaTeX/HTML characters which could prevent the file from compiling/displaying. TRUE escapes all cells, captions, and notes. Users can have more fine-grained control by setting escape=FALSE and using an external command such as: modelsummary(model, “latex”) |> tinytable::format_tt(tab, j=1:5, escape=TRUE)\n\n\n\n\n…\n\n\nother parameters are passed through to the table-making packages.\n\n\n\nThe behavior of modelsummary can be modified by setting global options. For example:\n\n\noptions(modelsummary_model_labels = “roman”)\n\n\nThe rest of this section describes each of the options above.\n\nThese global option changes the style of the default column headers:\n\n\noptions(modelsummary_model_labels = “roman”)\n\n\noptions(modelsummary_panel_labels = “roman”)\n\n\nThe supported styles are: \"model\", \"panel\", \"arabic\", \"letters\", \"roman\", \"(arabic)\", \"(letters)\", \"(roman)\"\nThe panel-specific option is only used when shape=“rbind”\n\nmodelsummary supports 6 table-making packages: tinytable, kableExtra, gt, flextable, huxtable, and DT. Some of these packages have overlapping functionalities. To change the default backend used for a specific file format, you can use ’ the options function:\noptions(modelsummary_factory_html = ‘kableExtra’) options(modelsummary_factory_latex = ‘gt’) options(modelsummary_factory_word = ‘huxtable’) options(modelsummary_factory_png = ‘gt’)\n\nChange the look of tables in an automated and replicable way, using the modelsummary theming functionality. See the vignette: https://modelsummary.com/articles/appearance.html\n\n\nmodelsummary_theme_gt\n\n\nmodelsummary_theme_kableExtra\n\n\nmodelsummary_theme_huxtable\n\n\nmodelsummary_theme_flextable\n\n\nmodelsummary_theme_dataframe\n\n\n\nmodelsummary can use two sets of packages to extract information from statistical models: the easystats family (performance and parameters) and broom. By default, it uses easystats first and then falls back on broom in case of failure. You can change the order of priorities or include goodness-of-fit extracted by both packages by setting:\noptions(modelsummary_get = “easystats”)\noptions(modelsummary_get = “broom”)\noptions(modelsummary_get = “all”)\n\nBy default, LaTeX tables enclose all numeric entries in the command from the siunitx package. To prevent this behavior, or to enclose numbers in dollar signs (for LaTeX math mode), users can call:\noptions(modelsummary_format_numeric_latex = “plain”)\noptions(modelsummary_format_numeric_latex = “mathmode”)\nA similar option can be used to display numerical entries using MathJax in HTML tables:\noptions(modelsummary_format_numeric_html = “mathjax”)\n\nWhen creating LaTeX via the tinytable backend (default in version 2.0.0 and later), it is useful to include the following commands in the LaTeX preamble of your documents. Note that they are added automatically when compiling Rmarkdown or Quarto documents.\n[3]{}\n\n\nlibrary(modelsummary)\n\nlibrary(modelsummary)\n\n# clean variable names (base R)\ndat <- mtcars[, c(\"mpg\", \"hp\")]\ncolnames(dat) <- c(\"Miles / Gallon\", \"Horse Power\")\ndatasummary_correlation(dat)\n\n \n\n \n \n\ntinytable_6uos5z8sgk9bsnoqyd87\n\n\n \n\n \n Miles / Gallon\n Horse Power\n \n\n\nMiles / Gallon\n 1 \n .\n \n\nHorse Power \n -.78\n 1\n \n\n\n\n\n \n\n# clean variable names (tidyverse)\nlibrary(tidyverse)\ndat <- mtcars %>%\n select(`Miles / Gallon` = mpg,\n `Horse Power` = hp)\ndatasummary_correlation(dat)\n\n \n\n \n \n\ntinytable_lirm7rmbmb1bhm3csgcq\n\n\n \n\n \n Miles / Gallon\n Horse Power\n \n\n\nMiles / Gallon\n 1 \n .\n \n\nHorse Power \n -.78\n 1\n \n\n\n\n\n \n\n# alternative methods\ndatasummary_correlation(dat, method = \"pearspear\")\n\n \n\n \n \n\ntinytable_g1h47nvfzs3b4ydipnh2\n\n\n \n\n \n Miles / Gallon\n Horse Power\n \n\n\nMiles / Gallon\n 1 \n -.78\n \n\nHorse Power \n -.89\n 1 \n \n\n\n\n\n \n\n# custom function\ncor_fun <- function(x) cor(x, method = \"kendall\")\ndatasummary_correlation(dat, method = cor_fun)\n\n \n\n \n \n\ntinytable_akw46qppai3kvnvxdcc9\n\n\n \n\n \n Miles / Gallon\n Horse Power\n \n\n\nMiles / Gallon\n 1.00\n -.74\n \n\nHorse Power \n -.74\n 1.00\n \n\n\n\n\n \n\n# rename columns alphabetically and include a footnote for reference\nnote <- sprintf(\"(%s) %s\", letters[1:ncol(dat)], colnames(dat))\nnote <- paste(note, collapse = \"; \")\n\ncolnames(dat) <- sprintf(\"(%s)\", letters[1:ncol(dat)])\n\ndatasummary_correlation(dat, notes = note)\n\n \n\n \n \n\ntinytable_roj4xo4qo0ukg7h53ryb\n\n\n \n\n \n (a)\n (b)\n \n(a) Miles / Gallon; (b) Horse Power\n\n\n(a)\n 1 \n .\n \n\n(b)\n -.78\n 1\n \n\n\n\n\n \n\n# `datasummary_correlation_format`: custom function with formatting\ndat <- mtcars[, c(\"mpg\", \"hp\", \"disp\")]\n\ncor_fun <- function(x) {\n out <- cor(x, method = \"kendall\")\n datasummary_correlation_format(\n out,\n fmt = 2,\n upper_triangle = \"x\",\n diagonal = \".\")\n}\n\ndatasummary_correlation(dat, method = cor_fun)\n\n \n\n \n \n\ntinytable_dtwgcvpkx4t7hz2i19th\n\n\n \n\n \n mpg\n hp\n disp\n \n\n\nmpg \n . \n x \n x\n \n\nhp \n -.74\n . \n x\n \n\ndisp\n -.77\n .67\n .\n \n\n\n\n\n \n\n# use kableExtra and psych to color significant cells\nlibrary(psych)\nlibrary(kableExtra)\n\ndat <- mtcars[, c(\"vs\", \"hp\", \"gear\")]\n\ncor_fun <- function(dat) {\n # compute correlations and format them\n correlations <- data.frame(cor(dat))\n correlations <- datasummary_correlation_format(correlations, fmt = 2)\n\n # calculate pvalues using the `psych` package\n pvalues <- psych::corr.test(dat)$p\n\n # use `kableExtra::cell_spec` to color significant cells\n for (i in 1:nrow(correlations)) {\n for (j in 1:ncol(correlations)) {\n if (pvalues[i, j] < 0.05 && i != j) {\n correlations[i, j] <- cell_spec(correlations[i, j], background = \"pink\")\n }\n }\n }\n return(correlations)\n}\n\n# The `escape=FALSE` is important here!\ndatasummary_correlation(dat, method = cor_fun, escape = FALSE)\n\n \n\n \n \n\ntinytable_aeb5nr6svrb95kerwvmv\n\n\n \n\n \n vs\n hp\n gear\n \n\n\nvs \n 1.00 \n -.72\n .21 \n \n\nhp \n -.72\n 1.00 \n -.13\n \n\ngear\n .21 \n -.13 \n 1.00", "crumbs": [ "Get started", "Functions", @@ -1093,7 +1093,7 @@ "href": "man/datasummary_correlation.html#generate-a-correlation-table-for-all-numeric-variables-in-your-dataset.", "title": "modelsummary: Data and Model Summaries in R", "section": "", - "text": "The names of the variables displayed in the correlation table are the names of the columns in the data. You can rename those columns (with or without spaces) to produce a table of human-readable variables. See the Details and Examples sections below, and the vignettes on the modelsummary website:\n\n\nhttps://modelsummary.com/\n\n\nhttps://modelsummary.com/articles/datasummary.html\n\n\ndatasummary_correlation(\n data,\n output = \"default\",\n method = \"pearson\",\n fmt = 2,\n align = NULL,\n add_rows = NULL,\n add_columns = NULL,\n title = NULL,\n notes = NULL,\n escape = TRUE,\n ...\n)\n\n\n\n\n\ndata\n\n\nA data.frame (or tibble)\n\n\n\n\noutput\n\n\nfilename or object type (character string)\n\n\nSupported filename extensions: .docx, .html, .tex, .md, .txt, .csv, .xlsx, .png, .jpg\n\n\nSupported object types: \"default\", \"html\", \"markdown\", \"latex\", \"latex_tabular\", \"typst\", \"data.frame\", \"tinytable\", \"gt\", \"kableExtra\", \"huxtable\", \"flextable\", \"DT\", \"jupyter\". The \"modelsummary_list\" value produces a lightweight object which can be saved and fed back to the modelsummary function.\n\n\nThe \"default\" output format can be set to \"tinytable\", \"kableExtra\", \"gt\", \"flextable\", \"huxtable\", \"DT\", or \"markdown\"\n\n\nIf the user does not choose a default value, the packages listed above are tried in sequence.\n\n\nSession-specific configuration: options(“modelsummary_factory_default” = “gt”)\n\n\nPersistent configuration: config_modelsummary(output = “markdown”)\n\n\n\n\nWarning: Users should not supply a file name to the output argument if they intend to customize the table with external packages. See the ‘Details’ section.\n\n\nLaTeX compilation requires the booktabs and siunitx packages, but siunitx can be disabled or replaced with global options. See the ‘Details’ section.\n\n\n\n\n\n\nmethod\n\n\ncharacter or function\n\n\ncharacter: \"pearson\", \"kendall\", \"spearman\", or \"pearspear\" (Pearson correlations above and Spearman correlations below the diagonal)\n\n\nfunction: takes a data.frame with numeric columns and returns a square matrix or data.frame with unique row.names and colnames corresponding to variable names. Note that the datasummary_correlation_format can often be useful for formatting the output of custom correlation functions.\n\n\n\n\n\n\nfmt\n\n\nhow to format numeric values: integer, user-supplied function, or modelsummary function.\n\n\nInteger: Number of decimal digits\n\n\nUser-supplied functions:\n\n\nAny function which accepts a numeric vector and returns a character vector of the same length.\n\n\n\n\nmodelsummary functions:\n\n\nfmt = fmt_significant(2): Two significant digits (at the term-level)\n\n\nfmt = fmt_sprintf(“%.3f”): See ?sprintf\n\n\nfmt = fmt_identity(): unformatted raw values\n\n\n\n\n\n\n\n\nalign\n\n\nA string with a number of characters equal to the number of columns in the table (e.g., align = “lcc”). Valid characters: l, c, r, d.\n\n\n\"l\": left-aligned column\n\n\n\"c\": centered column\n\n\n\"r\": right-aligned column\n\n\n\"d\": dot-aligned column. For LaTeX/PDF output, this option requires at least version 3.0.25 of the siunitx LaTeX package. See the LaTeX preamble help section below for commands to insert in your LaTeX preamble.\n\n\n\n\n\n\nadd_rows\n\n\na data.frame (or tibble) with the same number of columns as your main table. By default, rows are appended to the bottom of the table. You can define a \"position\" attribute of integers to set the row positions. See Examples section below.\n\n\n\n\nadd_columns\n\n\na data.frame (or tibble) with the same number of rows as your main table.\n\n\n\n\ntitle\n\n\nstring\n\n\n\n\nnotes\n\n\nlist or vector of notes to append to the bottom of the table.\n\n\n\n\nescape\n\n\nboolean TRUE escapes or substitutes LaTeX/HTML characters which could prevent the file from compiling/displaying. TRUE escapes all cells, captions, and notes. Users can have more fine-grained control by setting escape=FALSE and using an external command such as: modelsummary(model, “latex”) |> tinytable::format_tt(tab, j=1:5, escape=TRUE)\n\n\n\n\n…\n\n\nother parameters are passed through to the table-making packages.\n\n\n\nThe behavior of modelsummary can be modified by setting global options. For example:\n\n\noptions(modelsummary_model_labels = “roman”)\n\n\nThe rest of this section describes each of the options above.\n\nThese global option changes the style of the default column headers:\n\n\noptions(modelsummary_model_labels = “roman”)\n\n\noptions(modelsummary_panel_labels = “roman”)\n\n\nThe supported styles are: \"model\", \"panel\", \"arabic\", \"letters\", \"roman\", \"(arabic)\", \"(letters)\", \"(roman)\"\nThe panel-specific option is only used when shape=“rbind”\n\nmodelsummary supports 6 table-making packages: tinytable, kableExtra, gt, flextable, huxtable, and DT. Some of these packages have overlapping functionalities. To change the default backend used for a specific file format, you can use ’ the options function:\noptions(modelsummary_factory_html = ‘kableExtra’) options(modelsummary_factory_latex = ‘gt’) options(modelsummary_factory_word = ‘huxtable’) options(modelsummary_factory_png = ‘gt’)\n\nChange the look of tables in an automated and replicable way, using the modelsummary theming functionality. See the vignette: https://modelsummary.com/articles/appearance.html\n\n\nmodelsummary_theme_gt\n\n\nmodelsummary_theme_kableExtra\n\n\nmodelsummary_theme_huxtable\n\n\nmodelsummary_theme_flextable\n\n\nmodelsummary_theme_dataframe\n\n\n\nmodelsummary can use two sets of packages to extract information from statistical models: the easystats family (performance and parameters) and broom. By default, it uses easystats first and then falls back on broom in case of failure. You can change the order of priorities or include goodness-of-fit extracted by both packages by setting:\noptions(modelsummary_get = “easystats”)\noptions(modelsummary_get = “broom”)\noptions(modelsummary_get = “all”)\n\nBy default, LaTeX tables enclose all numeric entries in the command from the siunitx package. To prevent this behavior, or to enclose numbers in dollar signs (for LaTeX math mode), users can call:\noptions(modelsummary_format_numeric_latex = “plain”)\noptions(modelsummary_format_numeric_latex = “mathmode”)\nA similar option can be used to display numerical entries using MathJax in HTML tables:\noptions(modelsummary_format_numeric_html = “mathjax”)\n\nWhen creating LaTeX via the tinytable backend (default in version 2.0.0 and later), it is useful to include the following commands in the LaTeX preamble of your documents. Note that they are added automatically when compiling Rmarkdown or Quarto documents.\n[3]{}\n\n\nlibrary(modelsummary)\n\nlibrary(modelsummary)\n\n# clean variable names (base R)\ndat <- mtcars[, c(\"mpg\", \"hp\")]\ncolnames(dat) <- c(\"Miles / Gallon\", \"Horse Power\")\ndatasummary_correlation(dat)\n\n \n\n \n \n\ntinytable_grzw8xi4ix63dmd78n0p\n\n\n \n\n \n Miles / Gallon\n Horse Power\n \n\n\nMiles / Gallon\n 1 \n .\n \n\nHorse Power \n -.78\n 1\n \n\n\n\n\n \n\n# clean variable names (tidyverse)\nlibrary(tidyverse)\ndat <- mtcars %>%\n select(`Miles / Gallon` = mpg,\n `Horse Power` = hp)\ndatasummary_correlation(dat)\n\n \n\n \n \n\ntinytable_5ox0wtvehi0xjlxiovka\n\n\n \n\n \n Miles / Gallon\n Horse Power\n \n\n\nMiles / Gallon\n 1 \n .\n \n\nHorse Power \n -.78\n 1\n \n\n\n\n\n \n\n# alternative methods\ndatasummary_correlation(dat, method = \"pearspear\")\n\n \n\n \n \n\ntinytable_xqd02z3d30gyj47o4kgz\n\n\n \n\n \n Miles / Gallon\n Horse Power\n \n\n\nMiles / Gallon\n 1 \n -.78\n \n\nHorse Power \n -.89\n 1 \n \n\n\n\n\n \n\n# custom function\ncor_fun <- function(x) cor(x, method = \"kendall\")\ndatasummary_correlation(dat, method = cor_fun)\n\n \n\n \n \n\ntinytable_2olu6wk3h3qqthxs8g0z\n\n\n \n\n \n Miles / Gallon\n Horse Power\n \n\n\nMiles / Gallon\n 1.00\n -.74\n \n\nHorse Power \n -.74\n 1.00\n \n\n\n\n\n \n\n# rename columns alphabetically and include a footnote for reference\nnote <- sprintf(\"(%s) %s\", letters[1:ncol(dat)], colnames(dat))\nnote <- paste(note, collapse = \"; \")\n\ncolnames(dat) <- sprintf(\"(%s)\", letters[1:ncol(dat)])\n\ndatasummary_correlation(dat, notes = note)\n\n \n\n \n \n\ntinytable_unbyis56d7465brso0gh\n\n\n \n\n \n (a)\n (b)\n \n(a) Miles / Gallon; (b) Horse Power\n\n\n(a)\n 1 \n .\n \n\n(b)\n -.78\n 1\n \n\n\n\n\n \n\n# `datasummary_correlation_format`: custom function with formatting\ndat <- mtcars[, c(\"mpg\", \"hp\", \"disp\")]\n\ncor_fun <- function(x) {\n out <- cor(x, method = \"kendall\")\n datasummary_correlation_format(\n out,\n fmt = 2,\n upper_triangle = \"x\",\n diagonal = \".\")\n}\n\ndatasummary_correlation(dat, method = cor_fun)\n\n \n\n \n \n\ntinytable_290nz6nezudmuuclwueb\n\n\n \n\n \n mpg\n hp\n disp\n \n\n\nmpg \n . \n x \n x\n \n\nhp \n -.74\n . \n x\n \n\ndisp\n -.77\n .67\n .\n \n\n\n\n\n \n\n# use kableExtra and psych to color significant cells\nlibrary(psych)\nlibrary(kableExtra)\n\ndat <- mtcars[, c(\"vs\", \"hp\", \"gear\")]\n\ncor_fun <- function(dat) {\n # compute correlations and format them\n correlations <- data.frame(cor(dat))\n correlations <- datasummary_correlation_format(correlations, fmt = 2)\n\n # calculate pvalues using the `psych` package\n pvalues <- psych::corr.test(dat)$p\n\n # use `kableExtra::cell_spec` to color significant cells\n for (i in 1:nrow(correlations)) {\n for (j in 1:ncol(correlations)) {\n if (pvalues[i, j] < 0.05 && i != j) {\n correlations[i, j] <- cell_spec(correlations[i, j], background = \"pink\")\n }\n }\n }\n return(correlations)\n}\n\n# The `escape=FALSE` is important here!\ndatasummary_correlation(dat, method = cor_fun, escape = FALSE)\n\n \n\n \n \n\ntinytable_mq9s8yxqc31x4l6kzddz\n\n\n \n\n \n vs\n hp\n gear\n \n\n\nvs \n 1.00 \n -.72\n .21 \n \n\nhp \n -.72\n 1.00 \n -.13\n \n\ngear\n .21 \n -.13 \n 1.00", + "text": "The names of the variables displayed in the correlation table are the names of the columns in the data. You can rename those columns (with or without spaces) to produce a table of human-readable variables. See the Details and Examples sections below, and the vignettes on the modelsummary website:\n\n\nhttps://modelsummary.com/\n\n\nhttps://modelsummary.com/articles/datasummary.html\n\n\ndatasummary_correlation(\n data,\n output = \"default\",\n method = \"pearson\",\n fmt = 2,\n align = NULL,\n add_rows = NULL,\n add_columns = NULL,\n title = NULL,\n notes = NULL,\n escape = TRUE,\n ...\n)\n\n\n\n\n\ndata\n\n\nA data.frame (or tibble)\n\n\n\n\noutput\n\n\nfilename or object type (character string)\n\n\nSupported filename extensions: .docx, .html, .tex, .md, .txt, .csv, .xlsx, .png, .jpg\n\n\nSupported object types: \"default\", \"html\", \"markdown\", \"latex\", \"latex_tabular\", \"typst\", \"data.frame\", \"tinytable\", \"gt\", \"kableExtra\", \"huxtable\", \"flextable\", \"DT\", \"jupyter\". The \"modelsummary_list\" value produces a lightweight object which can be saved and fed back to the modelsummary function.\n\n\nThe \"default\" output format can be set to \"tinytable\", \"kableExtra\", \"gt\", \"flextable\", \"huxtable\", \"DT\", or \"markdown\"\n\n\nIf the user does not choose a default value, the packages listed above are tried in sequence.\n\n\nSession-specific configuration: options(“modelsummary_factory_default” = “gt”)\n\n\nPersistent configuration: config_modelsummary(output = “markdown”)\n\n\n\n\nWarning: Users should not supply a file name to the output argument if they intend to customize the table with external packages. See the ‘Details’ section.\n\n\nLaTeX compilation requires the booktabs and siunitx packages, but siunitx can be disabled or replaced with global options. See the ‘Details’ section.\n\n\n\n\n\n\nmethod\n\n\ncharacter or function\n\n\ncharacter: \"pearson\", \"kendall\", \"spearman\", or \"pearspear\" (Pearson correlations above and Spearman correlations below the diagonal)\n\n\nfunction: takes a data.frame with numeric columns and returns a square matrix or data.frame with unique row.names and colnames corresponding to variable names. Note that the datasummary_correlation_format can often be useful for formatting the output of custom correlation functions.\n\n\n\n\n\n\nfmt\n\n\nhow to format numeric values: integer, user-supplied function, or modelsummary function.\n\n\nInteger: Number of decimal digits\n\n\nUser-supplied functions:\n\n\nAny function which accepts a numeric vector and returns a character vector of the same length.\n\n\n\n\nmodelsummary functions:\n\n\nfmt = fmt_significant(2): Two significant digits (at the term-level)\n\n\nfmt = fmt_sprintf(“%.3f”): See ?sprintf\n\n\nfmt = fmt_identity(): unformatted raw values\n\n\n\n\n\n\n\n\nalign\n\n\nA string with a number of characters equal to the number of columns in the table (e.g., align = “lcc”). Valid characters: l, c, r, d.\n\n\n\"l\": left-aligned column\n\n\n\"c\": centered column\n\n\n\"r\": right-aligned column\n\n\n\"d\": dot-aligned column. For LaTeX/PDF output, this option requires at least version 3.0.25 of the siunitx LaTeX package. See the LaTeX preamble help section below for commands to insert in your LaTeX preamble.\n\n\n\n\n\n\nadd_rows\n\n\na data.frame (or tibble) with the same number of columns as your main table. By default, rows are appended to the bottom of the table. You can define a \"position\" attribute of integers to set the row positions. See Examples section below.\n\n\n\n\nadd_columns\n\n\na data.frame (or tibble) with the same number of rows as your main table.\n\n\n\n\ntitle\n\n\nstring\n\n\n\n\nnotes\n\n\nlist or vector of notes to append to the bottom of the table.\n\n\n\n\nescape\n\n\nboolean TRUE escapes or substitutes LaTeX/HTML characters which could prevent the file from compiling/displaying. TRUE escapes all cells, captions, and notes. Users can have more fine-grained control by setting escape=FALSE and using an external command such as: modelsummary(model, “latex”) |> tinytable::format_tt(tab, j=1:5, escape=TRUE)\n\n\n\n\n…\n\n\nother parameters are passed through to the table-making packages.\n\n\n\nThe behavior of modelsummary can be modified by setting global options. For example:\n\n\noptions(modelsummary_model_labels = “roman”)\n\n\nThe rest of this section describes each of the options above.\n\nThese global option changes the style of the default column headers:\n\n\noptions(modelsummary_model_labels = “roman”)\n\n\noptions(modelsummary_panel_labels = “roman”)\n\n\nThe supported styles are: \"model\", \"panel\", \"arabic\", \"letters\", \"roman\", \"(arabic)\", \"(letters)\", \"(roman)\"\nThe panel-specific option is only used when shape=“rbind”\n\nmodelsummary supports 6 table-making packages: tinytable, kableExtra, gt, flextable, huxtable, and DT. Some of these packages have overlapping functionalities. To change the default backend used for a specific file format, you can use ’ the options function:\noptions(modelsummary_factory_html = ‘kableExtra’) options(modelsummary_factory_latex = ‘gt’) options(modelsummary_factory_word = ‘huxtable’) options(modelsummary_factory_png = ‘gt’)\n\nChange the look of tables in an automated and replicable way, using the modelsummary theming functionality. See the vignette: https://modelsummary.com/articles/appearance.html\n\n\nmodelsummary_theme_gt\n\n\nmodelsummary_theme_kableExtra\n\n\nmodelsummary_theme_huxtable\n\n\nmodelsummary_theme_flextable\n\n\nmodelsummary_theme_dataframe\n\n\n\nmodelsummary can use two sets of packages to extract information from statistical models: the easystats family (performance and parameters) and broom. By default, it uses easystats first and then falls back on broom in case of failure. You can change the order of priorities or include goodness-of-fit extracted by both packages by setting:\noptions(modelsummary_get = “easystats”)\noptions(modelsummary_get = “broom”)\noptions(modelsummary_get = “all”)\n\nBy default, LaTeX tables enclose all numeric entries in the command from the siunitx package. To prevent this behavior, or to enclose numbers in dollar signs (for LaTeX math mode), users can call:\noptions(modelsummary_format_numeric_latex = “plain”)\noptions(modelsummary_format_numeric_latex = “mathmode”)\nA similar option can be used to display numerical entries using MathJax in HTML tables:\noptions(modelsummary_format_numeric_html = “mathjax”)\n\nWhen creating LaTeX via the tinytable backend (default in version 2.0.0 and later), it is useful to include the following commands in the LaTeX preamble of your documents. Note that they are added automatically when compiling Rmarkdown or Quarto documents.\n[3]{}\n\n\nlibrary(modelsummary)\n\nlibrary(modelsummary)\n\n# clean variable names (base R)\ndat <- mtcars[, c(\"mpg\", \"hp\")]\ncolnames(dat) <- c(\"Miles / Gallon\", \"Horse Power\")\ndatasummary_correlation(dat)\n\n \n\n \n \n\ntinytable_6uos5z8sgk9bsnoqyd87\n\n\n \n\n \n Miles / Gallon\n Horse Power\n \n\n\nMiles / Gallon\n 1 \n .\n \n\nHorse Power \n -.78\n 1\n \n\n\n\n\n \n\n# clean variable names (tidyverse)\nlibrary(tidyverse)\ndat <- mtcars %>%\n select(`Miles / Gallon` = mpg,\n `Horse Power` = hp)\ndatasummary_correlation(dat)\n\n \n\n \n \n\ntinytable_lirm7rmbmb1bhm3csgcq\n\n\n \n\n \n Miles / Gallon\n Horse Power\n \n\n\nMiles / Gallon\n 1 \n .\n \n\nHorse Power \n -.78\n 1\n \n\n\n\n\n \n\n# alternative methods\ndatasummary_correlation(dat, method = \"pearspear\")\n\n \n\n \n \n\ntinytable_g1h47nvfzs3b4ydipnh2\n\n\n \n\n \n Miles / Gallon\n Horse Power\n \n\n\nMiles / Gallon\n 1 \n -.78\n \n\nHorse Power \n -.89\n 1 \n \n\n\n\n\n \n\n# custom function\ncor_fun <- function(x) cor(x, method = \"kendall\")\ndatasummary_correlation(dat, method = cor_fun)\n\n \n\n \n \n\ntinytable_akw46qppai3kvnvxdcc9\n\n\n \n\n \n Miles / Gallon\n Horse Power\n \n\n\nMiles / Gallon\n 1.00\n -.74\n \n\nHorse Power \n -.74\n 1.00\n \n\n\n\n\n \n\n# rename columns alphabetically and include a footnote for reference\nnote <- sprintf(\"(%s) %s\", letters[1:ncol(dat)], colnames(dat))\nnote <- paste(note, collapse = \"; \")\n\ncolnames(dat) <- sprintf(\"(%s)\", letters[1:ncol(dat)])\n\ndatasummary_correlation(dat, notes = note)\n\n \n\n \n \n\ntinytable_roj4xo4qo0ukg7h53ryb\n\n\n \n\n \n (a)\n (b)\n \n(a) Miles / Gallon; (b) Horse Power\n\n\n(a)\n 1 \n .\n \n\n(b)\n -.78\n 1\n \n\n\n\n\n \n\n# `datasummary_correlation_format`: custom function with formatting\ndat <- mtcars[, c(\"mpg\", \"hp\", \"disp\")]\n\ncor_fun <- function(x) {\n out <- cor(x, method = \"kendall\")\n datasummary_correlation_format(\n out,\n fmt = 2,\n upper_triangle = \"x\",\n diagonal = \".\")\n}\n\ndatasummary_correlation(dat, method = cor_fun)\n\n \n\n \n \n\ntinytable_dtwgcvpkx4t7hz2i19th\n\n\n \n\n \n mpg\n hp\n disp\n \n\n\nmpg \n . \n x \n x\n \n\nhp \n -.74\n . \n x\n \n\ndisp\n -.77\n .67\n .\n \n\n\n\n\n \n\n# use kableExtra and psych to color significant cells\nlibrary(psych)\nlibrary(kableExtra)\n\ndat <- mtcars[, c(\"vs\", \"hp\", \"gear\")]\n\ncor_fun <- function(dat) {\n # compute correlations and format them\n correlations <- data.frame(cor(dat))\n correlations <- datasummary_correlation_format(correlations, fmt = 2)\n\n # calculate pvalues using the `psych` package\n pvalues <- psych::corr.test(dat)$p\n\n # use `kableExtra::cell_spec` to color significant cells\n for (i in 1:nrow(correlations)) {\n for (j in 1:ncol(correlations)) {\n if (pvalues[i, j] < 0.05 && i != j) {\n correlations[i, j] <- cell_spec(correlations[i, j], background = \"pink\")\n }\n }\n }\n return(correlations)\n}\n\n# The `escape=FALSE` is important here!\ndatasummary_correlation(dat, method = cor_fun, escape = FALSE)\n\n \n\n \n \n\ntinytable_aeb5nr6svrb95kerwvmv\n\n\n \n\n \n vs\n hp\n gear\n \n\n\nvs \n 1.00 \n -.72\n .21 \n \n\nhp \n -.72\n 1.00 \n -.13\n \n\ngear\n .21 \n -.13 \n 1.00", "crumbs": [ "Get started", "Functions", @@ -1155,7 +1155,7 @@ "href": "vignettes/modelsummary_extension.html", "title": "Extension and Customization", "section": "", - "text": "library(modelsummary)\n\nUnsupported models: modelsummary_list\n\nThe simplest way to summarize an unsupported model is to create a modelsummary_list object. This approach is super flexible, but it requires manual intervention, and it can become tedious if you need to summarize many models. The next section shows how to add formal support for an unsupported model type.\nA modelsummary_list is a list with two element that conform to the broom package specification: tidy and glance. tidy is a data.frame with at least three columns: term, estimate, and std.error. glance is a data.frame with only a single row, and where each column will be displayed at the bottom of the table in the goodness-of-fit section. Finally, we wrap those two elements in a list and assign it a modelsummary_list class:\n\nti <- data.frame(\n term = c(\"coef1\", \"coef2\", \"coef3\"),\n estimate = 1:3,\n std.error = c(pi, exp(1), sqrt(2)))\n\ngl <- data.frame(\n stat1 = \"blah\",\n stat2 = \"blah blah\")\n\nmod <- list(\n tidy = ti,\n glance = gl)\nclass(mod) <- \"modelsummary_list\"\n\nmodelsummary(mod)\n\n \n\n \n \n\ntinytable_jksl040r3pxtt6k384tx\n\n\n \n\n \n (1)\n \n\n\ncoef1\n 1.000 \n \n\n \n (3.142) \n \n\ncoef2\n 2.000 \n \n\n \n (2.718) \n \n\ncoef3\n 3.000 \n \n\n \n (1.414) \n \n\nstat1\n blah \n \n\nstat2\n blah blah\n \n\n\n\n\n \n\n\nUnsupported models: glance and tidy\n\nmodelsummary relies on two functions from the broom package to extract model information: tidy and glance. If broom doesn’t support the type of model you are trying to summarize, modelsummary won’t support it out of the box. Thankfully, it is extremely easy to add support for most models using custom methods.\nFor example, models produced by the MCMCglmm package are not currently supported by broom. To add support, you simply need to create a tidy and a glance method:\n# load packages and data\nlibrary(modelsummary)\nlibrary(MCMCglmm)\ndata(PlodiaPO)\n\n# add custom functions to extract estimates (tidy) and goodness-of-fit (glance) information\ntidy.MCMCglmm <- function(x, ...) {\n s <- summary(x, ...)\n ret <- data.frame(\n term = row.names(s$solutions),\n estimate = s$solutions[, 1],\n conf.low = s$solutions[, 2],\n conf.high = s$solutions[, 3])\n ret\n}\n\nglance.MCMCglmm <- function(x, ...) {\n ret <- data.frame(\n dic = x$DIC,\n n = nrow(x$X))\n ret\n}\n\n# estimate a simple model\nmodel <- MCMCglmm(PO ~ 1 + plate, random = ~ FSfamily, data = PlodiaPO, verbose=FALSE, pr=TRUE)\n\n# summarize the model\nmodelsummary(model, statistic = 'conf.int')\nThree important things to note.\nFirst, the methods are named tidy.MCMCglmm and glance.MCMCglmm because the model object I am trying to summarize is of class MCMCglmm. You can find the class of a model by running: class(model).\nSecond, both of the methods include the ellipsis ... argument.\nThird, in the example above we used the statistic = 'conf.int' argument. This is because the tidy method produces conf.low and conf.high columns. In most cases, users will define std.error column in their custom tidy methods, so the statistic argument will need to be adjusted.\nIf you create new tidy and glance methods, please consider contributing them to broom so that the rest of the community can benefit from your work: https://github.com/tidymodels/broom\nModifying information: tidy_custom and glance_custom\n\nUsers may want to include more information than is made available by the default extractor function. For example, models produced by the MASS::polr do not produce p values by default, which means that we cannot use the stars=TRUE argument in modelsummary. However, it is possible to extract this information by using the lmtest::coeftest function. To include such custom information, we will define new glance_custom and tidy_custom methods.\nWe begin by estimating a model with the MASS::polr:\n\nlibrary(MASS)\n\nmod_ordinal <- polr(as.ordered(gear) ~ mpg + drat, data = mtcars)\n\nget_estimates(mod_ordinal)\n\n term estimate std.error conf.level conf.low conf.high statistic df.error p.value component s.value group\n1 3|4 13.962948761 4.04107300 0.95 5.6851860 22.2407116 3.45525774 28 0.0017706303 alpha 9.1 \n2 4|5 16.898937342 4.39497069 0.95 7.8962480 25.9016267 3.84506258 28 0.0006356348 alpha 10.6 \n3 mpg -0.008646682 0.09034201 0.95 -0.1916706 0.1708667 -0.09571053 28 0.9244322098 beta 0.1 \n4 drat 3.949431923 1.30665144 0.95 1.6191505 6.8457246 3.02255965 28 0.0053120619 beta 7.6 \n\n\nThe get_estimates function shows that our default extractor does not produce a p.value column. As a result, setting stars=TRUE in modelsummary will produce an error.\nWe know that the MASS::polr produces an object of class polr:\n\nclass(mod_ordinal)\n\n[1] \"polr\"\n\n\nTo extract more (custom) information from a model of this class, we thus define a method called tidy_custom.polr which returns a data.frame with two columns: term and p.value:\n\ntidy_custom.polr <- function(x, ...) {\n s <- lmtest::coeftest(x)\n out <- data.frame(\n term = row.names(s),\n p.value = s[, \"Pr(>|t|)\"])\n out\n}\n\nWhen this method is defined, modelsummary can automatically extract p values from all models of this class, and will now work properly with stars=TRUE:\n\nmodelsummary(mod_ordinal, stars = TRUE)\n\n \n\n \n \n\ntinytable_5twluwvpajnufzz0zw3n\n\n\n \n\n \n (1)\n \n+ p \n\n\n3|4 \n 13.963** \n \n\n \n (4.041) \n \n\n4|5 \n 16.899***\n \n\n \n (4.395) \n \n\nmpg \n -0.009 \n \n\n \n (0.090) \n \n\ndrat \n 3.949** \n \n\n \n (1.307) \n \n\nNum.Obs.\n 32 \n \n\nAIC \n 51.1 \n \n\nBIC \n 57.0 \n \n\nRMSE \n 3.44 \n \n\n\n\n\n \n\n\nNew information: tidy_custom and glance_custom\n\nSometimes users will want to include information that is not supplied by those functions. A pretty easy way to include extra information is to define new glance_custom and tidy_custom methods. To illustrate, we estimate two linear regression models using the lm function:\n\nlibrary(modelsummary)\n\nmod <- list()\nmod[[1]] <- lm(hp ~ mpg + drat, mtcars)\nmod[[2]] <- lm(wt ~ mpg + drat + am, mtcars)\n\nIn R, the lm function produces models of class “lm”:\n\nclass(mod[[1]])\n\n[1] \"lm\"\n\n\nLet’s say you would like to print the dependent variable for each model of this particular class. All you need to do is define a new method called glance_custom.lm. This method should return a data.frame (or tibble) with 1 row, and 1 column per piece of information you want to display. For example:\n\nglance_custom.lm <- function(x, ...) {\n dv <- as.character(formula(x)[2])\n out <- data.frame(\"DV\" = dv)\n return(out)\n}\n\nNow, let’s customize the body of the table. The vcov argument already allows users to customize uncertainty estimates. But imagine you want to override the coefficient estimates of your “lm” models. Easy! All you need to do is define a tidy_custom.lm method which returns a data.frame (or tibble) with one column called “term” and one column called “estimate”.\nHere, we’ll substitute estimates by an up/down-pointing triangles which represents their signs:\n\ntidy_custom.lm <- function(x, ...) {\n s <- summary(x)$coefficients\n out <- data.frame(\n term = row.names(s),\n estimate = ifelse(s[,1] > 0, '▲', '▼'))\n return(out)\n}\n\nAfter you define the glance_custom and tidy_custom methods, modelsummary will automatically display your customized model information:\n\nmodelsummary(mod)\n\n \n\n \n \n\ntinytable_m5fjx7sp2ezy631papdo\n\n\n \n\n \n (1)\n (2)\n \n\n\n(Intercept)\n ▲ \n ▲ \n \n\n \n (55.415)\n (0.728)\n \n\nmpg \n ▼ \n ▼ \n \n\n \n (1.792) \n (0.019)\n \n\ndrat \n ▲ \n ▼ \n \n\n \n (20.198)\n (0.245)\n \n\nam \n \n ▼ \n \n\n \n \n (0.240)\n \n\nNum.Obs. \n 32 \n 32 \n \n\nR2 \n 0.614 \n 0.803 \n \n\nR2 Adj. \n 0.588 \n 0.782 \n \n\nAIC \n 337.9 \n 46.4 \n \n\nBIC \n 343.7 \n 53.7 \n \n\nLog.Lik. \n -164.940\n -18.201\n \n\nF \n 23.100 \n 38.066 \n \n\nRMSE \n 41.91 \n 0.43 \n \n\nDV \n hp \n wt \n \n\n\n\n\n \n\n\nNote that you can define a std.error column in tidy_custom.lm to replace the uncertainty estimates instead of the coefficients.\nCustomization: New model class\nAn even more fundamental way to customize the output would be to completely bypass modelsummary’s extractor functions by assigning a new class name to your model. For example,\n\n# estimate a linear model\nmod_custom <- lm(hp ~ mpg + drat, mtcars)\n\n# assign it a new class\nclass(mod_custom) <- \"custom\"\n\n# define tidy and glance methods\ntidy.custom <- function(x, ...) {\n data.frame(\n term = names(coef(x)),\n estimate = letters[1:length(coef(x))],\n std.error = seq_along(coef(x))\n )\n}\n\nglance.custom <- function(x, ...) {\n data.frame(\n \"Model\" = \"Custom\",\n \"nobs\" = stats:::nobs.lm(x)\n )\n}\n\n# summarize\nmodelsummary(mod_custom)\n\n \n\n \n \n\ntinytable_h4l0flseibxj7c69crx7\n\n\n \n\n \n (1)\n \n\n\n(Intercept)\n a \n \n\n \n (1.000)\n \n\nmpg \n b \n \n\n \n (2.000)\n \n\ndrat \n c \n \n\n \n (3.000)\n \n\nNum.Obs. \n 32 \n \n\nModel \n Custom \n \n\n\n\n\n \n\n\nWarning: When defining new tidy and glance methods, it is important to include an ellipsis argument (...).\nNote that in the glance.custom() method, we called stats:::nobs.lm() instead of the default stats::nobs() method, because the latter know does not know where to dispatch models of our new “custom” class. Being more explicit solves the problem.\nAn alternative would be to set a new class that inherits from the previous one, and to use a global option to set broom as the default extractor function (otherwise modelsummary will use its standard lm extractors by inheritance):\n\noptions(modelsummary_get = \"broom\")\nclass(mod_custom) <- c(\"custom\", \"lm\")\n\nCustomization: modelsummary_list\n\nAnother flexible way to customize model output is to use output = \"modelsummary_list\". With this output option, modelsummary() returns a list with two elements: tidy contains parameter estimates, standard errors, etc., and glance contains model statistics such as the AIC. For example,\n\nmod <- lm(hp ~ mpg + drat, mtcars)\nmod_list <- modelsummary(mod, output = \"modelsummary_list\")\nmod_list$tidy\n\n term estimate std.error statistic df.error p.value s.value group conf.low conf.high\n1 (Intercept) 278.515455 55.414866 5.0260061 29 2.359726e-05 15.4 NA NA\n2 mpg -9.985499 1.791837 -5.5727709 29 5.172030e-06 17.6 NA NA\n3 drat 19.125752 20.197756 0.9469246 29 3.515013e-01 1.5 NA NA\n\nmod_list$glance\n\n aic bic r.squared adj.r.squared rmse nobs F logLik\n1 337.8809 343.7438 0.6143611 0.5877653 41.90687 32 23.09994 -164.9404\n\n\nBoth tidy and glance can now be customized, and the updated model can be passed back to modelsummary using modelsummary(mod_list). All information that is displayed in the table is contained in mod_list, so this pattern allows for very flexible adjustments of output tables.\nA useful example for this pattern concerns mixed models using lme4. Assume we want to compare the effect of using different degrees-of-freedom adjustments on the significance of the coefficients. The models have identical parameter estimates, standard errors, and model fit statistics - we only want to change the p-values. We use the parameters package to compute the adjusted p-values.\n\nlibrary(\"lme4\")\nmod <- lmer(mpg ~ drat + (1 | am), data = mtcars)\nmod_list <- modelsummary(mod, output = \"modelsummary_list\", effects = \"fixed\")\n# create a copy, where we'll change the p-values\nmod_list_kenward <- as.list(mod_list)\nmod_list_kenward$tidy$p.value <- parameters::p_value_kenward(mod)$p\n\nmodelsummary(list(\"Wald\" = mod_list, \"Kenward\" = mod_list_kenward), \n statistic = \"{std.error} ({p.value}) {stars}\")\n\n \n\n \n \n\ntinytable_utn1rzbcwfztkd0j2ikt\n\n\n \n\n \n Wald\n Kenward\n \n\n\n(Intercept)\n -5.159 \n -5.159 \n \n\n \n 6.409 (0.428) \n 6.409 (0.680) \n \n\ndrat \n 7.045 \n 7.045 \n \n\n \n 1.736 (\n \n1.736 (0.086) +\n \n\nNum.Obs. \n 32 \n 32 \n \n\nR2 Marg. \n 0.402 \n 0.402 \n \n\nR2 Cond. \n 0.440 \n 0.440 \n \n\nAIC \n 188.7 \n 188.7 \n \n\nBIC \n 194.6 \n 194.6 \n \n\nICC \n 0.1 \n 0.1 \n \n\nRMSE \n 4.28 \n 4.28", + "text": "library(modelsummary)\n\nUnsupported models: modelsummary_list\n\nThe simplest way to summarize an unsupported model is to create a modelsummary_list object. This approach is super flexible, but it requires manual intervention, and it can become tedious if you need to summarize many models. The next section shows how to add formal support for an unsupported model type.\nA modelsummary_list is a list with two element that conform to the broom package specification: tidy and glance. tidy is a data.frame with at least three columns: term, estimate, and std.error. glance is a data.frame with only a single row, and where each column will be displayed at the bottom of the table in the goodness-of-fit section. Finally, we wrap those two elements in a list and assign it a modelsummary_list class:\n\nti <- data.frame(\n term = c(\"coef1\", \"coef2\", \"coef3\"),\n estimate = 1:3,\n std.error = c(pi, exp(1), sqrt(2)))\n\ngl <- data.frame(\n stat1 = \"blah\",\n stat2 = \"blah blah\")\n\nmod <- list(\n tidy = ti,\n glance = gl)\nclass(mod) <- \"modelsummary_list\"\n\nmodelsummary(mod)\n\n \n\n \n \n\ntinytable_urqnt8gm8dgtlm7xko2e\n\n\n \n\n \n (1)\n \n\n\ncoef1\n 1.000 \n \n\n \n (3.142) \n \n\ncoef2\n 2.000 \n \n\n \n (2.718) \n \n\ncoef3\n 3.000 \n \n\n \n (1.414) \n \n\nstat1\n blah \n \n\nstat2\n blah blah\n \n\n\n\n\n \n\n\nUnsupported models: glance and tidy\n\nmodelsummary relies on two functions from the broom package to extract model information: tidy and glance. If broom doesn’t support the type of model you are trying to summarize, modelsummary won’t support it out of the box. Thankfully, it is extremely easy to add support for most models using custom methods.\nFor example, models produced by the MCMCglmm package are not currently supported by broom. To add support, you simply need to create a tidy and a glance method:\n# load packages and data\nlibrary(modelsummary)\nlibrary(MCMCglmm)\ndata(PlodiaPO)\n\n# add custom functions to extract estimates (tidy) and goodness-of-fit (glance) information\ntidy.MCMCglmm <- function(x, ...) {\n s <- summary(x, ...)\n ret <- data.frame(\n term = row.names(s$solutions),\n estimate = s$solutions[, 1],\n conf.low = s$solutions[, 2],\n conf.high = s$solutions[, 3])\n ret\n}\n\nglance.MCMCglmm <- function(x, ...) {\n ret <- data.frame(\n dic = x$DIC,\n n = nrow(x$X))\n ret\n}\n\n# estimate a simple model\nmodel <- MCMCglmm(PO ~ 1 + plate, random = ~ FSfamily, data = PlodiaPO, verbose=FALSE, pr=TRUE)\n\n# summarize the model\nmodelsummary(model, statistic = 'conf.int')\nThree important things to note.\nFirst, the methods are named tidy.MCMCglmm and glance.MCMCglmm because the model object I am trying to summarize is of class MCMCglmm. You can find the class of a model by running: class(model).\nSecond, both of the methods include the ellipsis ... argument.\nThird, in the example above we used the statistic = 'conf.int' argument. This is because the tidy method produces conf.low and conf.high columns. In most cases, users will define std.error column in their custom tidy methods, so the statistic argument will need to be adjusted.\nIf you create new tidy and glance methods, please consider contributing them to broom so that the rest of the community can benefit from your work: https://github.com/tidymodels/broom\nModifying information: tidy_custom and glance_custom\n\nUsers may want to include more information than is made available by the default extractor function. For example, models produced by the MASS::polr do not produce p values by default, which means that we cannot use the stars=TRUE argument in modelsummary. However, it is possible to extract this information by using the lmtest::coeftest function. To include such custom information, we will define new glance_custom and tidy_custom methods.\nWe begin by estimating a model with the MASS::polr:\n\nlibrary(MASS)\n\nmod_ordinal <- polr(as.ordered(gear) ~ mpg + drat, data = mtcars)\n\nget_estimates(mod_ordinal)\n\n term estimate std.error conf.level conf.low conf.high statistic df.error p.value component s.value group\n1 3|4 13.962948761 4.04107300 0.95 5.6851860 22.2407116 3.45525774 28 0.0017706303 alpha 9.1 \n2 4|5 16.898937342 4.39497069 0.95 7.8962480 25.9016267 3.84506258 28 0.0006356348 alpha 10.6 \n3 mpg -0.008646682 0.09034201 0.95 -0.1916706 0.1708667 -0.09571053 28 0.9244322098 beta 0.1 \n4 drat 3.949431923 1.30665144 0.95 1.6191505 6.8457246 3.02255965 28 0.0053120619 beta 7.6 \n\n\nThe get_estimates function shows that our default extractor does not produce a p.value column. As a result, setting stars=TRUE in modelsummary will produce an error.\nWe know that the MASS::polr produces an object of class polr:\n\nclass(mod_ordinal)\n\n[1] \"polr\"\n\n\nTo extract more (custom) information from a model of this class, we thus define a method called tidy_custom.polr which returns a data.frame with two columns: term and p.value:\n\ntidy_custom.polr <- function(x, ...) {\n s <- lmtest::coeftest(x)\n out <- data.frame(\n term = row.names(s),\n p.value = s[, \"Pr(>|t|)\"])\n out\n}\n\nWhen this method is defined, modelsummary can automatically extract p values from all models of this class, and will now work properly with stars=TRUE:\n\nmodelsummary(mod_ordinal, stars = TRUE)\n\n \n\n \n \n\ntinytable_ab02b4lvfzpm7ypayfvc\n\n\n \n\n \n (1)\n \n+ p \n\n\n3|4 \n 13.963** \n \n\n \n (4.041) \n \n\n4|5 \n 16.899***\n \n\n \n (4.395) \n \n\nmpg \n -0.009 \n \n\n \n (0.090) \n \n\ndrat \n 3.949** \n \n\n \n (1.307) \n \n\nNum.Obs.\n 32 \n \n\nAIC \n 51.1 \n \n\nBIC \n 57.0 \n \n\nRMSE \n 3.44 \n \n\n\n\n\n \n\n\nNew information: tidy_custom and glance_custom\n\nSometimes users will want to include information that is not supplied by those functions. A pretty easy way to include extra information is to define new glance_custom and tidy_custom methods. To illustrate, we estimate two linear regression models using the lm function:\n\nlibrary(modelsummary)\n\nmod <- list()\nmod[[1]] <- lm(hp ~ mpg + drat, mtcars)\nmod[[2]] <- lm(wt ~ mpg + drat + am, mtcars)\n\nIn R, the lm function produces models of class “lm”:\n\nclass(mod[[1]])\n\n[1] \"lm\"\n\n\nLet’s say you would like to print the dependent variable for each model of this particular class. All you need to do is define a new method called glance_custom.lm. This method should return a data.frame (or tibble) with 1 row, and 1 column per piece of information you want to display. For example:\n\nglance_custom.lm <- function(x, ...) {\n dv <- as.character(formula(x)[2])\n out <- data.frame(\"DV\" = dv)\n return(out)\n}\n\nNow, let’s customize the body of the table. The vcov argument already allows users to customize uncertainty estimates. But imagine you want to override the coefficient estimates of your “lm” models. Easy! All you need to do is define a tidy_custom.lm method which returns a data.frame (or tibble) with one column called “term” and one column called “estimate”.\nHere, we’ll substitute estimates by an up/down-pointing triangles which represents their signs:\n\ntidy_custom.lm <- function(x, ...) {\n s <- summary(x)$coefficients\n out <- data.frame(\n term = row.names(s),\n estimate = ifelse(s[,1] > 0, '▲', '▼'))\n return(out)\n}\n\nAfter you define the glance_custom and tidy_custom methods, modelsummary will automatically display your customized model information:\n\nmodelsummary(mod)\n\n \n\n \n \n\ntinytable_sccr6fhs89g8wlpjbn8w\n\n\n \n\n \n (1)\n (2)\n \n\n\n(Intercept)\n ▲ \n ▲ \n \n\n \n (55.415)\n (0.728)\n \n\nmpg \n ▼ \n ▼ \n \n\n \n (1.792) \n (0.019)\n \n\ndrat \n ▲ \n ▼ \n \n\n \n (20.198)\n (0.245)\n \n\nam \n \n ▼ \n \n\n \n \n (0.240)\n \n\nNum.Obs. \n 32 \n 32 \n \n\nR2 \n 0.614 \n 0.803 \n \n\nR2 Adj. \n 0.588 \n 0.782 \n \n\nAIC \n 337.9 \n 46.4 \n \n\nBIC \n 343.7 \n 53.7 \n \n\nLog.Lik. \n -164.940\n -18.201\n \n\nF \n 23.100 \n 38.066 \n \n\nRMSE \n 41.91 \n 0.43 \n \n\nDV \n hp \n wt \n \n\n\n\n\n \n\n\nNote that you can define a std.error column in tidy_custom.lm to replace the uncertainty estimates instead of the coefficients.\nCustomization: New model class\nAn even more fundamental way to customize the output would be to completely bypass modelsummary’s extractor functions by assigning a new class name to your model. For example,\n\n# estimate a linear model\nmod_custom <- lm(hp ~ mpg + drat, mtcars)\n\n# assign it a new class\nclass(mod_custom) <- \"custom\"\n\n# define tidy and glance methods\ntidy.custom <- function(x, ...) {\n data.frame(\n term = names(coef(x)),\n estimate = letters[1:length(coef(x))],\n std.error = seq_along(coef(x))\n )\n}\n\nglance.custom <- function(x, ...) {\n data.frame(\n \"Model\" = \"Custom\",\n \"nobs\" = stats:::nobs.lm(x)\n )\n}\n\n# summarize\nmodelsummary(mod_custom)\n\n \n\n \n \n\ntinytable_v5tlkoopaevlgnaetdns\n\n\n \n\n \n (1)\n \n\n\n(Intercept)\n a \n \n\n \n (1.000)\n \n\nmpg \n b \n \n\n \n (2.000)\n \n\ndrat \n c \n \n\n \n (3.000)\n \n\nNum.Obs. \n 32 \n \n\nModel \n Custom \n \n\n\n\n\n \n\n\nWarning: When defining new tidy and glance methods, it is important to include an ellipsis argument (...).\nNote that in the glance.custom() method, we called stats:::nobs.lm() instead of the default stats::nobs() method, because the latter know does not know where to dispatch models of our new “custom” class. Being more explicit solves the problem.\nAn alternative would be to set a new class that inherits from the previous one, and to use a global option to set broom as the default extractor function (otherwise modelsummary will use its standard lm extractors by inheritance):\n\noptions(modelsummary_get = \"broom\")\nclass(mod_custom) <- c(\"custom\", \"lm\")\n\nCustomization: modelsummary_list\n\nAnother flexible way to customize model output is to use output = \"modelsummary_list\". With this output option, modelsummary() returns a list with two elements: tidy contains parameter estimates, standard errors, etc., and glance contains model statistics such as the AIC. For example,\n\nmod <- lm(hp ~ mpg + drat, mtcars)\nmod_list <- modelsummary(mod, output = \"modelsummary_list\")\nmod_list$tidy\n\n term estimate std.error statistic df.error p.value s.value group conf.low conf.high\n1 (Intercept) 278.515455 55.414866 5.0260061 29 2.359726e-05 15.4 NA NA\n2 mpg -9.985499 1.791837 -5.5727709 29 5.172030e-06 17.6 NA NA\n3 drat 19.125752 20.197756 0.9469246 29 3.515013e-01 1.5 NA NA\n\nmod_list$glance\n\n aic bic r.squared adj.r.squared rmse nobs F logLik\n1 337.8809 343.7438 0.6143611 0.5877653 41.90687 32 23.09994 -164.9404\n\n\nBoth tidy and glance can now be customized, and the updated model can be passed back to modelsummary using modelsummary(mod_list). All information that is displayed in the table is contained in mod_list, so this pattern allows for very flexible adjustments of output tables.\nA useful example for this pattern concerns mixed models using lme4. Assume we want to compare the effect of using different degrees-of-freedom adjustments on the significance of the coefficients. The models have identical parameter estimates, standard errors, and model fit statistics - we only want to change the p-values. We use the parameters package to compute the adjusted p-values.\n\nlibrary(\"lme4\")\nmod <- lmer(mpg ~ drat + (1 | am), data = mtcars)\nmod_list <- modelsummary(mod, output = \"modelsummary_list\", effects = \"fixed\")\n# create a copy, where we'll change the p-values\nmod_list_kenward <- as.list(mod_list)\nmod_list_kenward$tidy$p.value <- parameters::p_value_kenward(mod)$p\n\nmodelsummary(list(\"Wald\" = mod_list, \"Kenward\" = mod_list_kenward), \n statistic = \"{std.error} ({p.value}) {stars}\")\n\n \n\n \n \n\ntinytable_ua5gn2kfm4t1cyiowe8f\n\n\n \n\n \n Wald\n Kenward\n \n\n\n(Intercept)\n -5.159 \n -5.159 \n \n\n \n 6.409 (0.428) \n 6.409 (0.680) \n \n\ndrat \n 7.045 \n 7.045 \n \n\n \n 1.736 (\n \n1.736 (0.086) +\n \n\nNum.Obs. \n 32 \n 32 \n \n\nR2 Marg. \n 0.402 \n 0.402 \n \n\nR2 Cond. \n 0.440 \n 0.440 \n \n\nAIC \n 188.7 \n 188.7 \n \n\nBIC \n 194.6 \n 194.6 \n \n\nICC \n 0.1 \n 0.1 \n \n\nRMSE \n 4.28 \n 4.28", "crumbs": [ "Get started", "Extension and Customization" @@ -1166,7 +1166,7 @@ "href": "vignettes/modelsummary.html", "title": "Model Summaries", "section": "", - "text": "modelsummary includes a powerful set of utilities to customize the information displayed in your model summary tables. You can easily rename, reorder, subset or omit parameter estimates; choose the set of goodness-of-fit statistics to display; display various “robust” standard errors or confidence intervals; add titles, footnotes, or source notes; insert stars or custom characters to indicate levels of statistical significance; or add rows with supplemental information about your models.\nBefore starting, we set modelsummary to use the tinytable package to draw table, and we set a few CSS properties to make tables more display in a more compact format on this website. This step is optional.\nNow, we download data, fit some models, and summarize them in a table using the modelsummary() function:\nlibrary(modelsummary)\n\nurl <- 'https://vincentarelbundock.github.io/Rdatasets/csv/HistData/Guerry.csv'\ndat <- read.csv(url)\n\nmodels <- list(\n \"OLS 1\" = lm(Donations ~ Literacy + Clergy, data = dat),\n \"Poisson\" = glm(Donations ~ Literacy + Commerce, family = poisson, data = dat),\n \"OLS 2\" = lm(Crime_pers ~ Literacy + Clergy, data = dat)\n)\n\nmodelsummary(models)\n\n \n\n \n \n\ntinytable_99h4l9rdsyut9f7et9pf\n\n\n \n\n \n OLS 1\n Poisson\n OLS 2\n \n\n\n(Intercept)\n 7948.667 \n 8.241 \n 16259.384 \n \n\n \n (2078.276)\n (0.006) \n (2611.140)\n \n\nLiteracy \n -39.121 \n 0.003 \n 3.680 \n \n\n \n (37.052) \n (0.000) \n (46.552) \n \n\nClergy \n 15.257 \n \n 77.148 \n \n\n \n (25.735) \n \n (32.334) \n \n\nCommerce \n \n 0.011 \n \n \n\n \n \n (0.000) \n \n \n\nNum.Obs. \n 86 \n 86 \n 86 \n \n\nR2 \n 0.020 \n \n 0.065 \n \n\nR2 Adj. \n -0.003 \n \n 0.043 \n \n\nAIC \n 1740.8 \n 274160.8 \n 1780.0 \n \n\nBIC \n 1750.6 \n 274168.2 \n 1789.9 \n \n\nLog.Lik. \n -866.392 \n -137077.401\n -886.021 \n \n\nF \n 0.866 \n 18294.559 \n 2.903 \n \n\nRMSE \n 5740.99 \n 5491.61 \n 7212.97", + "text": "modelsummary includes a powerful set of utilities to customize the information displayed in your model summary tables. You can easily rename, reorder, subset or omit parameter estimates; choose the set of goodness-of-fit statistics to display; display various “robust” standard errors or confidence intervals; add titles, footnotes, or source notes; insert stars or custom characters to indicate levels of statistical significance; or add rows with supplemental information about your models.\nBefore starting, we set modelsummary to use the tinytable package to draw table, and we set a few CSS properties to make tables more display in a more compact format on this website. This step is optional.\nNow, we download data, fit some models, and summarize them in a table using the modelsummary() function:\nlibrary(modelsummary)\n\nurl <- 'https://vincentarelbundock.github.io/Rdatasets/csv/HistData/Guerry.csv'\ndat <- read.csv(url)\n\nmodels <- list(\n \"OLS 1\" = lm(Donations ~ Literacy + Clergy, data = dat),\n \"Poisson\" = glm(Donations ~ Literacy + Commerce, family = poisson, data = dat),\n \"OLS 2\" = lm(Crime_pers ~ Literacy + Clergy, data = dat)\n)\n\nmodelsummary(models)\n\n \n\n \n \n\ntinytable_85prb6brv9r2i92zsojz\n\n\n \n\n \n OLS 1\n Poisson\n OLS 2\n \n\n\n(Intercept)\n 7948.667 \n 8.241 \n 16259.384 \n \n\n \n (2078.276)\n (0.006) \n (2611.140)\n \n\nLiteracy \n -39.121 \n 0.003 \n 3.680 \n \n\n \n (37.052) \n (0.000) \n (46.552) \n \n\nClergy \n 15.257 \n \n 77.148 \n \n\n \n (25.735) \n \n (32.334) \n \n\nCommerce \n \n 0.011 \n \n \n\n \n \n (0.000) \n \n \n\nNum.Obs. \n 86 \n 86 \n 86 \n \n\nR2 \n 0.020 \n \n 0.065 \n \n\nR2 Adj. \n -0.003 \n \n 0.043 \n \n\nAIC \n 1740.8 \n 274160.8 \n 1780.0 \n \n\nBIC \n 1750.6 \n 274168.2 \n 1789.9 \n \n\nLog.Lik. \n -866.392 \n -137077.401\n -886.021 \n \n\nF \n 0.866 \n 18294.559 \n 2.903 \n \n\nRMSE \n 5740.99 \n 5491.61 \n 7212.97", "crumbs": [ "Get started", "Model Summaries" @@ -1177,7 +1177,7 @@ "href": "vignettes/modelsummary.html#formula", "title": "Model Summaries", "section": "Formula", - "text": "Formula\nThe left side of the formula represents the rows and the right side represents the columns. The default formula is term + statistic ~ model:\n\nm <- list(\n lm(mpg ~ hp, data = mtcars),\n lm(mpg ~ hp + drat, data = mtcars))\n\nmodelsummary(m, shape = term + statistic ~ model, gof_map = NA)\n\n \n\n \n \n\ntinytable_dbt1j652k5dsry1dv6vw\n\n\n \n\n \n (1)\n (2)\n \n\n\n(Intercept)\n 30.099 \n 10.790 \n \n\n \n (1.634)\n (5.078)\n \n\nhp \n -0.068 \n -0.052 \n \n\n \n (0.010)\n (0.009)\n \n\ndrat \n \n 4.698 \n \n\n \n \n (1.192)\n \n\n\n\n\n \n\n\nWe can display statistics horizontally with:\n\nmodelsummary(m,\n shape = term ~ model + statistic,\n statistic = \"conf.int\",\n gof_map = NA)\n\n \n\n \n \n\ntinytable_6wq9xs0pmvbqoj2c9917\n\n\n \n\n\n \n(1)\n(2)\n\n\n \n Est.\n 2.5 %\n 97.5 %\n Est.\n 2.5 %\n 97.5 %\n \n\n\n\n(Intercept)\n 30.099\n 26.762\n 33.436\n 10.790\n 0.405 \n 21.175\n \n\nhp \n -0.068\n -0.089\n -0.048\n -0.052\n -0.071\n -0.033\n \n\ndrat \n \n \n \n 4.698 \n 2.261 \n 7.135 \n \n\n\n\n\n \n\n\nThe order of terms in the formula determines the order of headers in the table.\n\nmodelsummary(m,\n shape = term ~ statistic + model,\n statistic = \"conf.int\",\n gof_map = NA)\n\n \n\n \n \n\ntinytable_y8gy4u2z9y6uu125wr19\n\n\n \n\n\n \nEst.\n2.5 %\n97.5 %\n\n\n \n (1)\n (2)\n (1)\n (2)\n (1)\n (2)\n \n\n\n\n(Intercept)\n 30.099\n 10.790\n 26.762\n 0.405 \n 33.436\n 21.175\n \n\nhp \n -0.068\n -0.052\n -0.089\n -0.071\n -0.048\n -0.033\n \n\ndrat \n \n 4.698 \n \n 2.261 \n \n 7.135 \n \n\n\n\n\n \n\n\nshape does partial matching and will try to fill-in incomplete formulas:\n\nmodelsummary(m, shape = ~ statistic)\n\nSome models like multinomial logit or GAMLSS produce “grouped” parameter estimates. To display these groups, we can include a group identifier in the shape formula. This group identifier must be one of the column names produced by get_estimates(model). For example, in models produced by nnet::multinom, the group identifier is called “response”:\n\nlibrary(nnet)\n\ndat_multinom <- mtcars\ndat_multinom$cyl <- sprintf(\"Cyl: %s\", dat_multinom$cyl)\n\nmod <- list(\n nnet::multinom(cyl ~ mpg, data = dat_multinom, trace = FALSE),\n nnet::multinom(cyl ~ mpg + drat, data = dat_multinom, trace = FALSE))\n\nget_estimates(mod[[1]])\n\n term estimate std.error conf.level conf.low conf.high statistic df.error p.value response s.value group\n1 (Intercept) 47.252432 34.975171 0.95 -21.2976435 115.8025065 1.351028 Inf 0.17668650 Cyl: 6 2.5 \n2 mpg -2.205418 1.637963 0.95 -5.4157653 1.0049299 -1.346440 Inf 0.17816078 Cyl: 6 2.5 \n3 (Intercept) 72.440246 37.175162 0.95 -0.4217332 145.3022247 1.948619 Inf 0.05134088 Cyl: 8 4.3 \n4 mpg -3.579991 1.774693 0.95 -7.0583242 -0.1016573 -2.017246 Inf 0.04366989 Cyl: 8 4.5 \n\n\nTo summarize the results, we can type:\n\n# modelsummary(mod, shape = term + response ~ statistic)\n\nThe terms of the shape formula above can of course be rearranged to reshape the table. For example:\n\nmodelsummary(mod, shape = model + term ~ response)\n\n \n\n \n \n\ntinytable_acr2zvourq9zwecvqt70\n\n\n \n\n \n \n Cyl: 6\n Cyl: 8\n \n\n\n(1)\n (Intercept)\n 47.252 \n 72.440 \n \n\n \n \n (34.975)\n (37.175)\n \n\n \n mpg \n -2.205 \n -3.580 \n \n\n \n \n (1.638) \n (1.775) \n \n\n(2)\n (Intercept)\n 89.573 \n 117.971 \n \n\n \n \n (86.884)\n (87.998)\n \n\n \n mpg \n -3.627 \n -4.838 \n \n\n \n \n (3.869) \n (3.915) \n \n\n \n drat \n -3.210 \n -5.028 \n \n\n \n \n (3.810) \n (4.199) \n \n\n\n\n\n \n\n\nWe can combine the term and group identifier columns by inserting an interaction colon : instead of the + in the formula:\n\nlibrary(marginaleffects)\nmod <- glm(am ~ mpg + factor(cyl), family = binomial, data = mtcars)\nmfx <- avg_slopes(mod)\n\nmodelsummary(mfx, shape = term + contrast ~ model)\n\n \n\n \n \n\ntinytable_6jv7kmo5efo0m52s8kuh\n\n\n \n\n \n \n (1)\n \n\n\ncyl \n mean(6) - mean(4)\n 0.097 \n \n\n \n \n (0.166)\n \n\n \n mean(8) - mean(4)\n 0.093 \n \n\n \n \n (0.234)\n \n\nmpg \n mean(dY/dX) \n 0.056 \n \n\n \n \n (0.027)\n \n\nNum.Obs.\n \n 32 \n \n\nAIC \n \n 37.4 \n \n\nBIC \n \n 43.3 \n \n\nLog.Lik.\n \n -14.702\n \n\nF \n \n 2.236 \n \n\nRMSE \n \n 0.39 \n \n\n\n\n\n \n\n\n\nmodelsummary(mfx, shape = term : contrast ~ model)\n\n \n\n \n \n\ntinytable_csdz8yqwhu6ghauoumv4\n\n\n \n\n \n (1)\n \n\n\ncyl mean(6) - mean(4)\n 0.097 \n \n\n \n (0.166)\n \n\ncyl mean(8) - mean(4)\n 0.093 \n \n\n \n (0.234)\n \n\nmpg mean(dY/dX) \n 0.056 \n \n\n \n (0.027)\n \n\nNum.Obs. \n 32 \n \n\nAIC \n 37.4 \n \n\nBIC \n 43.3 \n \n\nLog.Lik. \n -14.702\n \n\nF \n 2.236 \n \n\nRMSE \n 0.39", + "text": "Formula\nThe left side of the formula represents the rows and the right side represents the columns. The default formula is term + statistic ~ model:\n\nm <- list(\n lm(mpg ~ hp, data = mtcars),\n lm(mpg ~ hp + drat, data = mtcars))\n\nmodelsummary(m, shape = term + statistic ~ model, gof_map = NA)\n\n \n\n \n \n\ntinytable_gvxx11zwzlmlxe6n01vc\n\n\n \n\n \n (1)\n (2)\n \n\n\n(Intercept)\n 30.099 \n 10.790 \n \n\n \n (1.634)\n (5.078)\n \n\nhp \n -0.068 \n -0.052 \n \n\n \n (0.010)\n (0.009)\n \n\ndrat \n \n 4.698 \n \n\n \n \n (1.192)\n \n\n\n\n\n \n\n\nWe can display statistics horizontally with:\n\nmodelsummary(m,\n shape = term ~ model + statistic,\n statistic = \"conf.int\",\n gof_map = NA)\n\n \n\n \n \n\ntinytable_era8a74xfo7uu80e5pmz\n\n\n \n\n\n \n(1)\n(2)\n\n\n \n Est.\n 2.5 %\n 97.5 %\n Est.\n 2.5 %\n 97.5 %\n \n\n\n\n(Intercept)\n 30.099\n 26.762\n 33.436\n 10.790\n 0.405 \n 21.175\n \n\nhp \n -0.068\n -0.089\n -0.048\n -0.052\n -0.071\n -0.033\n \n\ndrat \n \n \n \n 4.698 \n 2.261 \n 7.135 \n \n\n\n\n\n \n\n\nThe order of terms in the formula determines the order of headers in the table.\n\nmodelsummary(m,\n shape = term ~ statistic + model,\n statistic = \"conf.int\",\n gof_map = NA)\n\n \n\n \n \n\ntinytable_33cqm5etwh6wf9vstami\n\n\n \n\n\n \nEst.\n2.5 %\n97.5 %\n\n\n \n (1)\n (2)\n (1)\n (2)\n (1)\n (2)\n \n\n\n\n(Intercept)\n 30.099\n 10.790\n 26.762\n 0.405 \n 33.436\n 21.175\n \n\nhp \n -0.068\n -0.052\n -0.089\n -0.071\n -0.048\n -0.033\n \n\ndrat \n \n 4.698 \n \n 2.261 \n \n 7.135 \n \n\n\n\n\n \n\n\nshape does partial matching and will try to fill-in incomplete formulas:\n\nmodelsummary(m, shape = ~ statistic)\n\nSome models like multinomial logit or GAMLSS produce “grouped” parameter estimates. To display these groups, we can include a group identifier in the shape formula. This group identifier must be one of the column names produced by get_estimates(model). For example, in models produced by nnet::multinom, the group identifier is called “response”:\n\nlibrary(nnet)\n\ndat_multinom <- mtcars\ndat_multinom$cyl <- sprintf(\"Cyl: %s\", dat_multinom$cyl)\n\nmod <- list(\n nnet::multinom(cyl ~ mpg, data = dat_multinom, trace = FALSE),\n nnet::multinom(cyl ~ mpg + drat, data = dat_multinom, trace = FALSE))\n\nget_estimates(mod[[1]])\n\n term estimate std.error conf.level conf.low conf.high statistic df.error p.value response s.value group\n1 (Intercept) 47.252432 34.975171 0.95 -21.2976435 115.8025065 1.351028 Inf 0.17668650 Cyl: 6 2.5 \n2 mpg -2.205418 1.637963 0.95 -5.4157653 1.0049299 -1.346440 Inf 0.17816078 Cyl: 6 2.5 \n3 (Intercept) 72.440246 37.175162 0.95 -0.4217332 145.3022247 1.948619 Inf 0.05134088 Cyl: 8 4.3 \n4 mpg -3.579991 1.774693 0.95 -7.0583242 -0.1016573 -2.017246 Inf 0.04366989 Cyl: 8 4.5 \n\n\nTo summarize the results, we can type:\n\n# modelsummary(mod, shape = term + response ~ statistic)\n\nThe terms of the shape formula above can of course be rearranged to reshape the table. For example:\n\nmodelsummary(mod, shape = model + term ~ response)\n\n \n\n \n \n\ntinytable_tivra0mxkzdop8f1yv0o\n\n\n \n\n \n \n Cyl: 6\n Cyl: 8\n \n\n\n(1)\n (Intercept)\n 47.252 \n 72.440 \n \n\n \n \n (34.975)\n (37.175)\n \n\n \n mpg \n -2.205 \n -3.580 \n \n\n \n \n (1.638) \n (1.775) \n \n\n(2)\n (Intercept)\n 89.573 \n 117.971 \n \n\n \n \n (86.884)\n (87.998)\n \n\n \n mpg \n -3.627 \n -4.838 \n \n\n \n \n (3.869) \n (3.915) \n \n\n \n drat \n -3.210 \n -5.028 \n \n\n \n \n (3.810) \n (4.199) \n \n\n\n\n\n \n\n\nWe can combine the term and group identifier columns by inserting an interaction colon : instead of the + in the formula:\n\nlibrary(marginaleffects)\nmod <- glm(am ~ mpg + factor(cyl), family = binomial, data = mtcars)\nmfx <- avg_slopes(mod)\n\nmodelsummary(mfx, shape = term + contrast ~ model)\n\n \n\n \n \n\ntinytable_csw4aot1onqmeqb2wa7c\n\n\n \n\n \n \n (1)\n \n\n\ncyl \n mean(6) - mean(4)\n 0.097 \n \n\n \n \n (0.166)\n \n\n \n mean(8) - mean(4)\n 0.093 \n \n\n \n \n (0.234)\n \n\nmpg \n mean(dY/dX) \n 0.056 \n \n\n \n \n (0.027)\n \n\nNum.Obs.\n \n 32 \n \n\nAIC \n \n 37.4 \n \n\nBIC \n \n 43.3 \n \n\nLog.Lik.\n \n -14.702\n \n\nF \n \n 2.236 \n \n\nRMSE \n \n 0.39 \n \n\n\n\n\n \n\n\n\nmodelsummary(mfx, shape = term : contrast ~ model)\n\n \n\n \n \n\ntinytable_2fqs6dihbm72q4yk1im4\n\n\n \n\n \n (1)\n \n\n\ncyl mean(6) - mean(4)\n 0.097 \n \n\n \n (0.166)\n \n\ncyl mean(8) - mean(4)\n 0.093 \n \n\n \n (0.234)\n \n\nmpg mean(dY/dX) \n 0.056 \n \n\n \n (0.027)\n \n\nNum.Obs. \n 32 \n \n\nAIC \n 37.4 \n \n\nBIC \n 43.3 \n \n\nLog.Lik. \n -14.702\n \n\nF \n 2.236 \n \n\nRMSE \n 0.39", "crumbs": [ "Get started", "Model Summaries" @@ -1188,7 +1188,7 @@ "href": "vignettes/modelsummary.html#string-rbind-or-rcollapse-panels-of-models-in-stacked-regression-tables", "title": "Model Summaries", "section": "String (“rbind” or “rcollapse”): Panels of models in stacked regression tables", - "text": "String (“rbind” or “rcollapse”): Panels of models in stacked regression tables\nNote: The code in this section requires version 1.3.0 or the development version of modelsummary. See the website for installation instructions.\nThis section shows how to “stack/bind” multiple regression tables on top of one another, to display the results several models side-by-side and top-to-bottom. For example, imagine that we want to present 4 different models, half of which are estimated using a different outcome variable. When using modelsummary, we store models in a list. When using modelsummary with shape=\"rbind\" or shape=\"rbind\", we store models in a list of lists:\n\ngm <- c(\"r.squared\", \"nobs\", \"rmse\")\n\npanels <- list(\n list(\n lm(mpg ~ 1, data = mtcars),\n lm(mpg ~ qsec, data = mtcars)\n ),\n list(\n lm(hp ~ 1, data = mtcars),\n lm(hp ~ qsec, data = mtcars)\n )\n)\n\nmodelsummary(\n panels,\n shape = \"rbind\",\n gof_map = gm)\n\n \n\n \n \n\ntinytable_y983v9oe0oiaouncc3kt\n\n\n \n\n \n (1)\n (2)\n \n\n\n(Intercept)\n 20.091 \n -5.114 \n \n\n \n (1.065) \n (10.030)\n \n\nqsec \n \n 1.412 \n \n\n \n \n (0.559) \n \n\nR2 \n 0.000 \n 0.175 \n \n\nNum.Obs. \n 32 \n 32 \n \n\nRMSE \n 5.93 \n 5.39 \n \n\n(Intercept)\n 146.688 \n 631.704 \n \n\n \n (12.120)\n (88.700)\n \n\nqsec \n \n -27.174 \n \n\n \n \n (4.946) \n \n\nR2 \n 0.000 \n 0.502 \n \n\nNum.Obs. \n 32 \n 32 \n \n\nRMSE \n 67.48 \n 47.64 \n \n\n\n\n\n \n\n\nLike with modelsummary(), we can can name models and panels by naming elements of our nested list:\n\npanels <- list(\n \"Outcome: mpg\" = list(\n \"(I)\" = lm(mpg ~ 1, data = mtcars),\n \"(II)\" = lm(mpg ~ qsec, data = mtcars)\n ),\n \"Outcome: hp\" = list(\n \"(I)\" = lm(hp ~ 1, data = mtcars),\n \"(II)\" = lm(hp ~ qsec, data = mtcars)\n )\n)\n\nmodelsummary(\n panels,\n shape = \"rbind\",\n gof_map = gm)\n\n \n\n \n \n\ntinytable_mh0rh4x36zji6idjis27\n\n\n \n\n \n (I)\n (II)\n \n\n\n(Intercept)\n 20.091 \n -5.114 \n \n\n \n (1.065) \n (10.030)\n \n\nqsec \n \n 1.412 \n \n\n \n \n (0.559) \n \n\nR2 \n 0.000 \n 0.175 \n \n\nNum.Obs. \n 32 \n 32 \n \n\nRMSE \n 5.93 \n 5.39 \n \n\n(Intercept)\n 146.688 \n 631.704 \n \n\n \n (12.120)\n (88.700)\n \n\nqsec \n \n -27.174 \n \n\n \n \n (4.946) \n \n\nR2 \n 0.000 \n 0.502 \n \n\nNum.Obs. \n 32 \n 32 \n \n\nRMSE \n 67.48 \n 47.64", + "text": "String (“rbind” or “rcollapse”): Panels of models in stacked regression tables\nNote: The code in this section requires version 1.3.0 or the development version of modelsummary. See the website for installation instructions.\nThis section shows how to “stack/bind” multiple regression tables on top of one another, to display the results several models side-by-side and top-to-bottom. For example, imagine that we want to present 4 different models, half of which are estimated using a different outcome variable. When using modelsummary, we store models in a list. When using modelsummary with shape=\"rbind\" or shape=\"rbind\", we store models in a list of lists:\n\ngm <- c(\"r.squared\", \"nobs\", \"rmse\")\n\npanels <- list(\n list(\n lm(mpg ~ 1, data = mtcars),\n lm(mpg ~ qsec, data = mtcars)\n ),\n list(\n lm(hp ~ 1, data = mtcars),\n lm(hp ~ qsec, data = mtcars)\n )\n)\n\nmodelsummary(\n panels,\n shape = \"rbind\",\n gof_map = gm)\n\n \n\n \n \n\ntinytable_kqnnz69un3lcjdwhqysf\n\n\n \n\n \n (1)\n (2)\n \n\n\n(Intercept)\n 20.091 \n -5.114 \n \n\n \n (1.065) \n (10.030)\n \n\nqsec \n \n 1.412 \n \n\n \n \n (0.559) \n \n\nR2 \n 0.000 \n 0.175 \n \n\nNum.Obs. \n 32 \n 32 \n \n\nRMSE \n 5.93 \n 5.39 \n \n\n(Intercept)\n 146.688 \n 631.704 \n \n\n \n (12.120)\n (88.700)\n \n\nqsec \n \n -27.174 \n \n\n \n \n (4.946) \n \n\nR2 \n 0.000 \n 0.502 \n \n\nNum.Obs. \n 32 \n 32 \n \n\nRMSE \n 67.48 \n 47.64 \n \n\n\n\n\n \n\n\nLike with modelsummary(), we can can name models and panels by naming elements of our nested list:\n\npanels <- list(\n \"Outcome: mpg\" = list(\n \"(I)\" = lm(mpg ~ 1, data = mtcars),\n \"(II)\" = lm(mpg ~ qsec, data = mtcars)\n ),\n \"Outcome: hp\" = list(\n \"(I)\" = lm(hp ~ 1, data = mtcars),\n \"(II)\" = lm(hp ~ qsec, data = mtcars)\n )\n)\n\nmodelsummary(\n panels,\n shape = \"rbind\",\n gof_map = gm)\n\n \n\n \n \n\ntinytable_db6m43uvrfmvm9agdguz\n\n\n \n\n \n (I)\n (II)\n \n\n\n(Intercept)\n 20.091 \n -5.114 \n \n\n \n (1.065) \n (10.030)\n \n\nqsec \n \n 1.412 \n \n\n \n \n (0.559) \n \n\nR2 \n 0.000 \n 0.175 \n \n\nNum.Obs. \n 32 \n 32 \n \n\nRMSE \n 5.93 \n 5.39 \n \n\n(Intercept)\n 146.688 \n 631.704 \n \n\n \n (12.120)\n (88.700)\n \n\nqsec \n \n -27.174 \n \n\n \n \n (4.946) \n \n\nR2 \n 0.000 \n 0.502 \n \n\nNum.Obs. \n 32 \n 32 \n \n\nRMSE \n 67.48 \n 47.64", "crumbs": [ "Get started", "Model Summaries" @@ -1199,7 +1199,7 @@ "href": "vignettes/modelsummary.html#string-cbind-automatic-spanning-column-labels", "title": "Model Summaries", "section": "String (“cbind”): Automatic spanning column labels", - "text": "String (“cbind”): Automatic spanning column labels\nWhen using the default tinytable backend, we can use a named nested list to automatically add spanning column labels to a table:\n\nmodelsummary(panels, shape = \"cbind\")\n\n \n\n \n \n\ntinytable_o7l69z8rk6pj9qinpdy5\n\n\n \n\n\n \nOutcome: mpg\nOutcome: hp\n\n\n \n (I)\n (II)\n (I) \n (II) \n \n\n\n\n(Intercept)\n 20.091 \n -5.114 \n 146.688 \n 631.704 \n \n\n \n (1.065) \n (10.030)\n (12.120)\n (88.700)\n \n\nqsec \n \n 1.412 \n \n -27.174 \n \n\n \n \n (0.559) \n \n (4.946) \n \n\nNum.Obs. \n 32 \n 32 \n 32 \n 32 \n \n\nR2 \n 0.000 \n 0.175 \n 0.000 \n 0.502 \n \n\nR2 Adj. \n 0.000 \n 0.148 \n 0.000 \n 0.485 \n \n\nAIC \n 208.8 \n 204.6 \n 364.4 \n 344.1 \n \n\nBIC \n 211.7 \n 209.0 \n 367.3 \n 348.5 \n \n\nLog.Lik. \n -102.378\n -99.294 \n -180.186\n -169.045\n \n\nF \n \n 6.377 \n \n 30.190 \n \n\nRMSE \n 5.93 \n 5.39 \n 67.48 \n 47.64", + "text": "String (“cbind”): Automatic spanning column labels\nWhen using the default tinytable backend, we can use a named nested list to automatically add spanning column labels to a table:\n\nmodelsummary(panels, shape = \"cbind\")\n\n \n\n \n \n\ntinytable_pxtrux1ja6chraeg3sje\n\n\n \n\n\n \nOutcome: mpg\nOutcome: hp\n\n\n \n (I)\n (II)\n (I) \n (II) \n \n\n\n\n(Intercept)\n 20.091 \n -5.114 \n 146.688 \n 631.704 \n \n\n \n (1.065) \n (10.030)\n (12.120)\n (88.700)\n \n\nqsec \n \n 1.412 \n \n -27.174 \n \n\n \n \n (0.559) \n \n (4.946) \n \n\nNum.Obs. \n 32 \n 32 \n 32 \n 32 \n \n\nR2 \n 0.000 \n 0.175 \n 0.000 \n 0.502 \n \n\nR2 Adj. \n 0.000 \n 0.148 \n 0.000 \n 0.485 \n \n\nAIC \n 208.8 \n 204.6 \n 364.4 \n 344.1 \n \n\nBIC \n 211.7 \n 209.0 \n 367.3 \n 348.5 \n \n\nLog.Lik. \n -102.378\n -99.294 \n -180.186\n -169.045\n \n\nF \n \n 6.377 \n \n 30.190 \n \n\nRMSE \n 5.93 \n 5.39 \n 67.48 \n 47.64", "crumbs": [ "Get started", "Model Summaries" @@ -1210,7 +1210,7 @@ "href": "vignettes/modelsummary.html#renaming-estimates-and-statistics", "title": "Model Summaries", "section": "Renaming estimates and statistics", - "text": "Renaming estimates and statistics\nWhen statistics are displayed in different columns, users may want control over the statistic names. To do so, we specify the estimate and statistic as named vectors:\n\nmod <- lm(mpg ~ factor(cyl), mtcars)\n\nmodelsummary(\n mod, \n estimate = c(\"$\\\\hat{\\\\beta}$\" = \"estimate\"),\n statistic = c(\"$\\\\sigma_{\\\\hat{\\\\beta}}$\" = \"std.error\"),\n shape = term ~ model + statistic)\n\n \n\n \n \n\ntinytable_glh2tfj40vrzbc6l8hzb\n\n\n \n\n\n \n(1)\n\n\n \n $\\hat{\\beta}$\n $\\sigma_{\\hat{\\beta}}$\n \n\n\n\n(Intercept) \n 26.664 \n 0.972\n \n\nfactor(cyl)6\n -6.921 \n 1.558\n \n\nfactor(cyl)8\n -11.564\n 1.299\n \n\nNum.Obs. \n 32 \n \n \n\nR2 \n 0.732 \n \n \n\nR2 Adj. \n 0.714 \n \n \n\nAIC \n 170.6 \n \n \n\nBIC \n 176.4 \n \n \n\nLog.Lik. \n -81.282\n \n \n\nF \n 39.698 \n \n \n\nRMSE \n 3.07 \n \n \n\n\n\n\n \n\n\nfixest\nThe fixest package offers powerful tools to estimate multiple models using a concise syntax. fixest functions are also convenient because they return named lists of models which are easy to subset and manipulate using standard R functions like grepl.\nFor example, to introduce regressors in stepwise fashion, and to estimate models on different subsets of the data, we can do:\n\n# estimate 4 models\nlibrary(fixest)\nmod <- feols(\n c(hp, mpg) ~ csw(qsec, drat) | gear,\n data = mtcars)\n\n# select models with different outcome variables\npanels <- list(\n \"Miles per gallon\" = mod[grepl(\"mpg\", names(mod))],\n \"Horsepower\" = mod[grepl(\"hp\", names(mod))]\n)\n\nmodelsummary(\n panels,\n shape = \"rcollapse\",\n gof_omit = \"IC|R2\")\n\n \n\n \n \n\ntinytable_rx0se4nak144lxodtco6\n\n\n \n\n \n (1)\n (2)\n \n\n\nqsec \n 1.436 \n 1.519 \n \n\n \n (0.594) \n (0.529) \n \n\ndrat \n \n 5.765 \n \n\n \n \n (2.381) \n \n\nRMSE \n 4.03 \n 3.67 \n \n\nqsec \n -22.175 \n -22.676 \n \n\n \n (12.762)\n (13.004)\n \n\ndrat \n \n -35.106 \n \n\n \n \n (28.509)\n \n\nRMSE \n 40.45 \n 39.14 \n \n\nNum.Obs. \n 32 \n 32 \n \n\nStd.Errors\n by: gear\n by: gear\n \n\nFE: gear \n X \n X \n \n\n\n\n\n \n\n\nWe can use all the typical extension systems to add information, such as the mean of the dependent variable:\n\nglance_custom.fixest <- function(x, ...) {\n dv <- insight::get_response(x)\n dv <- sprintf(\"%.2f\", mean(dv, na.rm = TRUE))\n data.table::data.table(`Mean of DV` = dv)\n}\n\nmodelsummary(\n panels,\n shape = \"rcollapse\",\n gof_omit = \"IC|R2\")\n\n \n\n \n \n\ntinytable_avz1abqpghyn15q768ft\n\n\n \n\n \n (1)\n (2)\n \n\n\nqsec \n 1.436 \n 1.519 \n \n\n \n (0.594) \n (0.529) \n \n\ndrat \n \n 5.765 \n \n\n \n \n (2.381) \n \n\nRMSE \n 4.03 \n 3.67 \n \n\nMean of DV\n 20.09 \n 20.09 \n \n\nqsec \n -22.175 \n -22.676 \n \n\n \n (12.762)\n (13.004)\n \n\ndrat \n \n -35.106 \n \n\n \n \n (28.509)\n \n\nRMSE \n 40.45 \n 39.14 \n \n\nMean of DV\n 146.69 \n 146.69 \n \n\nNum.Obs. \n 32 \n 32 \n \n\nStd.Errors\n by: gear\n by: gear\n \n\nFE: gear \n X \n X \n \n\n\n\n\n \n\nrm(\"glance_custom.fixest\")", + "text": "Renaming estimates and statistics\nWhen statistics are displayed in different columns, users may want control over the statistic names. To do so, we specify the estimate and statistic as named vectors:\n\nmod <- lm(mpg ~ factor(cyl), mtcars)\n\nmodelsummary(\n mod, \n estimate = c(\"$\\\\hat{\\\\beta}$\" = \"estimate\"),\n statistic = c(\"$\\\\sigma_{\\\\hat{\\\\beta}}$\" = \"std.error\"),\n shape = term ~ model + statistic)\n\n \n\n \n \n\ntinytable_073hvhj1uymt3tqdoc9q\n\n\n \n\n\n \n(1)\n\n\n \n $\\hat{\\beta}$\n $\\sigma_{\\hat{\\beta}}$\n \n\n\n\n(Intercept) \n 26.664 \n 0.972\n \n\nfactor(cyl)6\n -6.921 \n 1.558\n \n\nfactor(cyl)8\n -11.564\n 1.299\n \n\nNum.Obs. \n 32 \n \n \n\nR2 \n 0.732 \n \n \n\nR2 Adj. \n 0.714 \n \n \n\nAIC \n 170.6 \n \n \n\nBIC \n 176.4 \n \n \n\nLog.Lik. \n -81.282\n \n \n\nF \n 39.698 \n \n \n\nRMSE \n 3.07 \n \n \n\n\n\n\n \n\n\nfixest\nThe fixest package offers powerful tools to estimate multiple models using a concise syntax. fixest functions are also convenient because they return named lists of models which are easy to subset and manipulate using standard R functions like grepl.\nFor example, to introduce regressors in stepwise fashion, and to estimate models on different subsets of the data, we can do:\n\n# estimate 4 models\nlibrary(fixest)\nmod <- feols(\n c(hp, mpg) ~ csw(qsec, drat) | gear,\n data = mtcars)\n\n# select models with different outcome variables\npanels <- list(\n \"Miles per gallon\" = mod[grepl(\"mpg\", names(mod))],\n \"Horsepower\" = mod[grepl(\"hp\", names(mod))]\n)\n\nmodelsummary(\n panels,\n shape = \"rcollapse\",\n gof_omit = \"IC|R2\")\n\n \n\n \n \n\ntinytable_oqucziaa2f5rxye5oddz\n\n\n \n\n \n (1)\n (2)\n \n\n\nqsec \n 1.436 \n 1.519 \n \n\n \n (0.594) \n (0.529) \n \n\ndrat \n \n 5.765 \n \n\n \n \n (2.381) \n \n\nRMSE \n 4.03 \n 3.67 \n \n\nqsec \n -22.175 \n -22.676 \n \n\n \n (12.762)\n (13.004)\n \n\ndrat \n \n -35.106 \n \n\n \n \n (28.509)\n \n\nRMSE \n 40.45 \n 39.14 \n \n\nNum.Obs. \n 32 \n 32 \n \n\nStd.Errors\n by: gear\n by: gear\n \n\nFE: gear \n X \n X \n \n\n\n\n\n \n\n\nWe can use all the typical extension systems to add information, such as the mean of the dependent variable:\n\nglance_custom.fixest <- function(x, ...) {\n dv <- insight::get_response(x)\n dv <- sprintf(\"%.2f\", mean(dv, na.rm = TRUE))\n data.table::data.table(`Mean of DV` = dv)\n}\n\nmodelsummary(\n panels,\n shape = \"rcollapse\",\n gof_omit = \"IC|R2\")\n\n \n\n \n \n\ntinytable_a02mgv0yq2aqefnf2nxf\n\n\n \n\n \n (1)\n (2)\n \n\n\nqsec \n 1.436 \n 1.519 \n \n\n \n (0.594) \n (0.529) \n \n\ndrat \n \n 5.765 \n \n\n \n \n (2.381) \n \n\nRMSE \n 4.03 \n 3.67 \n \n\nMean of DV\n 20.09 \n 20.09 \n \n\nqsec \n -22.175 \n -22.676 \n \n\n \n (12.762)\n (13.004)\n \n\ndrat \n \n -35.106 \n \n\n \n \n (28.509)\n \n\nRMSE \n 40.45 \n 39.14 \n \n\nMean of DV\n 146.69 \n 146.69 \n \n\nNum.Obs. \n 32 \n 32 \n \n\nStd.Errors\n by: gear\n by: gear\n \n\nFE: gear \n X \n X \n \n\n\n\n\n \n\nrm(\"glance_custom.fixest\")", "crumbs": [ "Get started", "Model Summaries" @@ -1221,7 +1221,7 @@ "href": "vignettes/modelsummary.html#reference-categories", "title": "Model Summaries", "section": "Reference categories", - "text": "Reference categories\nWhen estimating models with factor regressors, R will typically omit the reference category. We can include an empty row for the reference level automatically by using the include_reference argument. This argument is supplied by the parameters package, which modelsummary uses behind the scenes to extract model estimates. We can supply it directly to modelsummary(), which will then pass the argument forward automatically:\n\ntmp <- transform(mtcars, cyl = factor(cyl))\nmod <- lm(mpg ~ cyl, tmp)\nmodelsummary(mod, include_reference = TRUE)\n\n \n\n \n \n\ntinytable_ilm86p0fvjfgpjpfr2ms\n\n\n \n\n \n (1)\n \n\n\n(Intercept)\n 26.664 \n \n\n \n (0.972)\n \n\ncyl4 \n - \n \n\ncyl6 \n -6.921 \n \n\n \n (1.558)\n \n\ncyl8 \n -11.564\n \n\n \n (1.299)\n \n\nNum.Obs. \n 32 \n \n\nR2 \n 0.732 \n \n\nR2 Adj. \n 0.714 \n \n\nAIC \n 170.6 \n \n\nBIC \n 176.4 \n \n\nLog.Lik. \n -81.282\n \n\nF \n 39.698 \n \n\nRMSE \n 3.07", + "text": "Reference categories\nWhen estimating models with factor regressors, R will typically omit the reference category. We can include an empty row for the reference level automatically by using the include_reference argument. This argument is supplied by the parameters package, which modelsummary uses behind the scenes to extract model estimates. We can supply it directly to modelsummary(), which will then pass the argument forward automatically:\n\ntmp <- transform(mtcars, cyl = factor(cyl))\nmod <- lm(mpg ~ cyl, tmp)\nmodelsummary(mod, include_reference = TRUE)\n\n \n\n \n \n\ntinytable_b7lpy6o8nvigde8rkmkp\n\n\n \n\n \n (1)\n \n\n\n(Intercept)\n 26.664 \n \n\n \n (0.972)\n \n\ncyl4 \n - \n \n\ncyl6 \n -6.921 \n \n\n \n (1.558)\n \n\ncyl8 \n -11.564\n \n\n \n (1.299)\n \n\nNum.Obs. \n 32 \n \n\nR2 \n 0.732 \n \n\nR2 Adj. \n 0.714 \n \n\nAIC \n 170.6 \n \n\nBIC \n 176.4 \n \n\nLog.Lik. \n -81.282\n \n\nF \n 39.698 \n \n\nRMSE \n 3.07", "crumbs": [ "Get started", "Model Summaries" @@ -1254,7 +1254,7 @@ "href": "vignettes/modelsummary.html#quarto", "title": "Model Summaries", "section": "Quarto", - "text": "Quarto\nQuarto is an open source publishing system built on top of Pandoc. It was designed as a “successor” to Rmarkdown, and includes useful features for technical writing, such as built-in support for cross-references. modelsummary works automatically with Quarto. This is a minimal document with cross-references which should render automatically to PDF, HTML, and more:\n---\nformat: pdf\ntitle: Example\n---\n\n@tbl-mtcars shows that cars with high horse power get low miles per gallon.\n\n::: {#tbl-mtcars .cell tbl-cap='Horse Powers vs. Miles per Gallon'}\n\n```{.r .cell-code}\nlibrary(modelsummary)\nmod <- lm(mpg ~ hp, mtcars)\nmodelsummary(mod)\n```\n\n::: {.cell-output-display}\n\n```{=html}\n<!DOCTYPE html> \n<html lang=\"en\">\n <head>\n <meta charset=\"UTF-8\">\n <meta name=\"viewport\" content=\"width=device-width, initial-scale=1.0\">\n <title>tinytable_wd2p3rre3btolfnvj1e1</title>\n <style>\n.table td.tinytable_css_c0xazs972bxdfed0u1t0, .table th.tinytable_css_c0xazs972bxdfed0u1t0 { border-bottom: solid 0.1em #d3d8dc; }\n.table td.tinytable_css_3dp8uus41ymhe93e5b6h, .table th.tinytable_css_3dp8uus41ymhe93e5b6h { text-align: left; }\n.table td.tinytable_css_fp2odl38al328h1phmpm, .table th.tinytable_css_fp2odl38al328h1phmpm { text-align: center; }\n.table td.tinytable_css_btmepwmwd9kej9dtkji6, .table th.tinytable_css_btmepwmwd9kej9dtkji6 { border-bottom: solid 0.05em black; }\n </style>\n <script src=\"https://polyfill.io/v3/polyfill.min.js?features=es6\"></script>\n <script id=\"MathJax-script\" async src=\"https://cdn.jsdelivr.net/npm/mathjax@3/es5/tex-mml-chtml.js\"></script>\n <script>\n MathJax = {\n tex: {\n inlineMath: [['$', '$'], ['\\\\(', '\\\\)']]\n },\n svg: {\n fontCache: 'global'\n }\n };\n </script>\n </head>\n\n <body>\n <div class=\"container\">\n <table class=\"table table-borderless\" id=\"tinytable_wd2p3rre3btolfnvj1e1\" style=\"width: auto; margin-left: auto; margin-right: auto;\" data-quarto-disable-processing='true'>\n <thead>\n \n <tr>\n <th scope=\"col\"> </th>\n <th scope=\"col\">(1)</th>\n </tr>\n </thead>\n \n <tbody>\n <tr>\n <td>(Intercept)</td>\n <td>30.099 </td>\n </tr>\n <tr>\n <td> </td>\n <td>(1.634)</td>\n </tr>\n <tr>\n <td>hp </td>\n <td>-0.068 </td>\n </tr>\n <tr>\n <td> </td>\n <td>(0.010)</td>\n </tr>\n <tr>\n <td>Num.Obs. </td>\n <td>32 </td>\n </tr>\n <tr>\n <td>R2 </td>\n <td>0.602 </td>\n </tr>\n <tr>\n <td>R2 Adj. </td>\n <td>0.589 </td>\n </tr>\n <tr>\n <td>AIC </td>\n <td>181.2 </td>\n </tr>\n <tr>\n <td>BIC </td>\n <td>185.6 </td>\n </tr>\n <tr>\n <td>Log.Lik. </td>\n <td>-87.619</td>\n </tr>\n <tr>\n <td>F </td>\n <td>45.460 </td>\n </tr>\n <tr>\n <td>RMSE </td>\n <td>3.74 </td>\n </tr>\n </tbody>\n </table>\n </div>\n\n <script>\n function styleCell_tinytable_wn0cfg0rrf6tneafdah2(i, j, css_id) {\n var table = document.getElementById(\"tinytable_wd2p3rre3btolfnvj1e1\");\n table.rows[i].cells[j].classList.add(css_id);\n }\n function insertSpanRow(i, colspan, content) {\n var table = document.getElementById('tinytable_wd2p3rre3btolfnvj1e1');\n var newRow = table.insertRow(i);\n var newCell = newRow.insertCell(0);\n newCell.setAttribute(\"colspan\", colspan);\n // newCell.innerText = content;\n // this may be unsafe, but innerText does not interpret <br>\n newCell.innerHTML = content;\n }\n function spanCell_tinytable_wn0cfg0rrf6tneafdah2(i, j, rowspan, colspan) {\n var table = document.getElementById(\"tinytable_wd2p3rre3btolfnvj1e1\");\n const targetRow = table.rows[i];\n const targetCell = targetRow.cells[j];\n for (let r = 0; r < rowspan; r++) {\n // Only start deleting cells to the right for the first row (r == 0)\n if (r === 0) {\n // Delete cells to the right of the target cell in the first row\n for (let c = colspan - 1; c > 0; c--) {\n if (table.rows[i + r].cells[j + c]) {\n table.rows[i + r].deleteCell(j + c);\n }\n }\n }\n // For rows below the first, delete starting from the target column\n if (r > 0) {\n for (let c = colspan - 1; c >= 0; c--) {\n if (table.rows[i + r] && table.rows[i + r].cells[j]) {\n table.rows[i + r].deleteCell(j);\n }\n }\n }\n }\n // Set rowspan and colspan of the target cell\n targetCell.rowSpan = rowspan;\n targetCell.colSpan = colspan;\n }\n\nwindow.addEventListener('load', function () { styleCell_tinytable_wn0cfg0rrf6tneafdah2(0, 0, 'tinytable_css_c0xazs972bxdfed0u1t0') })\nwindow.addEventListener('load', function () { styleCell_tinytable_wn0cfg0rrf6tneafdah2(0, 1, 'tinytable_css_c0xazs972bxdfed0u1t0') })\nwindow.addEventListener('load', function () { styleCell_tinytable_wn0cfg0rrf6tneafdah2(0, 0, 'tinytable_css_3dp8uus41ymhe93e5b6h') })\nwindow.addEventListener('load', function () { styleCell_tinytable_wn0cfg0rrf6tneafdah2(1, 0, 'tinytable_css_3dp8uus41ymhe93e5b6h') })\nwindow.addEventListener('load', function () { styleCell_tinytable_wn0cfg0rrf6tneafdah2(2, 0, 'tinytable_css_3dp8uus41ymhe93e5b6h') })\nwindow.addEventListener('load', function () { styleCell_tinytable_wn0cfg0rrf6tneafdah2(3, 0, 'tinytable_css_3dp8uus41ymhe93e5b6h') })\nwindow.addEventListener('load', function () { styleCell_tinytable_wn0cfg0rrf6tneafdah2(4, 0, 'tinytable_css_3dp8uus41ymhe93e5b6h') })\nwindow.addEventListener('load', function () { styleCell_tinytable_wn0cfg0rrf6tneafdah2(5, 0, 'tinytable_css_3dp8uus41ymhe93e5b6h') })\nwindow.addEventListener('load', function () { styleCell_tinytable_wn0cfg0rrf6tneafdah2(6, 0, 'tinytable_css_3dp8uus41ymhe93e5b6h') })\nwindow.addEventListener('load', function () { styleCell_tinytable_wn0cfg0rrf6tneafdah2(7, 0, 'tinytable_css_3dp8uus41ymhe93e5b6h') })\nwindow.addEventListener('load', function () { styleCell_tinytable_wn0cfg0rrf6tneafdah2(8, 0, 'tinytable_css_3dp8uus41ymhe93e5b6h') })\nwindow.addEventListener('load', function () { styleCell_tinytable_wn0cfg0rrf6tneafdah2(9, 0, 'tinytable_css_3dp8uus41ymhe93e5b6h') })\nwindow.addEventListener('load', function () { styleCell_tinytable_wn0cfg0rrf6tneafdah2(10, 0, 'tinytable_css_3dp8uus41ymhe93e5b6h') })\nwindow.addEventListener('load', function () { styleCell_tinytable_wn0cfg0rrf6tneafdah2(11, 0, 'tinytable_css_3dp8uus41ymhe93e5b6h') })\nwindow.addEventListener('load', function () { styleCell_tinytable_wn0cfg0rrf6tneafdah2(12, 0, 'tinytable_css_3dp8uus41ymhe93e5b6h') })\nwindow.addEventListener('load', function () { styleCell_tinytable_wn0cfg0rrf6tneafdah2(0, 1, 'tinytable_css_fp2odl38al328h1phmpm') })\nwindow.addEventListener('load', function () { styleCell_tinytable_wn0cfg0rrf6tneafdah2(1, 1, 'tinytable_css_fp2odl38al328h1phmpm') })\nwindow.addEventListener('load', function () { styleCell_tinytable_wn0cfg0rrf6tneafdah2(2, 1, 'tinytable_css_fp2odl38al328h1phmpm') })\nwindow.addEventListener('load', function () { styleCell_tinytable_wn0cfg0rrf6tneafdah2(3, 1, 'tinytable_css_fp2odl38al328h1phmpm') })\nwindow.addEventListener('load', function () { styleCell_tinytable_wn0cfg0rrf6tneafdah2(4, 1, 'tinytable_css_fp2odl38al328h1phmpm') })\nwindow.addEventListener('load', function () { styleCell_tinytable_wn0cfg0rrf6tneafdah2(5, 1, 'tinytable_css_fp2odl38al328h1phmpm') })\nwindow.addEventListener('load', function () { styleCell_tinytable_wn0cfg0rrf6tneafdah2(6, 1, 'tinytable_css_fp2odl38al328h1phmpm') })\nwindow.addEventListener('load', function () { styleCell_tinytable_wn0cfg0rrf6tneafdah2(7, 1, 'tinytable_css_fp2odl38al328h1phmpm') })\nwindow.addEventListener('load', function () { styleCell_tinytable_wn0cfg0rrf6tneafdah2(8, 1, 'tinytable_css_fp2odl38al328h1phmpm') })\nwindow.addEventListener('load', function () { styleCell_tinytable_wn0cfg0rrf6tneafdah2(9, 1, 'tinytable_css_fp2odl38al328h1phmpm') })\nwindow.addEventListener('load', function () { styleCell_tinytable_wn0cfg0rrf6tneafdah2(10, 1, 'tinytable_css_fp2odl38al328h1phmpm') })\nwindow.addEventListener('load', function () { styleCell_tinytable_wn0cfg0rrf6tneafdah2(11, 1, 'tinytable_css_fp2odl38al328h1phmpm') })\nwindow.addEventListener('load', function () { styleCell_tinytable_wn0cfg0rrf6tneafdah2(12, 1, 'tinytable_css_fp2odl38al328h1phmpm') })\nwindow.addEventListener('load', function () { styleCell_tinytable_wn0cfg0rrf6tneafdah2(4, 0, 'tinytable_css_btmepwmwd9kej9dtkji6') })\nwindow.addEventListener('load', function () { styleCell_tinytable_wn0cfg0rrf6tneafdah2(4, 1, 'tinytable_css_btmepwmwd9kej9dtkji6') })\n </script>\n\n </body>\n\n</html>\n```\n\n:::\n:::", + "text": "Quarto\nQuarto is an open source publishing system built on top of Pandoc. It was designed as a “successor” to Rmarkdown, and includes useful features for technical writing, such as built-in support for cross-references. modelsummary works automatically with Quarto. This is a minimal document with cross-references which should render automatically to PDF, HTML, and more:\n---\nformat: pdf\ntitle: Example\n---\n\n@tbl-mtcars shows that cars with high horse power get low miles per gallon.\n\n::: {#tbl-mtcars .cell tbl-cap='Horse Powers vs. Miles per Gallon'}\n\n```{.r .cell-code}\nlibrary(modelsummary)\nmod <- lm(mpg ~ hp, mtcars)\nmodelsummary(mod)\n```\n\n::: {.cell-output-display}\n\n```{=html}\n<!DOCTYPE html> \n<html lang=\"en\">\n <head>\n <meta charset=\"UTF-8\">\n <meta name=\"viewport\" content=\"width=device-width, initial-scale=1.0\">\n <title>tinytable_81hl7auedfh8w7f5qwmh</title>\n <style>\n.table td.tinytable_css_2i97j7tjrnvyb873si2p, .table th.tinytable_css_2i97j7tjrnvyb873si2p { border-bottom: solid 0.1em #d3d8dc; }\n.table td.tinytable_css_1bylhko206yu4pic1doq, .table th.tinytable_css_1bylhko206yu4pic1doq { text-align: left; }\n.table td.tinytable_css_y9xylka3k21i45qc7wxb, .table th.tinytable_css_y9xylka3k21i45qc7wxb { text-align: center; }\n.table td.tinytable_css_dr6ybqipd0iv3huqoxdw, .table th.tinytable_css_dr6ybqipd0iv3huqoxdw { border-bottom: solid 0.05em black; }\n </style>\n <script src=\"https://polyfill.io/v3/polyfill.min.js?features=es6\"></script>\n <script id=\"MathJax-script\" async src=\"https://cdn.jsdelivr.net/npm/mathjax@3/es5/tex-mml-chtml.js\"></script>\n <script>\n MathJax = {\n tex: {\n inlineMath: [['$', '$'], ['\\\\(', '\\\\)']]\n },\n svg: {\n fontCache: 'global'\n }\n };\n </script>\n </head>\n\n <body>\n <div class=\"container\">\n <table class=\"table table-borderless\" id=\"tinytable_81hl7auedfh8w7f5qwmh\" style=\"width: auto; margin-left: auto; margin-right: auto;\" data-quarto-disable-processing='true'>\n <thead>\n \n <tr>\n <th scope=\"col\"> </th>\n <th scope=\"col\">(1)</th>\n </tr>\n </thead>\n \n <tbody>\n <tr>\n <td>(Intercept)</td>\n <td>30.099 </td>\n </tr>\n <tr>\n <td> </td>\n <td>(1.634)</td>\n </tr>\n <tr>\n <td>hp </td>\n <td>-0.068 </td>\n </tr>\n <tr>\n <td> </td>\n <td>(0.010)</td>\n </tr>\n <tr>\n <td>Num.Obs. </td>\n <td>32 </td>\n </tr>\n <tr>\n <td>R2 </td>\n <td>0.602 </td>\n </tr>\n <tr>\n <td>R2 Adj. </td>\n <td>0.589 </td>\n </tr>\n <tr>\n <td>AIC </td>\n <td>181.2 </td>\n </tr>\n <tr>\n <td>BIC </td>\n <td>185.6 </td>\n </tr>\n <tr>\n <td>Log.Lik. </td>\n <td>-87.619</td>\n </tr>\n <tr>\n <td>F </td>\n <td>45.460 </td>\n </tr>\n <tr>\n <td>RMSE </td>\n <td>3.74 </td>\n </tr>\n </tbody>\n </table>\n </div>\n\n <script>\n function styleCell_tinytable_e028ka9fujpe5fx6oh6y(i, j, css_id) {\n var table = document.getElementById(\"tinytable_81hl7auedfh8w7f5qwmh\");\n table.rows[i].cells[j].classList.add(css_id);\n }\n function insertSpanRow(i, colspan, content) {\n var table = document.getElementById('tinytable_81hl7auedfh8w7f5qwmh');\n var newRow = table.insertRow(i);\n var newCell = newRow.insertCell(0);\n newCell.setAttribute(\"colspan\", colspan);\n // newCell.innerText = content;\n // this may be unsafe, but innerText does not interpret <br>\n newCell.innerHTML = content;\n }\n function spanCell_tinytable_e028ka9fujpe5fx6oh6y(i, j, rowspan, colspan) {\n var table = document.getElementById(\"tinytable_81hl7auedfh8w7f5qwmh\");\n const targetRow = table.rows[i];\n const targetCell = targetRow.cells[j];\n for (let r = 0; r < rowspan; r++) {\n // Only start deleting cells to the right for the first row (r == 0)\n if (r === 0) {\n // Delete cells to the right of the target cell in the first row\n for (let c = colspan - 1; c > 0; c--) {\n if (table.rows[i + r].cells[j + c]) {\n table.rows[i + r].deleteCell(j + c);\n }\n }\n }\n // For rows below the first, delete starting from the target column\n if (r > 0) {\n for (let c = colspan - 1; c >= 0; c--) {\n if (table.rows[i + r] && table.rows[i + r].cells[j]) {\n table.rows[i + r].deleteCell(j);\n }\n }\n }\n }\n // Set rowspan and colspan of the target cell\n targetCell.rowSpan = rowspan;\n targetCell.colSpan = colspan;\n }\n\nwindow.addEventListener('load', function () { styleCell_tinytable_e028ka9fujpe5fx6oh6y(0, 0, 'tinytable_css_2i97j7tjrnvyb873si2p') })\nwindow.addEventListener('load', function () { styleCell_tinytable_e028ka9fujpe5fx6oh6y(0, 1, 'tinytable_css_2i97j7tjrnvyb873si2p') })\nwindow.addEventListener('load', function () { styleCell_tinytable_e028ka9fujpe5fx6oh6y(0, 0, 'tinytable_css_1bylhko206yu4pic1doq') })\nwindow.addEventListener('load', function () { styleCell_tinytable_e028ka9fujpe5fx6oh6y(1, 0, 'tinytable_css_1bylhko206yu4pic1doq') })\nwindow.addEventListener('load', function () { styleCell_tinytable_e028ka9fujpe5fx6oh6y(2, 0, 'tinytable_css_1bylhko206yu4pic1doq') })\nwindow.addEventListener('load', function () { styleCell_tinytable_e028ka9fujpe5fx6oh6y(3, 0, 'tinytable_css_1bylhko206yu4pic1doq') })\nwindow.addEventListener('load', function () { styleCell_tinytable_e028ka9fujpe5fx6oh6y(4, 0, 'tinytable_css_1bylhko206yu4pic1doq') })\nwindow.addEventListener('load', function () { styleCell_tinytable_e028ka9fujpe5fx6oh6y(5, 0, 'tinytable_css_1bylhko206yu4pic1doq') })\nwindow.addEventListener('load', function () { styleCell_tinytable_e028ka9fujpe5fx6oh6y(6, 0, 'tinytable_css_1bylhko206yu4pic1doq') })\nwindow.addEventListener('load', function () { styleCell_tinytable_e028ka9fujpe5fx6oh6y(7, 0, 'tinytable_css_1bylhko206yu4pic1doq') })\nwindow.addEventListener('load', function () { styleCell_tinytable_e028ka9fujpe5fx6oh6y(8, 0, 'tinytable_css_1bylhko206yu4pic1doq') })\nwindow.addEventListener('load', function () { styleCell_tinytable_e028ka9fujpe5fx6oh6y(9, 0, 'tinytable_css_1bylhko206yu4pic1doq') })\nwindow.addEventListener('load', function () { styleCell_tinytable_e028ka9fujpe5fx6oh6y(10, 0, 'tinytable_css_1bylhko206yu4pic1doq') })\nwindow.addEventListener('load', function () { styleCell_tinytable_e028ka9fujpe5fx6oh6y(11, 0, 'tinytable_css_1bylhko206yu4pic1doq') })\nwindow.addEventListener('load', function () { styleCell_tinytable_e028ka9fujpe5fx6oh6y(12, 0, 'tinytable_css_1bylhko206yu4pic1doq') })\nwindow.addEventListener('load', function () { styleCell_tinytable_e028ka9fujpe5fx6oh6y(0, 1, 'tinytable_css_y9xylka3k21i45qc7wxb') })\nwindow.addEventListener('load', function () { styleCell_tinytable_e028ka9fujpe5fx6oh6y(1, 1, 'tinytable_css_y9xylka3k21i45qc7wxb') })\nwindow.addEventListener('load', function () { styleCell_tinytable_e028ka9fujpe5fx6oh6y(2, 1, 'tinytable_css_y9xylka3k21i45qc7wxb') })\nwindow.addEventListener('load', function () { styleCell_tinytable_e028ka9fujpe5fx6oh6y(3, 1, 'tinytable_css_y9xylka3k21i45qc7wxb') })\nwindow.addEventListener('load', function () { styleCell_tinytable_e028ka9fujpe5fx6oh6y(4, 1, 'tinytable_css_y9xylka3k21i45qc7wxb') })\nwindow.addEventListener('load', function () { styleCell_tinytable_e028ka9fujpe5fx6oh6y(5, 1, 'tinytable_css_y9xylka3k21i45qc7wxb') })\nwindow.addEventListener('load', function () { styleCell_tinytable_e028ka9fujpe5fx6oh6y(6, 1, 'tinytable_css_y9xylka3k21i45qc7wxb') })\nwindow.addEventListener('load', function () { styleCell_tinytable_e028ka9fujpe5fx6oh6y(7, 1, 'tinytable_css_y9xylka3k21i45qc7wxb') })\nwindow.addEventListener('load', function () { styleCell_tinytable_e028ka9fujpe5fx6oh6y(8, 1, 'tinytable_css_y9xylka3k21i45qc7wxb') })\nwindow.addEventListener('load', function () { styleCell_tinytable_e028ka9fujpe5fx6oh6y(9, 1, 'tinytable_css_y9xylka3k21i45qc7wxb') })\nwindow.addEventListener('load', function () { styleCell_tinytable_e028ka9fujpe5fx6oh6y(10, 1, 'tinytable_css_y9xylka3k21i45qc7wxb') })\nwindow.addEventListener('load', function () { styleCell_tinytable_e028ka9fujpe5fx6oh6y(11, 1, 'tinytable_css_y9xylka3k21i45qc7wxb') })\nwindow.addEventListener('load', function () { styleCell_tinytable_e028ka9fujpe5fx6oh6y(12, 1, 'tinytable_css_y9xylka3k21i45qc7wxb') })\nwindow.addEventListener('load', function () { styleCell_tinytable_e028ka9fujpe5fx6oh6y(4, 0, 'tinytable_css_dr6ybqipd0iv3huqoxdw') })\nwindow.addEventListener('load', function () { styleCell_tinytable_e028ka9fujpe5fx6oh6y(4, 1, 'tinytable_css_dr6ybqipd0iv3huqoxdw') })\n </script>\n\n </body>\n\n</html>\n```\n\n:::\n:::", "crumbs": [ "Get started", "Model Summaries" @@ -1276,7 +1276,7 @@ "href": "vignettes/modelsummary.html#collapse-control-variables-into-an-indicator", "title": "Model Summaries", "section": "Collapse control variables into an indicator", - "text": "Collapse control variables into an indicator\nIn some cases, analysts want to display a single checkmark in their table if a full set of control variables is available. This can easily be achieved with the glance_custom mechanism described in detail in the extension vignette. Here is a simple example:\n\nlibrary(modelsummary)\n\nmod <- list(\n glm(am ~ hp + factor(cyl), data = mtcars, family = binomial),\n lm(mpg ~ hp + factor(cyl) + gear + qsec, data = mtcars)\n)\n\nglance_custom.lm <- function(x, ...) {\n controls <- c(\"gear\", \"qsec\")\n if (all(controls %in% names(coef(x)))) {\n out <- data.frame(Controls = \"✓\")\n } else {\n out <- data.frame(Controls = \"✗\")\n }\n return(out)\n}\n\nglance_custom.glm <- glance_custom.lm\n\nmodelsummary(mod, \"html\", coef_omit = \"qsec|gear\")\n\n \n\n \n \n\ntinytable_bgyur1ad2rtggxu697lm\n\n\n \n\n \n (1)\n (2)\n \n\n\n(Intercept) \n −2.029 \n 33.178 \n \n\n \n (1.604)\n (13.713)\n \n\nhp \n 0.038 \n −0.057 \n \n\n \n (0.019)\n (0.018) \n \n\nfactor(cyl)6\n −2.874 \n −4.818 \n \n\n \n (1.360)\n (1.805) \n \n\nfactor(cyl)8\n −8.644 \n −4.037 \n \n\n \n (3.423)\n (3.585) \n \n\nNum.Obs. \n 32 \n 32 \n \n\nR2 \n \n 0.812 \n \n\nR2 Adj. \n \n 0.776 \n \n\nAIC \n 35.2 \n 165.2 \n \n\nBIC \n 41.1 \n 175.5 \n \n\nLog.Lik. \n −13.602\n −75.598 \n \n\nF \n 2.514 \n 22.526 \n \n\nRMSE \n 0.38 \n 2.57 \n \n\nControls \n ✗ \n ✓ \n \n\n\n\n\n \n\n\nReturn to nomal:\n\nrm(list = c(\"glance_custom.glm\", \"glance_custom.lm\"))", + "text": "Collapse control variables into an indicator\nIn some cases, analysts want to display a single checkmark in their table if a full set of control variables is available. This can easily be achieved with the glance_custom mechanism described in detail in the extension vignette. Here is a simple example:\n\nlibrary(modelsummary)\n\nmod <- list(\n glm(am ~ hp + factor(cyl), data = mtcars, family = binomial),\n lm(mpg ~ hp + factor(cyl) + gear + qsec, data = mtcars)\n)\n\nglance_custom.lm <- function(x, ...) {\n controls <- c(\"gear\", \"qsec\")\n if (all(controls %in% names(coef(x)))) {\n out <- data.frame(Controls = \"✓\")\n } else {\n out <- data.frame(Controls = \"✗\")\n }\n return(out)\n}\n\nglance_custom.glm <- glance_custom.lm\n\nmodelsummary(mod, \"html\", coef_omit = \"qsec|gear\")\n\n \n\n \n \n\ntinytable_myl0s6bnpg44bqowtle9\n\n\n \n\n \n (1)\n (2)\n \n\n\n(Intercept) \n −2.029 \n 33.178 \n \n\n \n (1.604)\n (13.713)\n \n\nhp \n 0.038 \n −0.057 \n \n\n \n (0.019)\n (0.018) \n \n\nfactor(cyl)6\n −2.874 \n −4.818 \n \n\n \n (1.360)\n (1.805) \n \n\nfactor(cyl)8\n −8.644 \n −4.037 \n \n\n \n (3.423)\n (3.585) \n \n\nNum.Obs. \n 32 \n 32 \n \n\nR2 \n \n 0.812 \n \n\nR2 Adj. \n \n 0.776 \n \n\nAIC \n 35.2 \n 165.2 \n \n\nBIC \n 41.1 \n 175.5 \n \n\nLog.Lik. \n −13.602\n −75.598 \n \n\nF \n 2.514 \n 22.526 \n \n\nRMSE \n 0.38 \n 2.57 \n \n\nControls \n ✗ \n ✓ \n \n\n\n\n\n \n\n\nReturn to nomal:\n\nrm(list = c(\"glance_custom.glm\", \"glance_custom.lm\"))", "crumbs": [ "Get started", "Model Summaries" @@ -1287,7 +1287,7 @@ "href": "vignettes/modelsummary.html#subgroup-estimation-with-nest_by", "title": "Model Summaries", "section": "Subgroup estimation with nest_by\n", - "text": "Subgroup estimation with nest_by\n\nSometimes, it is useful to estimate multiple regression models on subsets of the data. To do this efficiently, we can use the nest_by function from the dplyr package. Then, estimate the models with lm, extract them and name them with pull, and finally summarize them with modelsummary:\n\nlibrary(tidyverse)\n\nmtcars %>%\n nest_by(cyl) %>%\n mutate(models = list(lm(mpg ~ hp, data))) %>%\n pull(models, name = cyl) %>%\n modelsummary\n\n \n\n \n \n\ntinytable_dnpksjevzf413uytw944\n\n\n \n\n \n 4\n 6\n 8\n \n\n\n(Intercept)\n 35.983 \n 20.674 \n 18.080 \n \n\n \n (5.201)\n (3.304)\n (2.988)\n \n\nhp \n -0.113 \n -0.008 \n -0.014 \n \n\n \n (0.061)\n (0.027)\n (0.014)\n \n\nNum.Obs. \n 11 \n 7 \n 14 \n \n\nR2 \n 0.274 \n 0.016 \n 0.080 \n \n\nR2 Adj. \n 0.193 \n -0.181 \n 0.004 \n \n\nAIC \n 65.8 \n 29.9 \n 69.8 \n \n\nBIC \n 67.0 \n 29.7 \n 71.8 \n \n\nLog.Lik. \n -29.891\n -11.954\n -31.920\n \n\nRMSE \n 3.66 \n 1.33 \n 2.37", + "text": "Subgroup estimation with nest_by\n\nSometimes, it is useful to estimate multiple regression models on subsets of the data. To do this efficiently, we can use the nest_by function from the dplyr package. Then, estimate the models with lm, extract them and name them with pull, and finally summarize them with modelsummary:\n\nlibrary(tidyverse)\n\nmtcars %>%\n nest_by(cyl) %>%\n mutate(models = list(lm(mpg ~ hp, data))) %>%\n pull(models, name = cyl) %>%\n modelsummary\n\n \n\n \n \n\ntinytable_0lrpjbx6d6z8avuxxh14\n\n\n \n\n \n 4\n 6\n 8\n \n\n\n(Intercept)\n 35.983 \n 20.674 \n 18.080 \n \n\n \n (5.201)\n (3.304)\n (2.988)\n \n\nhp \n -0.113 \n -0.008 \n -0.014 \n \n\n \n (0.061)\n (0.027)\n (0.014)\n \n\nNum.Obs. \n 11 \n 7 \n 14 \n \n\nR2 \n 0.274 \n 0.016 \n 0.080 \n \n\nR2 Adj. \n 0.193 \n -0.181 \n 0.004 \n \n\nAIC \n 65.8 \n 29.9 \n 69.8 \n \n\nBIC \n 67.0 \n 29.7 \n 71.8 \n \n\nLog.Lik. \n -29.891\n -11.954\n -31.920\n \n\nRMSE \n 3.66 \n 1.33 \n 2.37", "crumbs": [ "Get started", "Model Summaries" @@ -1298,7 +1298,7 @@ "href": "vignettes/modelsummary.html#bootstrap", "title": "Model Summaries", "section": "Bootstrap", - "text": "Bootstrap\nUsers often want to use estimates or standard errors that have been obtained using a custom strategy. To achieve this in an automated and replicable way, it can be useful to use the tidy_custom strategy described above in the “Cutomizing Existing Models” section.\nFor example, we can use the modelr package to draw 500 resamples of a dataset, and compute bootstrap standard errors by taking the standard deviation of estimates computed in all of those resampled datasets. To do this, we defined tidy_custom.lm function that will automatically bootstrap any lm model supplied to modelsummary, and replace the values in the table automatically.\nNote that the tidy_custom_lm returns a data.frame with 3 columns: term, estimate, and std.error:\n\nlibrary(\"broom\")\nlibrary(\"tidyverse\")\nlibrary(\"modelr\")\n\ntidy_custom.lm <- function(x, ...) {\n # extract data from the model\n model.frame(x) %>%\n # draw 500 bootstrap resamples\n modelr::bootstrap(n = 500) %>%\n # estimate the model 500 times\n mutate(results = map(strap, ~ update(x, data = .))) %>%\n # extract results using `broom::tidy`\n mutate(results = map(results, tidy)) %>%\n # unnest and summarize\n unnest(results) %>%\n group_by(term) %>%\n summarize(std.error = sd(estimate),\n estimate = mean(estimate))\n}\n\nmod = list(\n lm(hp ~ mpg, mtcars) ,\n lm(hp ~ mpg + drat, mtcars))\n\nmodelsummary(mod)\n\n \n\n \n \n\ntinytable_gnxqelpt3e58rikaxvvx\n\n\n \n\n \n (1)\n (2)\n \n\n\n(Intercept)\n 326.012 \n 281.967 \n \n\n \n (30.638)\n (41.371)\n \n\nmpg \n -8.966 \n -10.205 \n \n\n \n (1.390) \n (2.339) \n \n\ndrat \n \n 19.036 \n \n\n \n \n (20.568)\n \n\nNum.Obs. \n 32 \n 32 \n \n\nR2 \n 0.602 \n 0.614 \n \n\nR2 Adj. \n 0.589 \n 0.588 \n \n\nAIC \n 336.9 \n 337.9 \n \n\nBIC \n 341.3 \n 343.7 \n \n\nLog.Lik. \n -165.428\n -164.940\n \n\nF \n 45.460 \n 23.100 \n \n\nRMSE \n 42.55 \n 41.91", + "text": "Bootstrap\nUsers often want to use estimates or standard errors that have been obtained using a custom strategy. To achieve this in an automated and replicable way, it can be useful to use the tidy_custom strategy described above in the “Cutomizing Existing Models” section.\nFor example, we can use the modelr package to draw 500 resamples of a dataset, and compute bootstrap standard errors by taking the standard deviation of estimates computed in all of those resampled datasets. To do this, we defined tidy_custom.lm function that will automatically bootstrap any lm model supplied to modelsummary, and replace the values in the table automatically.\nNote that the tidy_custom_lm returns a data.frame with 3 columns: term, estimate, and std.error:\n\nlibrary(\"broom\")\nlibrary(\"tidyverse\")\nlibrary(\"modelr\")\n\ntidy_custom.lm <- function(x, ...) {\n # extract data from the model\n model.frame(x) %>%\n # draw 500 bootstrap resamples\n modelr::bootstrap(n = 500) %>%\n # estimate the model 500 times\n mutate(results = map(strap, ~ update(x, data = .))) %>%\n # extract results using `broom::tidy`\n mutate(results = map(results, tidy)) %>%\n # unnest and summarize\n unnest(results) %>%\n group_by(term) %>%\n summarize(std.error = sd(estimate),\n estimate = mean(estimate))\n}\n\nmod = list(\n lm(hp ~ mpg, mtcars) ,\n lm(hp ~ mpg + drat, mtcars))\n\nmodelsummary(mod)\n\n \n\n \n \n\ntinytable_k2n4ehsa16320dp7gqma\n\n\n \n\n \n (1)\n (2)\n \n\n\n(Intercept)\n 326.362 \n 283.790 \n \n\n \n (31.592)\n (41.181)\n \n\nmpg \n -8.991 \n -10.225 \n \n\n \n (1.410) \n (2.207) \n \n\ndrat \n \n 18.796 \n \n\n \n \n (19.682)\n \n\nNum.Obs. \n 32 \n 32 \n \n\nR2 \n 0.602 \n 0.614 \n \n\nR2 Adj. \n 0.589 \n 0.588 \n \n\nAIC \n 336.9 \n 337.9 \n \n\nBIC \n 341.3 \n 343.7 \n \n\nLog.Lik. \n -165.428\n -164.940\n \n\nF \n 45.460 \n 23.100 \n \n\nRMSE \n 42.55 \n 41.91", "crumbs": [ "Get started", "Model Summaries" @@ -1309,7 +1309,7 @@ "href": "vignettes/modelsummary.html#fixest-fixed-effects-and-instrumental-variable-regression", "title": "Model Summaries", "section": "\nfixest: Fixed effects and instrumental variable regression", - "text": "fixest: Fixed effects and instrumental variable regression\nOne common use-case for glance_custom is to include additional goodness-of-fit statistics. For example, in an instrumental variable estimation computed by the fixest package, we may want to include an IV-Wald statistic for the first-stage regression of each endogenous regressor:\n\nlibrary(fixest)\nlibrary(tidyverse)\n\n# create a toy dataset\nbase <- iris\nnames(base) <- c(\"y\", \"x1\", \"x_endo_1\", \"x_inst_1\", \"fe\")\nbase$x_inst_2 <- 0.2 * base$y + 0.2 * base$x_endo_1 + rnorm(150, sd = 0.5)\nbase$x_endo_2 <- 0.2 * base$y - 0.2 * base$x_inst_1 + rnorm(150, sd = 0.5)\n\n# estimate an instrumental variable model\nmod <- feols(y ~ x1 | fe | x_endo_1 + x_endo_2 ~ x_inst_1 + x_inst_2, base)\n\n# custom extractor function returns a one-row data.frame (or tibble)\nglance_custom.fixest <- function(x) {\n tibble(\n \"Wald (x_endo_1)\" = fitstat(x, \"ivwald\")[[1]]$stat,\n \"Wald (x_endo_2)\" = fitstat(x, \"ivwald\")[[2]]$stat\n )\n}\n\n# draw table\nmodelsummary(mod)\n\n \n\n \n \n\ntinytable_vnnj050bm86wrx2jlr2i\n\n\n \n\n \n (1)\n \n\n\nfit_x_endo_1 \n -0.174 \n \n\n \n (4.108) \n \n\nfit_x_endo_2 \n 3.060 \n \n\n \n (11.055) \n \n\nx1 \n 0.329 \n \n\n \n (0.508) \n \n\nNum.Obs. \n 150 \n \n\nR2 \n -2.741 \n \n\nR2 Adj. \n -2.871 \n \n\nR2 Within \n -8.812 \n \n\nR2 Within Adj. \n -9.017 \n \n\nAIC \n 578.0 \n \n\nBIC \n 596.1 \n \n\nRMSE \n 1.60 \n \n\nStd.Errors \n by: fe \n \n\nFE: fe \n X \n \n\nWald (x_endo_1)\n 50.8615423860559 \n \n\nWald (x_endo_2)\n 0.581592469806361\n \n\n\n\n\n \n\n\n\nrm(\"glance_custom.fixest\")", + "text": "fixest: Fixed effects and instrumental variable regression\nOne common use-case for glance_custom is to include additional goodness-of-fit statistics. For example, in an instrumental variable estimation computed by the fixest package, we may want to include an IV-Wald statistic for the first-stage regression of each endogenous regressor:\n\nlibrary(fixest)\nlibrary(tidyverse)\n\n# create a toy dataset\nbase <- iris\nnames(base) <- c(\"y\", \"x1\", \"x_endo_1\", \"x_inst_1\", \"fe\")\nbase$x_inst_2 <- 0.2 * base$y + 0.2 * base$x_endo_1 + rnorm(150, sd = 0.5)\nbase$x_endo_2 <- 0.2 * base$y - 0.2 * base$x_inst_1 + rnorm(150, sd = 0.5)\n\n# estimate an instrumental variable model\nmod <- feols(y ~ x1 | fe | x_endo_1 + x_endo_2 ~ x_inst_1 + x_inst_2, base)\n\n# custom extractor function returns a one-row data.frame (or tibble)\nglance_custom.fixest <- function(x) {\n tibble(\n \"Wald (x_endo_1)\" = fitstat(x, \"ivwald\")[[1]]$stat,\n \"Wald (x_endo_2)\" = fitstat(x, \"ivwald\")[[2]]$stat\n )\n}\n\n# draw table\nmodelsummary(mod)\n\n \n\n \n \n\ntinytable_mlspi5k0y98jwq9glrge\n\n\n \n\n \n (1)\n \n\n\nfit_x_endo_1 \n 13.669 \n \n\n \n (39.671) \n \n\nfit_x_endo_2 \n 77.421 \n \n\n \n (190.021) \n \n\nx1 \n -17.688 \n \n\n \n (45.941) \n \n\nNum.Obs. \n 150 \n \n\nR2 \n -2286.721 \n \n\nR2 Adj. \n -2366.156 \n \n\nR2 Within \n -5998.883 \n \n\nR2 Within Adj. \n -6123.881 \n \n\nAIC \n 1540.4 \n \n\nBIC \n 1558.4 \n \n\nRMSE \n 39.47 \n \n\nStd.Errors \n by: fe \n \n\nFE: fe \n X \n \n\nWald (x_endo_1)\n 7.24363130222479 \n \n\nWald (x_endo_2)\n 0.858059193776838\n \n\n\n\n\n \n\n\n\nrm(\"glance_custom.fixest\")", "crumbs": [ "Get started", "Model Summaries" @@ -1320,7 +1320,7 @@ "href": "vignettes/modelsummary.html#multiple-imputation", "title": "Model Summaries", "section": "Multiple imputation", - "text": "Multiple imputation\nmodelsummary can pool and display analyses on several datasets imputed using the mice or Amelia packages. This code illustrates how:\n\nlibrary(mice)\n\nWarning in check_dep_version(): ABI version mismatch: \nlme4 was built with Matrix ABI version 2\nCurrent Matrix ABI version is 1\nPlease re-install lme4 from source or restore original 'Matrix' package\n\nlibrary(Amelia)\n\n# Download data from `Rdatasets`\nurl <- 'https://vincentarelbundock.github.io/Rdatasets/csv/HistData/Guerry.csv'\ndat <- read.csv(url)[, c('Clergy', 'Commerce', 'Literacy')]\n\n# Insert missing values\ndat$Clergy[sample(1:nrow(dat), 10)] <- NA\ndat$Commerce[sample(1:nrow(dat), 10)] <- NA\ndat$Literacy[sample(1:nrow(dat), 10)] <- NA\n\n# Impute with `mice` and `Amelia`\ndat_mice <- mice(dat, m = 5, printFlag = FALSE)\ndat_amelia <- amelia(dat, m = 5, p2s = 0)$imputations\n\n# Estimate models\nmod <- list()\nmod[['Listwise deletion']] <- lm(Clergy ~ Literacy + Commerce, dat)\nmod[['Mice']] <- with(dat_mice, lm(Clergy ~ Literacy + Commerce)) \nmod[['Amelia']] <- lapply(dat_amelia, function(x) lm(Clergy ~ Literacy + Commerce, x))\n\n# Pool results\nmod[['Mice']] <- mice::pool(mod[['Mice']])\nmod[['Amelia']] <- mice::pool(mod[['Amelia']])\n\n# Summarize\nmodelsummary(mod)\n\n \n\n \n \n\ntinytable_3a5oeypthhhlna2s2bdl\n\n\n \n\n \n Listwise deletion\n Mice\n Amelia\n \n\n\n(Intercept)\n 81.719 \n 75.699 \n 79.645 \n \n\n \n (14.584)\n (13.342)\n (13.468)\n \n\nLiteracy \n -0.638 \n -0.499 \n -0.541 \n \n\n \n (0.234) \n (0.205) \n (0.216) \n \n\nCommerce \n -0.305 \n -0.283 \n -0.331 \n \n\n \n (0.168) \n (0.145) \n (0.148) \n \n\nNum.Obs. \n 59 \n 86 \n 86 \n \n\nNum.Imp. \n \n 5 \n 5 \n \n\nR2 \n 0.121 \n 0.078 \n 0.102 \n \n\nR2 Adj. \n 0.089 \n 0.055 \n 0.079 \n \n\nAIC \n 557.0 \n \n \n \n\nBIC \n 565.3 \n \n \n \n\nLog.Lik. \n -274.488\n \n \n \n\nF \n 3.843 \n \n \n \n\nRMSE \n 25.37", + "text": "Multiple imputation\nmodelsummary can pool and display analyses on several datasets imputed using the mice or Amelia packages. This code illustrates how:\n\nlibrary(mice)\n\nWarning in check_dep_version(): ABI version mismatch: \nlme4 was built with Matrix ABI version 2\nCurrent Matrix ABI version is 1\nPlease re-install lme4 from source or restore original 'Matrix' package\n\nlibrary(Amelia)\n\n# Download data from `Rdatasets`\nurl <- 'https://vincentarelbundock.github.io/Rdatasets/csv/HistData/Guerry.csv'\ndat <- read.csv(url)[, c('Clergy', 'Commerce', 'Literacy')]\n\n# Insert missing values\ndat$Clergy[sample(1:nrow(dat), 10)] <- NA\ndat$Commerce[sample(1:nrow(dat), 10)] <- NA\ndat$Literacy[sample(1:nrow(dat), 10)] <- NA\n\n# Impute with `mice` and `Amelia`\ndat_mice <- mice(dat, m = 5, printFlag = FALSE)\ndat_amelia <- amelia(dat, m = 5, p2s = 0)$imputations\n\n# Estimate models\nmod <- list()\nmod[['Listwise deletion']] <- lm(Clergy ~ Literacy + Commerce, dat)\nmod[['Mice']] <- with(dat_mice, lm(Clergy ~ Literacy + Commerce)) \nmod[['Amelia']] <- lapply(dat_amelia, function(x) lm(Clergy ~ Literacy + Commerce, x))\n\n# Pool results\nmod[['Mice']] <- mice::pool(mod[['Mice']])\nmod[['Amelia']] <- mice::pool(mod[['Amelia']])\n\n# Summarize\nmodelsummary(mod)\n\n \n\n \n \n\ntinytable_50onqcwlrm5lbajno0z3\n\n\n \n\n \n Listwise deletion\n Mice\n Amelia\n \n\n\n(Intercept)\n 71.717 \n 73.303 \n 72.284 \n \n\n \n (14.112)\n (14.664)\n (12.809)\n \n\nLiteracy \n -0.418 \n -0.470 \n -0.435 \n \n\n \n (0.221) \n (0.228) \n (0.194) \n \n\nCommerce \n -0.269 \n -0.266 \n -0.297 \n \n\n \n (0.159) \n (0.157) \n (0.152) \n \n\nNum.Obs. \n 60 \n 86 \n 86 \n \n\nNum.Imp. \n \n 5 \n 5 \n \n\nR2 \n 0.068 \n 0.072 \n 0.077 \n \n\nR2 Adj. \n 0.035 \n 0.047 \n 0.054 \n \n\nAIC \n 561.8 \n \n \n \n\nBIC \n 570.2 \n \n \n \n\nLog.Lik. \n -276.887\n \n \n \n\nF \n 2.071 \n \n \n \n\nRMSE \n 24.43", "crumbs": [ "Get started", "Model Summaries" @@ -1375,7 +1375,7 @@ "href": "vignettes/modelsummary.html#how-can-i-speed-up-modelsummary", "title": "Model Summaries", "section": "How can I speed up modelsummary?", - "text": "How can I speed up modelsummary?\nThe modelsummary function, by itself, is not slow: it should only take a couple seconds to produce a table in any output format. However, sometimes it can be computationally expensive (and long) to extract estimates and to compute goodness-of-fit statistics for your model.\nThe main options to speed up modelsummary are:\n\nSet gof_map=NA to avoid computing expensive goodness-of-fit statistics.\nUse the easystats extractor functions and the metrics argument to avoid computing expensive statistics (see below for an example).\nUse parallel computation if you are summarizing multiple models. See the “Parallel computation” section in the ?modelsummary documentation.\n\nTo diagnose the slowdown and find the bottleneck, you can try to benchmark the various extractor functions:\n\nlibrary(tictoc)\n\ndata(trade)\nmod <- lm(mpg ~ hp + drat, mtcars)\n\ntic(\"tidy\")\nx <- broom::tidy(mod)\ntoc()\n\ntidy: 0.003 sec elapsed\n\ntic(\"glance\")\nx <- broom::glance(mod)\ntoc()\n\nglance: 0.004 sec elapsed\n\ntic(\"parameters\")\nx <- parameters::parameters(mod)\ntoc()\n\nparameters: 0.026 sec elapsed\n\ntic(\"performance\")\nx <- performance::performance(mod)\ntoc()\n\nperformance: 0.014 sec elapsed\n\n\nIn my experience, the main bottleneck tends to be computing goodness-of-fit statistics. The performance extractor allows users to specify a metrics argument to select a subset of GOF to include. Using this can speedup things considerably.\nWe call modelsummary with the metrics argument:\n\nmodelsummary(mod, metrics = \"rmse\")\n\n \n\n \n \n\ntinytable_wbc4i00xeuv5562ue5j1\n\n\n \n\n \n (1)\n \n\n\n(Intercept)\n 10.790 \n \n\n \n (5.078)\n \n\nhp \n -0.052 \n \n\n \n (0.009)\n \n\ndrat \n 4.698 \n \n\n \n (1.192)\n \n\nNum.Obs. \n 32 \n \n\nR2 \n 0.741 \n \n\nR2 Adj. \n 0.723 \n \n\nAIC \n 169.5 \n \n\nBIC \n 175.4 \n \n\nLog.Lik. \n -80.752\n \n\nF \n 41.522", + "text": "How can I speed up modelsummary?\nThe modelsummary function, by itself, is not slow: it should only take a couple seconds to produce a table in any output format. However, sometimes it can be computationally expensive (and long) to extract estimates and to compute goodness-of-fit statistics for your model.\nThe main options to speed up modelsummary are:\n\nSet gof_map=NA to avoid computing expensive goodness-of-fit statistics.\nUse the easystats extractor functions and the metrics argument to avoid computing expensive statistics (see below for an example).\nUse parallel computation if you are summarizing multiple models. See the “Parallel computation” section in the ?modelsummary documentation.\n\nTo diagnose the slowdown and find the bottleneck, you can try to benchmark the various extractor functions:\n\nlibrary(tictoc)\n\ndata(trade)\nmod <- lm(mpg ~ hp + drat, mtcars)\n\ntic(\"tidy\")\nx <- broom::tidy(mod)\ntoc()\n\ntidy: 0.002 sec elapsed\n\ntic(\"glance\")\nx <- broom::glance(mod)\ntoc()\n\nglance: 0.004 sec elapsed\n\ntic(\"parameters\")\nx <- parameters::parameters(mod)\ntoc()\n\nparameters: 0.021 sec elapsed\n\ntic(\"performance\")\nx <- performance::performance(mod)\ntoc()\n\nperformance: 0.011 sec elapsed\n\n\nIn my experience, the main bottleneck tends to be computing goodness-of-fit statistics. The performance extractor allows users to specify a metrics argument to select a subset of GOF to include. Using this can speedup things considerably.\nWe call modelsummary with the metrics argument:\n\nmodelsummary(mod, metrics = \"rmse\")\n\n \n\n \n \n\ntinytable_zd23lfshk9ui5tb2okyn\n\n\n \n\n \n (1)\n \n\n\n(Intercept)\n 10.790 \n \n\n \n (5.078)\n \n\nhp \n -0.052 \n \n\n \n (0.009)\n \n\ndrat \n 4.698 \n \n\n \n (1.192)\n \n\nNum.Obs. \n 32 \n \n\nR2 \n 0.741 \n \n\nR2 Adj. \n 0.723 \n \n\nAIC \n 169.5 \n \n\nBIC \n 175.4 \n \n\nLog.Lik. \n -80.752\n \n\nF \n 41.522", "crumbs": [ "Get started", "Model Summaries" @@ -1397,7 +1397,7 @@ "href": "vignettes/modelsummary.html#bayesian-models", "title": "Model Summaries", "section": "Bayesian models", - "text": "Bayesian models\nMany bayesian models are supported out-of-the-box, including those produced by the rstanarm and brms packages. The statistics available for bayesian models are slightly different than those available for most frequentist models. Users can call get_estimates to see what is available:\n\nlibrary(rstanarm)\n\nThis is rstanarm version 2.32.1\n\n\n- See https://mc-stan.org/rstanarm/articles/priors for changes to default priors!\n\n\n- Default priors may change, so it's safest to specify priors, even if equivalent to the defaults.\n\n\n- For execution on a local, multicore CPU with excess RAM we recommend calling\n\n\n options(mc.cores = parallel::detectCores())\n\n\n\nAttaching package: 'rstanarm'\n\n\nThe following object is masked from 'package:fixest':\n\n se\n\nmod <- stan_glm(am ~ hp + drat, data = mtcars)\n\n\nget_estimates(mod)\n\n term estimate mad conf.level conf.low conf.high prior.distribution prior.location prior.scale group std.error statistic p.value\n1 (Intercept) -2.2246277000 0.599969846 0.95 -3.433826756 -1.055312644 normal 0.40625 1.24747729 NA NA NA\n2 hp 0.0006919802 0.001109785 0.95 -0.001499742 0.002809575 normal 0.00000 0.01819465 NA NA NA\n3 drat 0.7030982373 0.139586860 0.95 0.434089902 0.984676752 normal 0.00000 2.33313429 NA NA NA\n\n\nThis shows that there is no std.error column, but that there is a mad statistic (mean absolute deviation). So we can do:\n\nmodelsummary(mod, statistic = \"mad\")\n\nWarning: \n`modelsummary` uses the `performance` package to extract goodness-of-fit\nstatistics from models of this class. You can specify the statistics you wish\nto compute by supplying a `metrics` argument to `modelsummary`, which will then\npush it forward to `performance`. Acceptable values are: \"all\", \"common\",\n\"none\", or a character vector of metrics names. For example: `modelsummary(mod,\nmetrics = c(\"RMSE\", \"R2\")` Note that some metrics are computationally\nexpensive. See `?performance::performance` for details.\n This warning appears once per session.\n\n\n \n\n \n \n\ntinytable_qnegdj09ycari5ihgf74\n\n\n \n\n \n (1)\n \n\n\n(Intercept)\n -2.225 \n \n\n \n (0.600)\n \n\nhp \n 0.001 \n \n\n \n (0.001)\n \n\ndrat \n 0.703 \n \n\n \n (0.140)\n \n\nNum.Obs. \n 32 \n \n\nR2 \n 0.497 \n \n\nR2 Adj. \n 0.431 \n \n\nLog.Lik. \n -12.071\n \n\nELPD \n -15.2 \n \n\nELPD s.e. \n 3.1 \n \n\nLOOIC \n 30.4 \n \n\nLOOIC s.e. \n 6.2 \n \n\nWAIC \n 30.1 \n \n\nRMSE \n 0.34 \n \n\n\n\n\n \n\n\nAs noted in the modelsummary() documentation, model results are extracted using the parameters package. Users can pass additional arguments to modelsummary(), which will then push forward those arguments to the parameters::parameters function to change the results. For example, the parameters documentation for bayesian models shows that there is a centrality argument, which allows users to report the mean and standard deviation of the posterior distribution, instead of the median and MAD:\n\nget_estimates(mod, centrality = \"mean\")\n\n term estimate std.dev conf.level conf.low conf.high prior.distribution prior.location prior.scale group std.error statistic p.value\n1 (Intercept) -2.2256516592 0.604144261 0.95 -3.433826756 -1.055312644 normal 0.40625 1.24747729 NA NA NA\n2 hp 0.0006990604 0.001121095 0.95 -0.001499742 0.002809575 normal 0.00000 0.01819465 NA NA NA\n3 drat 0.7031661013 0.140682478 0.95 0.434089902 0.984676752 normal 0.00000 2.33313429 NA NA NA\n\nmodelsummary(mod, statistic = \"std.dev\", centrality = \"mean\")\n\n \n\n \n \n\ntinytable_yo5obmqtlumjxzrgh4yf\n\n\n \n\n \n (1)\n \n\n\n(Intercept)\n -2.226 \n \n\n \n (0.604)\n \n\nhp \n 0.001 \n \n\n \n (0.001)\n \n\ndrat \n 0.703 \n \n\n \n (0.141)\n \n\nNum.Obs. \n 32 \n \n\nR2 \n 0.497 \n \n\nR2 Adj. \n 0.431 \n \n\nLog.Lik. \n -12.071\n \n\nELPD \n -15.2 \n \n\nELPD s.e. \n 3.1 \n \n\nLOOIC \n 30.4 \n \n\nLOOIC s.e. \n 6.2 \n \n\nWAIC \n 30.1 \n \n\nRMSE \n 0.34 \n \n\n\n\n\n \n\n\nWe can also get additional test statistics using the test argument:\n\nget_estimates(mod, test = c(\"pd\", \"rope\"))\n\n term estimate mad conf.level conf.low conf.high pd rope.percentage prior.distribution prior.location prior.scale group std.error statistic p.value\n1 (Intercept) -2.2246277000 0.599969846 0.95 -3.433826756 -1.055312644 0.9995 0 normal 0.40625 1.24747729 NA NA NA\n2 hp 0.0006919802 0.001109785 0.95 -0.001499742 0.002809575 0.7330 1 normal 0.00000 0.01819465 NA NA NA\n3 drat 0.7030982373 0.139586860 0.95 0.434089902 0.984676752 1.0000 0 normal 0.00000 2.33313429 NA NA NA", + "text": "Bayesian models\nMany bayesian models are supported out-of-the-box, including those produced by the rstanarm and brms packages. The statistics available for bayesian models are slightly different than those available for most frequentist models. Users can call get_estimates to see what is available:\n\nlibrary(rstanarm)\n\nThis is rstanarm version 2.32.1\n\n\n- See https://mc-stan.org/rstanarm/articles/priors for changes to default priors!\n\n\n- Default priors may change, so it's safest to specify priors, even if equivalent to the defaults.\n\n\n- For execution on a local, multicore CPU with excess RAM we recommend calling\n\n\n options(mc.cores = parallel::detectCores())\n\n\n\nAttaching package: 'rstanarm'\n\n\nThe following object is masked from 'package:fixest':\n\n se\n\nmod <- stan_glm(am ~ hp + drat, data = mtcars)\n\n\nget_estimates(mod)\n\n term estimate mad conf.level conf.low conf.high prior.distribution prior.location prior.scale group std.error statistic p.value\n1 (Intercept) -2.1971590667 0.57768137 0.95 -3.334876772 -1.105943165 normal 0.40625 1.24747729 NA NA NA\n2 hp 0.0006333653 0.00105191 0.95 -0.001422686 0.002819079 normal 0.00000 0.01819465 NA NA NA\n3 drat 0.6992566587 0.13402411 0.95 0.437680965 0.969048697 normal 0.00000 2.33313429 NA NA NA\n\n\nThis shows that there is no std.error column, but that there is a mad statistic (mean absolute deviation). So we can do:\n\nmodelsummary(mod, statistic = \"mad\")\n\nWarning: \n`modelsummary` uses the `performance` package to extract goodness-of-fit\nstatistics from models of this class. You can specify the statistics you wish\nto compute by supplying a `metrics` argument to `modelsummary`, which will then\npush it forward to `performance`. Acceptable values are: \"all\", \"common\",\n\"none\", or a character vector of metrics names. For example: `modelsummary(mod,\nmetrics = c(\"RMSE\", \"R2\")` Note that some metrics are computationally\nexpensive. See `?performance::performance` for details.\n This warning appears once per session.\n\n\n \n\n \n \n\ntinytable_r1vayi7jelm981qpeb1x\n\n\n \n\n \n (1)\n \n\n\n(Intercept)\n -2.197 \n \n\n \n (0.578)\n \n\nhp \n 0.001 \n \n\n \n (0.001)\n \n\ndrat \n 0.699 \n \n\n \n (0.134)\n \n\nNum.Obs. \n 32 \n \n\nR2 \n 0.495 \n \n\nR2 Adj. \n 0.437 \n \n\nLog.Lik. \n -12.133\n \n\nELPD \n -15.1 \n \n\nELPD s.e. \n 3.1 \n \n\nLOOIC \n 30.2 \n \n\nLOOIC s.e. \n 6.2 \n \n\nWAIC \n 30.1 \n \n\nRMSE \n 0.34 \n \n\n\n\n\n \n\n\nAs noted in the modelsummary() documentation, model results are extracted using the parameters package. Users can pass additional arguments to modelsummary(), which will then push forward those arguments to the parameters::parameters function to change the results. For example, the parameters documentation for bayesian models shows that there is a centrality argument, which allows users to report the mean and standard deviation of the posterior distribution, instead of the median and MAD:\n\nget_estimates(mod, centrality = \"mean\")\n\n term estimate std.dev conf.level conf.low conf.high prior.distribution prior.location prior.scale group std.error statistic p.value\n1 (Intercept) -2.2124440913 0.579236863 0.95 -3.334876772 -1.105943165 normal 0.40625 1.24747729 NA NA NA\n2 hp 0.0006557409 0.001073215 0.95 -0.001422686 0.002819079 normal 0.00000 0.01819465 NA NA NA\n3 drat 0.7008098831 0.136555046 0.95 0.437680965 0.969048697 normal 0.00000 2.33313429 NA NA NA\n\nmodelsummary(mod, statistic = \"std.dev\", centrality = \"mean\")\n\n \n\n \n \n\ntinytable_89ye4dcynow3zz9elow2\n\n\n \n\n \n (1)\n \n\n\n(Intercept)\n -2.212 \n \n\n \n (0.579)\n \n\nhp \n 0.001 \n \n\n \n (0.001)\n \n\ndrat \n 0.701 \n \n\n \n (0.137)\n \n\nNum.Obs. \n 32 \n \n\nR2 \n 0.495 \n \n\nR2 Adj. \n 0.437 \n \n\nLog.Lik. \n -12.133\n \n\nELPD \n -15.1 \n \n\nELPD s.e. \n 3.1 \n \n\nLOOIC \n 30.2 \n \n\nLOOIC s.e. \n 6.2 \n \n\nWAIC \n 30.1 \n \n\nRMSE \n 0.34 \n \n\n\n\n\n \n\n\nWe can also get additional test statistics using the test argument:\n\nget_estimates(mod, test = c(\"pd\", \"rope\"))\n\n term estimate mad conf.level conf.low conf.high pd rope.percentage prior.distribution prior.location prior.scale group std.error statistic p.value\n1 (Intercept) -2.1971590667 0.57768137 0.95 -3.334876772 -1.105943165 0.9995 0 normal 0.40625 1.24747729 NA NA NA\n2 hp 0.0006333653 0.00105191 0.95 -0.001422686 0.002819079 0.7270 1 normal 0.00000 0.01819465 NA NA NA\n3 drat 0.6992566587 0.13402411 0.95 0.437680965 0.969048697 1.0000 0 normal 0.00000 2.33313429 NA NA NA", "crumbs": [ "Get started", "Model Summaries" @@ -1419,7 +1419,7 @@ "href": "vignettes/datasummary.html#custom-summary-functions", "title": "Data Summaries", "section": "Custom summary functions", - "text": "Custom summary functions\nThe Mean function is a shortcut supplied by modelsummary, and it is equivalent to mean(x,na.rm=TRUE). Since the flipper_length_mm variable includes missing observation, using the mean formula (with default na.rm=FALSE) would produce a missing/empty cell:\n\ndatasummary(flipper_length_mm ~ mean,\n data = penguins)\n\n \n\n \n \n\ntinytable_j5v7hmg8vynw9ut2e8lx\n\n\n \n\n \n mean\n \n\nflipper_length_mm\n \n \n\n\n\n \n\n\nmodelsummary supplies these functions: Mean, SD, Min, Max, Median, P0, P25, P50, P75, P100, Histogram, and a few more (see the package documentation).\nUsers are also free to create and use their own custom summaries. Any R function which takes a vector and produces a single value is acceptable. For example, the Range functions return a numerical value, and the MinMax returns a string:\n\nRange <- function(x) max(x, na.rm = TRUE) - min(x, na.rm = TRUE)\n\ndatasummary(flipper_length_mm ~ Range,\n data = penguins)\n\n \n\n \n \n\ntinytable_7mdf14epg6tplt7461i1\n\n\n \n\n \n Range\n \n\nflipper_length_mm\n 59.00\n \n\n\n\n \n\nMinMax <- function(x) paste0('[', min(x, na.rm = TRUE), ', ', max(x, na.rm = TRUE), ']')\n\ndatasummary(flipper_length_mm ~ MinMax,\n data = penguins)\n\n \n\n \n \n\ntinytable_078za3ozts6f5b69kczq\n\n\n \n\n \n MinMax\n \n\nflipper_length_mm\n [172, 231]", + "text": "Custom summary functions\nThe Mean function is a shortcut supplied by modelsummary, and it is equivalent to mean(x,na.rm=TRUE). Since the flipper_length_mm variable includes missing observation, using the mean formula (with default na.rm=FALSE) would produce a missing/empty cell:\n\ndatasummary(flipper_length_mm ~ mean,\n data = penguins)\n\n \n\n \n \n\ntinytable_ujlh99j6r39njwqr68rb\n\n\n \n\n \n mean\n \n\nflipper_length_mm\n \n \n\n\n\n \n\n\nmodelsummary supplies these functions: Mean, SD, Min, Max, Median, P0, P25, P50, P75, P100, Histogram, and a few more (see the package documentation).\nUsers are also free to create and use their own custom summaries. Any R function which takes a vector and produces a single value is acceptable. For example, the Range functions return a numerical value, and the MinMax returns a string:\n\nRange <- function(x) max(x, na.rm = TRUE) - min(x, na.rm = TRUE)\n\ndatasummary(flipper_length_mm ~ Range,\n data = penguins)\n\n \n\n \n \n\ntinytable_7f6louttieuzdq67awtk\n\n\n \n\n \n Range\n \n\nflipper_length_mm\n 59.00\n \n\n\n\n \n\nMinMax <- function(x) paste0('[', min(x, na.rm = TRUE), ', ', max(x, na.rm = TRUE), ']')\n\ndatasummary(flipper_length_mm ~ MinMax,\n data = penguins)\n\n \n\n \n \n\ntinytable_v00ecm16vt4dolwhr0ui\n\n\n \n\n \n MinMax\n \n\nflipper_length_mm\n [172, 231]", "crumbs": [ "Get started", "Data Summaries" @@ -1430,7 +1430,7 @@ "href": "vignettes/datasummary.html#concatenating-with", "title": "Data Summaries", "section": "Concatenating with +\n", - "text": "Concatenating with +\n\nTo include more rows and columns, we use the + sign:\n\ndatasummary(flipper_length_mm + body_mass_g ~ Mean + SD,\n data = penguins)\n\n \n\n \n \n\ntinytable_4ndr0ikwtgv4ym7nlxgg\n\n\n \n\n \n Mean\n SD\n \n\n\nflipper_length_mm\n 200.92 \n 14.06 \n \n\nbody_mass_g \n 4201.75\n 801.95\n \n\n\n\n\n \n\n\nSometimes, it can be cumbersome to list all variables separated by + signs. The All() function is a useful shortcut:\n\ndatasummary(All(penguins) ~ Mean + SD,\n data = penguins)\n\n \n\n \n \n\ntinytable_0lrl0y7y9a6aetp3h30z\n\n\n \n\n \n Mean\n SD\n \n\n\nrownames \n 172.50 \n 99.45 \n \n\nbill_length_mm \n 43.92 \n 5.46 \n \n\nbill_depth_mm \n 17.15 \n 1.97 \n \n\nflipper_length_mm\n 200.92 \n 14.06 \n \n\nbody_mass_g \n 4201.75\n 801.95\n \n\nyear \n 2008.03\n 0.82 \n \n\n\n\n\n \n\n\nBy default, All selects all numeric variables. This behavior can be changed by modifying the function’s arguments. See ?All for details.", + "text": "Concatenating with +\n\nTo include more rows and columns, we use the + sign:\n\ndatasummary(flipper_length_mm + body_mass_g ~ Mean + SD,\n data = penguins)\n\n \n\n \n \n\ntinytable_k9caxbs5kadtfjt2qdxa\n\n\n \n\n \n Mean\n SD\n \n\n\nflipper_length_mm\n 200.92 \n 14.06 \n \n\nbody_mass_g \n 4201.75\n 801.95\n \n\n\n\n\n \n\n\nSometimes, it can be cumbersome to list all variables separated by + signs. The All() function is a useful shortcut:\n\ndatasummary(All(penguins) ~ Mean + SD,\n data = penguins)\n\n \n\n \n \n\ntinytable_stkwuzlxydvsy4ns2jbh\n\n\n \n\n \n Mean\n SD\n \n\n\nrownames \n 172.50 \n 99.45 \n \n\nbill_length_mm \n 43.92 \n 5.46 \n \n\nbill_depth_mm \n 17.15 \n 1.97 \n \n\nflipper_length_mm\n 200.92 \n 14.06 \n \n\nbody_mass_g \n 4201.75\n 801.95\n \n\nyear \n 2008.03\n 0.82 \n \n\n\n\n\n \n\n\nBy default, All selects all numeric variables. This behavior can be changed by modifying the function’s arguments. See ?All for details.", "crumbs": [ "Get started", "Data Summaries" @@ -1441,7 +1441,7 @@ "href": "vignettes/datasummary.html#nesting-with", "title": "Data Summaries", "section": "Nesting with *\n", - "text": "Nesting with *\n\ndatasummary can nest variables and statistics inside categorical variables using the * symbol. When applying the the * operator to factor, character, or logical variables, columns or rows will automatically be nested. For instance, if we want to display separate means for each value of the variable sex, we use mean * sex:\n\ndatasummary(flipper_length_mm + body_mass_g ~ mean * sex,\n data = penguins)\n\n \n\n \n \n\ntinytable_gmpomhntrat7k9d0i4e3\n\n\n \n\n \n female\n male\n \n\n\nflipper_length_mm\n 197.36 \n 204.51 \n \n\nbody_mass_g \n 3862.27\n 4545.68\n \n\n\n\n\n \n\n\nWe can use parentheses to nest several terms inside one another, using a call of this form: x * (y + z). Here is an example with nested columns:\n\ndatasummary(body_mass_g ~ sex * (mean + sd),\n data = penguins)\n\n \n\n \n \n\ntinytable_61gfvsq6e63e6kvnf1gv\n\n\n \n\n\n \nfemale\nmale\n\n\n \n mean\n sd\n mean\n sd\n \n\n\nbody_mass_g\n 3862.27\n 666.17\n 4545.68\n 787.63\n \n\n\n\n \n\n\nHere is an example with nested rows:\n\ndatasummary(sex * (body_mass_g + flipper_length_mm) ~ mean + sd,\n data = penguins)\n\n \n\n \n \n\ntinytable_5g2gknzl8ajp7jr2aw6y\n\n\n \n\nsex\n \n mean\n sd\n \n\n\nfemale\n body_mass_g \n 3862.27\n 666.17\n \n\n \n flipper_length_mm\n 197.36 \n 12.50 \n \n\nmale \n body_mass_g \n 4545.68\n 787.63\n \n\n \n flipper_length_mm\n 204.51 \n 14.55 \n \n\n\n\n\n \n\n\nThe order in which terms enter the formula determines the order in which labels are displayed. For example, this shows island above sex:\n\ndatasummary(flipper_length_mm + body_mass_g ~ mean * island * sex,\n data = penguins)\n\n \n\n \n \n\ntinytable_2o40nh8kxq8yip355hnc\n\n\n \n\n\n \nBiscoe\nDream\nTorgersen\n\n\n \n female\n male\n female\n male\n female\n male\n \n\n\n\nflipper_length_mm\n 205.69 \n 213.29 \n 190.02 \n 196.31 \n 188.29 \n 194.91 \n \n\nbody_mass_g \n 4319.38\n 5104.52\n 3446.31\n 3987.10\n 3395.83\n 4034.78\n \n\n\n\n\n \n\n\nThis shows sex above island values:\n\ndatasummary(flipper_length_mm + body_mass_g ~ mean * sex * island,\n data = penguins)\n\n \n\n \n \n\ntinytable_kpuz8qlbcbo5tfrcs1td\n\n\n \n\n\n \nfemale\nmale\n\n\n \n Biscoe\n Dream\n Torgersen\n Biscoe\n Dream\n Torgersen\n \n\n\n\nflipper_length_mm\n 205.69 \n 190.02 \n 188.29 \n 213.29 \n 196.31 \n 194.91 \n \n\nbody_mass_g \n 4319.38\n 3446.31\n 3395.83\n 5104.52\n 3987.10\n 4034.78\n \n\n\n\n\n \n\n\nBy default, datasummary omits column headers with a single value/label across all columns, except for the header that sits just above the data. If the header we want to see is not displayed, we may want to reorder the terms of the formula. To show all headers, set sparse_header=FALSE:\n\ndatasummary(flipper_length_mm + body_mass_g ~ mean * sex * island,\n data = penguins,\n sparse_header = FALSE)\n\n \n\n \n \n\ntinytable_1g19moklboiz58hvaspq\n\n\n \n\n\n \nfemale\nmale\n\n\n \n Biscoe\n Dream\n Torgersen\n Biscoe\n Dream\n Torgersen\n \n\n\n\nflipper_length_mm\n 205.69 \n 190.02 \n 188.29 \n 213.29 \n 196.31 \n 194.91 \n \n\nbody_mass_g \n 4319.38\n 3446.31\n 3395.83\n 5104.52\n 3987.10\n 4034.78\n \n\n\n\n\n \n\n\nWhen using sparse_header=FALSE, it is often useful to insert Heading() * in the table formula, in order to rename or omit some of the labels manually. Type ?tables::Heading for details and examples.", + "text": "Nesting with *\n\ndatasummary can nest variables and statistics inside categorical variables using the * symbol. When applying the the * operator to factor, character, or logical variables, columns or rows will automatically be nested. For instance, if we want to display separate means for each value of the variable sex, we use mean * sex:\n\ndatasummary(flipper_length_mm + body_mass_g ~ mean * sex,\n data = penguins)\n\n \n\n \n \n\ntinytable_tmyrfjvbvpjqcmxkglqr\n\n\n \n\n \n female\n male\n \n\n\nflipper_length_mm\n 197.36 \n 204.51 \n \n\nbody_mass_g \n 3862.27\n 4545.68\n \n\n\n\n\n \n\n\nWe can use parentheses to nest several terms inside one another, using a call of this form: x * (y + z). Here is an example with nested columns:\n\ndatasummary(body_mass_g ~ sex * (mean + sd),\n data = penguins)\n\n \n\n \n \n\ntinytable_m4yifvil1lpu998ia1a6\n\n\n \n\n\n \nfemale\nmale\n\n\n \n mean\n sd\n mean\n sd\n \n\n\nbody_mass_g\n 3862.27\n 666.17\n 4545.68\n 787.63\n \n\n\n\n \n\n\nHere is an example with nested rows:\n\ndatasummary(sex * (body_mass_g + flipper_length_mm) ~ mean + sd,\n data = penguins)\n\n \n\n \n \n\ntinytable_ey8pqh5qs8j5jvmhicf7\n\n\n \n\nsex\n \n mean\n sd\n \n\n\nfemale\n body_mass_g \n 3862.27\n 666.17\n \n\n \n flipper_length_mm\n 197.36 \n 12.50 \n \n\nmale \n body_mass_g \n 4545.68\n 787.63\n \n\n \n flipper_length_mm\n 204.51 \n 14.55 \n \n\n\n\n\n \n\n\nThe order in which terms enter the formula determines the order in which labels are displayed. For example, this shows island above sex:\n\ndatasummary(flipper_length_mm + body_mass_g ~ mean * island * sex,\n data = penguins)\n\n \n\n \n \n\ntinytable_sxcetvov6yvb3w2wbjut\n\n\n \n\n\n \nBiscoe\nDream\nTorgersen\n\n\n \n female\n male\n female\n male\n female\n male\n \n\n\n\nflipper_length_mm\n 205.69 \n 213.29 \n 190.02 \n 196.31 \n 188.29 \n 194.91 \n \n\nbody_mass_g \n 4319.38\n 5104.52\n 3446.31\n 3987.10\n 3395.83\n 4034.78\n \n\n\n\n\n \n\n\nThis shows sex above island values:\n\ndatasummary(flipper_length_mm + body_mass_g ~ mean * sex * island,\n data = penguins)\n\n \n\n \n \n\ntinytable_si3izgn8vcbesjbi6gjk\n\n\n \n\n\n \nfemale\nmale\n\n\n \n Biscoe\n Dream\n Torgersen\n Biscoe\n Dream\n Torgersen\n \n\n\n\nflipper_length_mm\n 205.69 \n 190.02 \n 188.29 \n 213.29 \n 196.31 \n 194.91 \n \n\nbody_mass_g \n 4319.38\n 3446.31\n 3395.83\n 5104.52\n 3987.10\n 4034.78\n \n\n\n\n\n \n\n\nBy default, datasummary omits column headers with a single value/label across all columns, except for the header that sits just above the data. If the header we want to see is not displayed, we may want to reorder the terms of the formula. To show all headers, set sparse_header=FALSE:\n\ndatasummary(flipper_length_mm + body_mass_g ~ mean * sex * island,\n data = penguins,\n sparse_header = FALSE)\n\n \n\n \n \n\ntinytable_kegb4vo01ajf4bmqqiec\n\n\n \n\n\n \nfemale\nmale\n\n\n \n Biscoe\n Dream\n Torgersen\n Biscoe\n Dream\n Torgersen\n \n\n\n\nflipper_length_mm\n 205.69 \n 190.02 \n 188.29 \n 213.29 \n 196.31 \n 194.91 \n \n\nbody_mass_g \n 4319.38\n 3446.31\n 3395.83\n 5104.52\n 3987.10\n 4034.78\n \n\n\n\n\n \n\n\nWhen using sparse_header=FALSE, it is often useful to insert Heading() * in the table formula, in order to rename or omit some of the labels manually. Type ?tables::Heading for details and examples.", "crumbs": [ "Get started", "Data Summaries" @@ -1452,7 +1452,7 @@ "href": "vignettes/datasummary.html#renaming-with", "title": "Data Summaries", "section": "Renaming with =\n", - "text": "Renaming with =\n\nPersonally, I prefer to rename variables and values before drawing my tables, using backticks when variable names include whitespace. For example,\n\ntmp <- penguins %>%\n select(`Flipper length (mm)` = flipper_length_mm,\n `Body mass (g)` = body_mass_g)\n\ndatasummary(`Flipper length (mm)` + `Body mass (g)` ~ Mean + SD,\n data = tmp)\n\n \n\n \n \n\ntinytable_0dlbmbfoujhcltzgn62l\n\n\n \n\n \n Mean\n SD\n \n\n\nFlipper length (mm)\n 200.92 \n 14.06 \n \n\nBody mass (g) \n 4201.75\n 801.95\n \n\n\n\n\n \n\n\nHowever, thanks to the tables package, datasummary offers two additional mechanisms to rename. First, we can wrap a term in parentheses and use the equal = sign: (NewName=OldName):\n\ndatasummary((`Flipper length (mm)` = flipper_length_mm) + (`Body mass (g)` = body_mass_g) ~\n island * ((Avg. = Mean) + (Std.Dev. = SD)),\n data = penguins)\n\n \n\n \n \n\ntinytable_4lg5ajybsnt7mc21r5tt\n\n\n \n\n\n \nBiscoe\nDream\nTorgersen\n\n\n \n Avg.\n Std.Dev.\n Avg.\n Std.Dev.\n Avg.\n Std.Dev.\n \n\n\n\nFlipper length (mm)\n 209.71 \n 14.14 \n 193.07 \n 7.51 \n 191.20 \n 6.23 \n \n\nBody mass (g) \n 4716.02\n 782.86\n 3712.90\n 416.64\n 3706.37\n 445.11\n \n\n\n\n\n \n\n\nSecond, we can use the Heading() function:\n\ndatasummary(Heading(\"Flipper length (mm)\") * flipper_length_mm + Heading(\"Body mass (g)\") * body_mass_g ~ island * (Mean + SD),\n data = penguins)\n\n \n\n \n \n\ntinytable_prmzsvq6vsc6j93abpup\n\n\n \n\n\n \nBiscoe\nDream\nTorgersen\n\n\n \n Mean\n SD\n Mean\n SD\n Mean\n SD\n \n\n\n\nFlipper length (mm)\n 209.71 \n 14.14 \n 193.07 \n 7.51 \n 191.20 \n 6.23 \n \n\nBody mass (g) \n 4716.02\n 782.86\n 3712.90\n 416.64\n 3706.37\n 445.11\n \n\n\n\n\n \n\n\nThe Heading function also has a nearData argument which can be useful in cases where some rows are nested but others are not. Compare the last row of these two tables:\n\ndatasummary(sex * (flipper_length_mm + bill_length_mm) + Heading(\"Body mass (g)\") * body_mass_g ~ Mean + SD,\n data = penguins)\n\n \n\n \n \n\ntinytable_shg3lq1fzassz2vtqz4c\n\n\n \n\nsex\n \n Mean\n SD\n \n\n\nfemale\n flipper_length_mm\n 197.36 \n 12.50 \n \n\n \n bill_length_mm \n 42.10 \n 4.90 \n \n\nmale \n flipper_length_mm\n 204.51 \n 14.55 \n \n\n \n bill_length_mm \n 45.85 \n 5.37 \n \n\n \n Body mass (g) \n 4201.75\n 801.95\n \n\n\n\n\n \n\ndatasummary(sex * (flipper_length_mm + bill_length_mm) + Heading(\"Body mass (g)\", nearData=FALSE) * body_mass_g ~ Mean + SD,\n data = penguins)\n\n \n\n \n \n\ntinytable_1jwng5p5tqqkn755em2n\n\n\n \n\nsex\n \n Mean\n SD\n \n\n\nfemale \n flipper_length_mm\n 197.36 \n 12.50 \n \n\n \n bill_length_mm \n 42.10 \n 4.90 \n \n\nmale \n flipper_length_mm\n 204.51 \n 14.55 \n \n\n \n bill_length_mm \n 45.85 \n 5.37 \n \n\nBody mass (g)\n \n 4201.75\n 801.95", + "text": "Renaming with =\n\nPersonally, I prefer to rename variables and values before drawing my tables, using backticks when variable names include whitespace. For example,\n\ntmp <- penguins %>%\n select(`Flipper length (mm)` = flipper_length_mm,\n `Body mass (g)` = body_mass_g)\n\ndatasummary(`Flipper length (mm)` + `Body mass (g)` ~ Mean + SD,\n data = tmp)\n\n \n\n \n \n\ntinytable_iumsxlta6zg41ityra0j\n\n\n \n\n \n Mean\n SD\n \n\n\nFlipper length (mm)\n 200.92 \n 14.06 \n \n\nBody mass (g) \n 4201.75\n 801.95\n \n\n\n\n\n \n\n\nHowever, thanks to the tables package, datasummary offers two additional mechanisms to rename. First, we can wrap a term in parentheses and use the equal = sign: (NewName=OldName):\n\ndatasummary((`Flipper length (mm)` = flipper_length_mm) + (`Body mass (g)` = body_mass_g) ~\n island * ((Avg. = Mean) + (Std.Dev. = SD)),\n data = penguins)\n\n \n\n \n \n\ntinytable_elradgsleqqzq2dnm9z0\n\n\n \n\n\n \nBiscoe\nDream\nTorgersen\n\n\n \n Avg.\n Std.Dev.\n Avg.\n Std.Dev.\n Avg.\n Std.Dev.\n \n\n\n\nFlipper length (mm)\n 209.71 \n 14.14 \n 193.07 \n 7.51 \n 191.20 \n 6.23 \n \n\nBody mass (g) \n 4716.02\n 782.86\n 3712.90\n 416.64\n 3706.37\n 445.11\n \n\n\n\n\n \n\n\nSecond, we can use the Heading() function:\n\ndatasummary(Heading(\"Flipper length (mm)\") * flipper_length_mm + Heading(\"Body mass (g)\") * body_mass_g ~ island * (Mean + SD),\n data = penguins)\n\n \n\n \n \n\ntinytable_mk2hpc9z6m2zcgucz5xh\n\n\n \n\n\n \nBiscoe\nDream\nTorgersen\n\n\n \n Mean\n SD\n Mean\n SD\n Mean\n SD\n \n\n\n\nFlipper length (mm)\n 209.71 \n 14.14 \n 193.07 \n 7.51 \n 191.20 \n 6.23 \n \n\nBody mass (g) \n 4716.02\n 782.86\n 3712.90\n 416.64\n 3706.37\n 445.11\n \n\n\n\n\n \n\n\nThe Heading function also has a nearData argument which can be useful in cases where some rows are nested but others are not. Compare the last row of these two tables:\n\ndatasummary(sex * (flipper_length_mm + bill_length_mm) + Heading(\"Body mass (g)\") * body_mass_g ~ Mean + SD,\n data = penguins)\n\n \n\n \n \n\ntinytable_n3lurag5cccmmajojyk2\n\n\n \n\nsex\n \n Mean\n SD\n \n\n\nfemale\n flipper_length_mm\n 197.36 \n 12.50 \n \n\n \n bill_length_mm \n 42.10 \n 4.90 \n \n\nmale \n flipper_length_mm\n 204.51 \n 14.55 \n \n\n \n bill_length_mm \n 45.85 \n 5.37 \n \n\n \n Body mass (g) \n 4201.75\n 801.95\n \n\n\n\n\n \n\ndatasummary(sex * (flipper_length_mm + bill_length_mm) + Heading(\"Body mass (g)\", nearData=FALSE) * body_mass_g ~ Mean + SD,\n data = penguins)\n\n \n\n \n \n\ntinytable_ck5sgz7fpby2tzdv1tmf\n\n\n \n\nsex\n \n Mean\n SD\n \n\n\nfemale \n flipper_length_mm\n 197.36 \n 12.50 \n \n\n \n bill_length_mm \n 42.10 \n 4.90 \n \n\nmale \n flipper_length_mm\n 204.51 \n 14.55 \n \n\n \n bill_length_mm \n 45.85 \n 5.37 \n \n\nBody mass (g)\n \n 4201.75\n 801.95", "crumbs": [ "Get started", "Data Summaries" @@ -1463,7 +1463,7 @@ "href": "vignettes/datasummary.html#counts-and-percentages", "title": "Data Summaries", "section": "Counts and Percentages", - "text": "Counts and Percentages\nThe tables package allows datasummary to use neat tricks to produce frequency tables:\n\nAdd a N to the right-hand side of the equation.\nAdd Percent() to the right-hand side to calculate the percentage of observations in each cell.\nAdd 1 to the left-hand side to include a row with the total number of observations:\n\n\ndatasummary(species * sex + 1 ~ N + Percent(),\n data = penguins)\n\n \n\n \n \n\ntinytable_iuhxhtuns5dzwes76shk\n\n\n \n\nspecies\n sex\n N\n Percent\n \n\n\nAdelie \n female\n 73 \n 21.22 \n \n\n \n male \n 73 \n 21.22 \n \n\nChinstrap\n female\n 34 \n 9.88 \n \n\n \n male \n 34 \n 9.88 \n \n\nGentoo \n female\n 58 \n 16.86 \n \n\n \n male \n 61 \n 17.73 \n \n\n \n All \n 344\n 100.00\n \n\n\n\n\n \n\n\nNote that the Percent() function accepts a denom argument to determine if percentages should be calculated row or column-wise, or if they should take into account all cells.", + "text": "Counts and Percentages\nThe tables package allows datasummary to use neat tricks to produce frequency tables:\n\nAdd a N to the right-hand side of the equation.\nAdd Percent() to the right-hand side to calculate the percentage of observations in each cell.\nAdd 1 to the left-hand side to include a row with the total number of observations:\n\n\ndatasummary(species * sex + 1 ~ N + Percent(),\n data = penguins)\n\n \n\n \n \n\ntinytable_eq61q01iaatkuz23z13r\n\n\n \n\nspecies\n sex\n N\n Percent\n \n\n\nAdelie \n female\n 73 \n 21.22 \n \n\n \n male \n 73 \n 21.22 \n \n\nChinstrap\n female\n 34 \n 9.88 \n \n\n \n male \n 34 \n 9.88 \n \n\nGentoo \n female\n 58 \n 16.86 \n \n\n \n male \n 61 \n 17.73 \n \n\n \n All \n 344\n 100.00\n \n\n\n\n\n \n\n\nNote that the Percent() function accepts a denom argument to determine if percentages should be calculated row or column-wise, or if they should take into account all cells.", "crumbs": [ "Get started", "Data Summaries" @@ -1474,7 +1474,7 @@ "href": "vignettes/datasummary.html#weighted-percentages", "title": "Data Summaries", "section": "Weighted percentages", - "text": "Weighted percentages\nThe Percent() pseudo-function also accepts a fn argument, which must be a function which accepts two vectors: x is the values in the current cell, and y is all the values in the whole dataset. The default fn is:\n\ndatasummary(species * sex + 1 ~ N + Percent(fn = function(x, y) 100 * length(x) / length(y)),\n data = penguins)\n\n \n\n \n \n\ntinytable_0mder98ikpie4acsvb3e\n\n\n \n\nspecies\n sex\n N\n Percent\n \n\n\nAdelie \n female\n 73 \n 21.22 \n \n\n \n male \n 73 \n 21.22 \n \n\nChinstrap\n female\n 34 \n 9.88 \n \n\n \n male \n 34 \n 9.88 \n \n\nGentoo \n female\n 58 \n 16.86 \n \n\n \n male \n 61 \n 17.73 \n \n\n \n All \n 344\n 100.00\n \n\n\n\n\n \n\n\nThe code above takes the number of elements in the cell length(x) and divides it by the number of total elements length(y).\nNow, let’s say we want to display percentages weighted by one of the variables of the dataset. This can often be useful with survey weights, for example. Here, we use an arbitrary column of weights called flipper_length_mm:\n\nwtpct <- function(x, y) sum(x, na.rm = TRUE) / sum(y, na.rm = TRUE) * 100\ndatasummary(species * sex + 1 ~ N + flipper_length_mm * Percent(fn = wtpct),\n data = penguins)\n\n \n\n \n \n\ntinytable_bk8prpbmxl80j6xwm16l\n\n\n \n\nspecies\n sex\n N\n Percent\n \n\n\nAdelie \n female\n 73 \n 19.95 \n \n\n \n male \n 73 \n 20.44 \n \n\nChinstrap\n female\n 34 \n 9.49 \n \n\n \n male \n 34 \n 9.89 \n \n\nGentoo \n female\n 58 \n 17.95 \n \n\n \n male \n 61 \n 19.67 \n \n\n \n All \n 344\n 100.00\n \n\n\n\n\n \n\n\nIn each cell we now have the sum of weights in that cell, divided by the total sum of weights in the column.", + "text": "Weighted percentages\nThe Percent() pseudo-function also accepts a fn argument, which must be a function which accepts two vectors: x is the values in the current cell, and y is all the values in the whole dataset. The default fn is:\n\ndatasummary(species * sex + 1 ~ N + Percent(fn = function(x, y) 100 * length(x) / length(y)),\n data = penguins)\n\n \n\n \n \n\ntinytable_ugg61a2fcw5fh73ssepo\n\n\n \n\nspecies\n sex\n N\n Percent\n \n\n\nAdelie \n female\n 73 \n 21.22 \n \n\n \n male \n 73 \n 21.22 \n \n\nChinstrap\n female\n 34 \n 9.88 \n \n\n \n male \n 34 \n 9.88 \n \n\nGentoo \n female\n 58 \n 16.86 \n \n\n \n male \n 61 \n 17.73 \n \n\n \n All \n 344\n 100.00\n \n\n\n\n\n \n\n\nThe code above takes the number of elements in the cell length(x) and divides it by the number of total elements length(y).\nNow, let’s say we want to display percentages weighted by one of the variables of the dataset. This can often be useful with survey weights, for example. Here, we use an arbitrary column of weights called flipper_length_mm:\n\nwtpct <- function(x, y) sum(x, na.rm = TRUE) / sum(y, na.rm = TRUE) * 100\ndatasummary(species * sex + 1 ~ N + flipper_length_mm * Percent(fn = wtpct),\n data = penguins)\n\n \n\n \n \n\ntinytable_ncj0pge4avt822em8vkz\n\n\n \n\nspecies\n sex\n N\n Percent\n \n\n\nAdelie \n female\n 73 \n 19.95 \n \n\n \n male \n 73 \n 20.44 \n \n\nChinstrap\n female\n 34 \n 9.49 \n \n\n \n male \n 34 \n 9.89 \n \n\nGentoo \n female\n 58 \n 17.95 \n \n\n \n male \n 61 \n 19.67 \n \n\n \n All \n 344\n 100.00\n \n\n\n\n\n \n\n\nIn each cell we now have the sum of weights in that cell, divided by the total sum of weights in the column.", "crumbs": [ "Get started", "Data Summaries" @@ -1485,7 +1485,7 @@ "href": "vignettes/datasummary.html#custom-percentages", "title": "Data Summaries", "section": "Custom percentages", - "text": "Custom percentages\nHere is another simple illustration of Percent function mechanism in action, where we combine counts and percentages in a simple nice label:\n\ndat <- mtcars\ndat$cyl <- as.factor(dat$cyl)\n\nfn <- function(x, y) {\n out <- sprintf(\n \"%s (%.1f%%)\",\n length(x),\n length(x) / length(y) * 100)\n}\ndatasummary(\n cyl ~ Percent(fn = fn),\n data = dat)\n\n \n\n \n \n\ntinytable_01n7279q4m7isxyc9p35\n\n\n \n\ncyl\n Percent\n \n\n\n4\n 11 (34.4%)\n \n\n6\n 7 (21.9%) \n \n\n8\n 14 (43.8%)", + "text": "Custom percentages\nHere is another simple illustration of Percent function mechanism in action, where we combine counts and percentages in a simple nice label:\n\ndat <- mtcars\ndat$cyl <- as.factor(dat$cyl)\n\nfn <- function(x, y) {\n out <- sprintf(\n \"%s (%.1f%%)\",\n length(x),\n length(x) / length(y) * 100)\n}\ndatasummary(\n cyl ~ Percent(fn = fn),\n data = dat)\n\n \n\n \n \n\ntinytable_u6xr06x66j9udy6bdbyj\n\n\n \n\ncyl\n Percent\n \n\n\n4\n 11 (34.4%)\n \n\n6\n 7 (21.9%) \n \n\n8\n 14 (43.8%)", "crumbs": [ "Get started", "Data Summaries" @@ -1496,7 +1496,7 @@ "href": "vignettes/datasummary.html#factor", "title": "Data Summaries", "section": "Factor", - "text": "Factor\nThe * nesting operator that we used above works automatically for factor, character, and logical variables. Sometimes, it is convenient to use it with other types of variables, such as binary numeric variables. In that case, we can wrap the variable name inside a call to Factor(). This allows us to treat a variable as factor, without having to modify it in the original data. For example, in the mtcars data, there is a binary numeric variable call am. We nest statistics within categories of am by typing:\n\ndatasummary(mpg + hp ~ Factor(am) * (mean + sd),\n data = mtcars)\n\n \n\n \n \n\ntinytable_bda7octedv0whbqafr4j\n\n\n \n\n\n \n0\n1\n\n\n \n mean\n sd\n mean\n sd\n \n\n\n\nmpg\n 17.15 \n 3.83 \n 24.39 \n 6.17 \n \n\nhp \n 160.26\n 53.91\n 126.85\n 84.06", + "text": "Factor\nThe * nesting operator that we used above works automatically for factor, character, and logical variables. Sometimes, it is convenient to use it with other types of variables, such as binary numeric variables. In that case, we can wrap the variable name inside a call to Factor(). This allows us to treat a variable as factor, without having to modify it in the original data. For example, in the mtcars data, there is a binary numeric variable call am. We nest statistics within categories of am by typing:\n\ndatasummary(mpg + hp ~ Factor(am) * (mean + sd),\n data = mtcars)\n\n \n\n \n \n\ntinytable_7jiapf7qjcmlxc4hhu1z\n\n\n \n\n\n \n0\n1\n\n\n \n mean\n sd\n mean\n sd\n \n\n\n\nmpg\n 17.15 \n 3.83 \n 24.39 \n 6.17 \n \n\nhp \n 160.26\n 53.91\n 126.85\n 84.06", "crumbs": [ "Get started", "Data Summaries" @@ -1507,7 +1507,7 @@ "href": "vignettes/datasummary.html#arguments-na.rmtrue", "title": "Data Summaries", "section": "\nArguments: na.rm=TRUE\n", - "text": "Arguments: na.rm=TRUE\n\nWe can pass any argument to the summary function by including a call to Arguments(). For instance, there are missing values in the flipper_length_mm variable of the penguins dataset. Therefore, the standard mean function will produce no result, because its default argument is na.rm=FALSE. We can change that by calling:\n\ndatasummary(flipper_length_mm ~ mean + mean*Arguments(na.rm=TRUE),\n data = penguins)\n\n \n\n \n \n\ntinytable_xb3z1hpx3lbrxr80f6d0\n\n\n \n\n \n mean\n mean \n \n\nflipper_length_mm\n \n 200.92\n \n\n\n\n \n\n\nNotice that there is an empty cell (NA) under the normal mean function, but that the mean call with Arguments(na.rm=TRUE) produced a numeric result.\nWe can pass the same arguments to multiple functions using the parentheses:\n\ndatasummary(flipper_length_mm ~ (mean + sd) * Arguments(na.rm=TRUE),\n data = penguins)\n\n \n\n \n \n\ntinytable_c9pct73bay4ctr12laor\n\n\n \n\n \n mean\n sd\n \n\nflipper_length_mm\n 200.92\n 14.06\n \n\n\n\n \n\n\nNote that the shortcut functions that modelsummary supplies use na.rm=TRUE by default, so we can use them directly without arguments, even when there are missing values:\n\ndatasummary(flipper_length_mm ~ Mean + Var + P75 + Range,\n data = penguins)\n\n \n\n \n \n\ntinytable_m288rwhi4akdjwnosozq\n\n\n \n\n \n Mean\n Var\n P75\n Range\n \n\nflipper_length_mm\n 200.92\n 197.73\n 213.00\n 59.00", + "text": "Arguments: na.rm=TRUE\n\nWe can pass any argument to the summary function by including a call to Arguments(). For instance, there are missing values in the flipper_length_mm variable of the penguins dataset. Therefore, the standard mean function will produce no result, because its default argument is na.rm=FALSE. We can change that by calling:\n\ndatasummary(flipper_length_mm ~ mean + mean*Arguments(na.rm=TRUE),\n data = penguins)\n\n \n\n \n \n\ntinytable_76pbdi9rf9pge3ij6nba\n\n\n \n\n \n mean\n mean \n \n\nflipper_length_mm\n \n 200.92\n \n\n\n\n \n\n\nNotice that there is an empty cell (NA) under the normal mean function, but that the mean call with Arguments(na.rm=TRUE) produced a numeric result.\nWe can pass the same arguments to multiple functions using the parentheses:\n\ndatasummary(flipper_length_mm ~ (mean + sd) * Arguments(na.rm=TRUE),\n data = penguins)\n\n \n\n \n \n\ntinytable_759htqlplz69gmk90hpj\n\n\n \n\n \n mean\n sd\n \n\nflipper_length_mm\n 200.92\n 14.06\n \n\n\n\n \n\n\nNote that the shortcut functions that modelsummary supplies use na.rm=TRUE by default, so we can use them directly without arguments, even when there are missing values:\n\ndatasummary(flipper_length_mm ~ Mean + Var + P75 + Range,\n data = penguins)\n\n \n\n \n \n\ntinytable_veqgpyihij7b0xdstw4v\n\n\n \n\n \n Mean\n Var\n P75\n Range\n \n\nflipper_length_mm\n 200.92\n 197.73\n 213.00\n 59.00", "crumbs": [ "Get started", "Data Summaries" @@ -1518,7 +1518,7 @@ "href": "vignettes/datasummary.html#arguments-weighted-mean", "title": "Data Summaries", "section": "\nArguments: Weighted Mean", - "text": "Arguments: Weighted Mean\nYou can use the Arguments mechanism to do various things, such as calculating weighted means:\n\nnewdata <- data.frame(\n x = rnorm(20),\n w = rnorm(20),\n y = rnorm(20))\n\ndatasummary(x + y ~ weighted.mean * Arguments(w = w),\n data = newdata)\n\n \n\n \n \n\ntinytable_f4z199extla26itetb57\n\n\n \n\n \n weighted.mean\n \n\n\nx\n 1.32 \n \n\ny\n -0.24\n \n\n\n\n\n \n\n\nWhich produces the same results as:\n\nweighted.mean(newdata$x, newdata$w)\n\n[1] 1.315068\n\nweighted.mean(newdata$y, newdata$w)\n\n[1] -0.236075\n\n\nBut different results from:\n\nmean(newdata$x)\n\n[1] 0.3049217\n\nmean(newdata$y)\n\n[1] -0.2411163", + "text": "Arguments: Weighted Mean\nYou can use the Arguments mechanism to do various things, such as calculating weighted means:\n\nnewdata <- data.frame(\n x = rnorm(20),\n w = rnorm(20),\n y = rnorm(20))\n\ndatasummary(x + y ~ weighted.mean * Arguments(w = w),\n data = newdata)\n\n \n\n \n \n\ntinytable_87jgtvlo97h3vw0n5e0f\n\n\n \n\n \n weighted.mean\n \n\n\nx\n 0.25\n \n\ny\n 0.81\n \n\n\n\n\n \n\n\nWhich produces the same results as:\n\nweighted.mean(newdata$x, newdata$w)\n\n[1] 0.2528909\n\nweighted.mean(newdata$y, newdata$w)\n\n[1] 0.8139608\n\n\nBut different results from:\n\nmean(newdata$x)\n\n[1] -0.07968538\n\nmean(newdata$y)\n\n[1] 0.03824354", "crumbs": [ "Get started", "Data Summaries" @@ -1529,7 +1529,7 @@ "href": "vignettes/datasummary.html#logical-subsets", "title": "Data Summaries", "section": "Logical subsets", - "text": "Logical subsets\nCool stuff is possible with logical subsets:\n\ndatasummary((bill_length_mm > 44.5) + (bill_length_mm <= 44.5) ~ Mean * flipper_length_mm,\n data = penguins)\n\n \n\n \n \n\ntinytable_pyhqf60nxviw80ohrhcv\n\n\n \n\n\n \n \n\n\nbill_length_mm > 44.5 \n 209.68\n \n\nbill_length_mm \n \n192.45\n \n\n\n\n\n \n\n\nSee the tables package documentation for more details and examples.", + "text": "Logical subsets\nCool stuff is possible with logical subsets:\n\ndatasummary((bill_length_mm > 44.5) + (bill_length_mm <= 44.5) ~ Mean * flipper_length_mm,\n data = penguins)\n\n \n\n \n \n\ntinytable_0mrj1qvmrwd2zjtvmftr\n\n\n \n\n\n \n \n\n\nbill_length_mm > 44.5 \n 209.68\n \n\nbill_length_mm \n \n192.45\n \n\n\n\n\n \n\n\nSee the tables package documentation for more details and examples.", "crumbs": [ "Get started", "Data Summaries" @@ -1540,7 +1540,7 @@ "href": "vignettes/datasummary.html#missing-values", "title": "Data Summaries", "section": "Missing values", - "text": "Missing values\nAt least 3 distinct issues can arise related to missing values.\nFunctions and na.rm\n\nAn empty cell can appear in the table when a statistical function returns NA instead of a numeric value. In those cases, you should:\n\nMake sure that your statistical function (e.g., mean or sd) uses na.rm=TRUE by default\nUse the Arguments strategy to set na.rm=TRUE (see the Arguments section of this vignette).\nUse a convenience function supplied by modelsummary, where na.rm is TRUE by default: Mean, SD, P25, etc.\nEmpty crosstab cells\nAn empty cell can appear in the table when a crosstab is deeply nested, and there are no observations for a given combination of covariates. In those cases, you can use the * DropEmpty pseudo-function. See the “Empty cells” section of this vignette for examples.\n\ndatasummary(island * species * body_mass_g ~ sex * (Mean + SD),\n data = penguins)\n\n \n\n \n \n\ntinytable_h82z1swtzcrplc82ub4t\n\n\n \n\n\n \n \n \nfemale\nmale\n\n\nisland\n species\n \n Mean\n SD\n Mean\n SD\n \n\n\n\nBiscoe \n Adelie \n body_mass_g\n 3369.32\n 343.47\n 4050.00\n 355.57\n \n\n \n Chinstrap\n body_mass_g\n \n \n \n \n \n\n \n Gentoo \n body_mass_g\n 4679.74\n 281.58\n 5484.84\n 313.16\n \n\nDream \n Adelie \n body_mass_g\n 3344.44\n 212.06\n 4045.54\n 330.55\n \n\n \n Chinstrap\n body_mass_g\n 3527.21\n 285.33\n 3938.97\n 362.14\n \n\n \n Gentoo \n body_mass_g\n \n \n \n \n \n\nTorgersen\n Adelie \n body_mass_g\n 3395.83\n 259.14\n 4034.78\n 372.47\n \n\n \n Chinstrap\n body_mass_g\n \n \n \n \n \n\n \n Gentoo \n body_mass_g\n \n \n \n \n \n\n\n\n\n \n\ndatasummary(island * species * body_mass_g ~ sex * (Mean + SD) * DropEmpty(),\n data = penguins)\n\n \n\n \n \n\ntinytable_gga58ozg28e7g36rozmd\n\n\n \n\n\n \n \n \nfemale\nmale\n\n\nisland\n species\n \n Mean\n SD\n Mean\n SD\n \n\n\n\nBiscoe \n Adelie \n body_mass_g\n 3369.32\n 343.47\n 4050.00\n 355.57\n \n\n \n Gentoo \n body_mass_g\n 4679.74\n 281.58\n 5484.84\n 313.16\n \n\nDream \n Adelie \n body_mass_g\n 3344.44\n 212.06\n 4045.54\n 330.55\n \n\n \n Chinstrap\n body_mass_g\n 3527.21\n 285.33\n 3938.97\n 362.14\n \n\nTorgersen\n Adelie \n body_mass_g\n 3395.83\n 259.14\n 4034.78\n 372.47\n \n\n\n\n\n \n\n\nPercent()\nBy default, the Percent() function computes the share of each category with respect to the whole data, including missing observations, but we can work around this with some trickery:jig\n\ndat <- data.frame(z = c(0,0,1,0,NA,0,1))\n\nprop.table(table(dat$z))\n\n\n 0 1 \n0.6666667 0.3333333 \n\ndatasummary(Factor(z) ~ N + Percent(), data = dat)\n\n \n\n \n \n\ntinytable_i4taciijcbvi2p1ce0gp\n\n\n \n\nz\n N\n Percent\n \n\n\n0\n 4\n 57.14\n \n\n1\n 2\n 28.57\n \n\n\n\n\n \n\n\nTo count percentages without missing values, we can exploit the fact that Percent() accepts a denom argument which can be a logical vector:\n\ndatasummary(Factor(z) ~ N + Percent(denom = !is.na(dat$z)), data = dat)\n\n \n\n \n \n\ntinytable_fke4aukdx87ay8s90e40\n\n\n \n\nz\n N\n Percent\n \n\n\n0\n 4\n 66.67\n \n\n1\n 2\n 33.33", + "text": "Missing values\nAt least 3 distinct issues can arise related to missing values.\nFunctions and na.rm\n\nAn empty cell can appear in the table when a statistical function returns NA instead of a numeric value. In those cases, you should:\n\nMake sure that your statistical function (e.g., mean or sd) uses na.rm=TRUE by default\nUse the Arguments strategy to set na.rm=TRUE (see the Arguments section of this vignette).\nUse a convenience function supplied by modelsummary, where na.rm is TRUE by default: Mean, SD, P25, etc.\nEmpty crosstab cells\nAn empty cell can appear in the table when a crosstab is deeply nested, and there are no observations for a given combination of covariates. In those cases, you can use the * DropEmpty pseudo-function. See the “Empty cells” section of this vignette for examples.\n\ndatasummary(island * species * body_mass_g ~ sex * (Mean + SD),\n data = penguins)\n\n \n\n \n \n\ntinytable_i8xaudjn5mnk60b34eo1\n\n\n \n\n\n \n \n \nfemale\nmale\n\n\nisland\n species\n \n Mean\n SD\n Mean\n SD\n \n\n\n\nBiscoe \n Adelie \n body_mass_g\n 3369.32\n 343.47\n 4050.00\n 355.57\n \n\n \n Chinstrap\n body_mass_g\n \n \n \n \n \n\n \n Gentoo \n body_mass_g\n 4679.74\n 281.58\n 5484.84\n 313.16\n \n\nDream \n Adelie \n body_mass_g\n 3344.44\n 212.06\n 4045.54\n 330.55\n \n\n \n Chinstrap\n body_mass_g\n 3527.21\n 285.33\n 3938.97\n 362.14\n \n\n \n Gentoo \n body_mass_g\n \n \n \n \n \n\nTorgersen\n Adelie \n body_mass_g\n 3395.83\n 259.14\n 4034.78\n 372.47\n \n\n \n Chinstrap\n body_mass_g\n \n \n \n \n \n\n \n Gentoo \n body_mass_g\n \n \n \n \n \n\n\n\n\n \n\ndatasummary(island * species * body_mass_g ~ sex * (Mean + SD) * DropEmpty(),\n data = penguins)\n\n \n\n \n \n\ntinytable_n8jrcz3bdw9i5xhgzrbh\n\n\n \n\n\n \n \n \nfemale\nmale\n\n\nisland\n species\n \n Mean\n SD\n Mean\n SD\n \n\n\n\nBiscoe \n Adelie \n body_mass_g\n 3369.32\n 343.47\n 4050.00\n 355.57\n \n\n \n Gentoo \n body_mass_g\n 4679.74\n 281.58\n 5484.84\n 313.16\n \n\nDream \n Adelie \n body_mass_g\n 3344.44\n 212.06\n 4045.54\n 330.55\n \n\n \n Chinstrap\n body_mass_g\n 3527.21\n 285.33\n 3938.97\n 362.14\n \n\nTorgersen\n Adelie \n body_mass_g\n 3395.83\n 259.14\n 4034.78\n 372.47\n \n\n\n\n\n \n\n\nPercent()\nBy default, the Percent() function computes the share of each category with respect to the whole data, including missing observations, but we can work around this with some trickery:jig\n\ndat <- data.frame(z = c(0,0,1,0,NA,0,1))\n\nprop.table(table(dat$z))\n\n\n 0 1 \n0.6666667 0.3333333 \n\ndatasummary(Factor(z) ~ N + Percent(), data = dat)\n\n \n\n \n \n\ntinytable_ylbwte7zkkjwyuvh1iwf\n\n\n \n\nz\n N\n Percent\n \n\n\n0\n 4\n 57.14\n \n\n1\n 2\n 28.57\n \n\n\n\n\n \n\n\nTo count percentages without missing values, we can exploit the fact that Percent() accepts a denom argument which can be a logical vector:\n\ndatasummary(Factor(z) ~ N + Percent(denom = !is.na(dat$z)), data = dat)\n\n \n\n \n \n\ntinytable_jgvmg1nxadjkcudfnifi\n\n\n \n\nz\n N\n Percent\n \n\n\n0\n 4\n 66.67\n \n\n1\n 2\n 33.33", "crumbs": [ "Get started", "Data Summaries" @@ -1551,7 +1551,7 @@ "href": "vignettes/datasummary.html#add-rows", "title": "Data Summaries", "section": "Add rows", - "text": "Add rows\n\nnew_rows <- data.frame('Does',\n 2,\n 'plus',\n 2,\n 'equals',\n 5,\n '?')\ndatasummary(flipper_length_mm + body_mass_g ~ species * (Mean + SD),\n data = penguins,\n add_rows = new_rows)\n\n \n\n \n \n\ntinytable_qs98r1uy2tqq6ao212x1\n\n\n \n\n\n \nAdelie\nChinstrap\nGentoo\n\n\n \n Mean\n SD\n Mean\n SD\n Mean\n SD\n \n\n\n\nflipper_length_mm\n 189.95 \n 6.54 \n 195.82 \n 7.13 \n 217.19 \n 6.48 \n \n\nbody_mass_g \n 3700.66\n 458.57\n 3733.09\n 384.34\n 5076.02\n 504.12\n \n\nDoes \n 2.00 \n plus \n 2.00 \n equals\n 5.00 \n ?", + "text": "Add rows\n\nnew_rows <- data.frame('Does',\n 2,\n 'plus',\n 2,\n 'equals',\n 5,\n '?')\ndatasummary(flipper_length_mm + body_mass_g ~ species * (Mean + SD),\n data = penguins,\n add_rows = new_rows)\n\n \n\n \n \n\ntinytable_0cctplbg8f3xae6kao9j\n\n\n \n\n\n \nAdelie\nChinstrap\nGentoo\n\n\n \n Mean\n SD\n Mean\n SD\n Mean\n SD\n \n\n\n\nflipper_length_mm\n 189.95 \n 6.54 \n 195.82 \n 7.13 \n 217.19 \n 6.48 \n \n\nbody_mass_g \n 3700.66\n 458.57\n 3733.09\n 384.34\n 5076.02\n 504.12\n \n\nDoes \n 2.00 \n plus \n 2.00 \n equals\n 5.00 \n ?", "crumbs": [ "Get started", "Data Summaries" @@ -1562,7 +1562,7 @@ "href": "vignettes/datasummary.html#add-columns", "title": "Data Summaries", "section": "Add columns", - "text": "Add columns\n\nnew_cols <- data.frame('New Stat' = runif(2))\ndatasummary(flipper_length_mm + body_mass_g ~ species * (Mean + SD),\n data = penguins,\n add_columns = new_cols)\n\n \n\n \n \n\ntinytable_7g2u2olvpiqaemek0hlt\n\n\n \n\n\n \nAdelie\nChinstrap\nGentoo\n \n\n\n \n Mean\n SD\n Mean\n SD\n Mean\n SD\n New.Stat\n \n\n\n\nflipper_length_mm\n 189.95 \n 6.54 \n 195.82 \n 7.13 \n 217.19 \n 6.48 \n 0.99\n \n\nbody_mass_g \n 3700.66\n 458.57\n 3733.09\n 384.34\n 5076.02\n 504.12\n 0.79", + "text": "Add columns\n\nnew_cols <- data.frame('New Stat' = runif(2))\ndatasummary(flipper_length_mm + body_mass_g ~ species * (Mean + SD),\n data = penguins,\n add_columns = new_cols)\n\n \n\n \n \n\ntinytable_pgiyv9kyp8cwwtudkiw2\n\n\n \n\n\n \nAdelie\nChinstrap\nGentoo\n \n\n\n \n Mean\n SD\n Mean\n SD\n Mean\n SD\n New.Stat\n \n\n\n\nflipper_length_mm\n 189.95 \n 6.54 \n 195.82 \n 7.13 \n 217.19 \n 6.48 \n 0.52\n \n\nbody_mass_g \n 3700.66\n 458.57\n 3733.09\n 384.34\n 5076.02\n 504.12\n 0.94", "crumbs": [ "Get started", "Data Summaries" diff --git a/vignettes/appearance.html b/vignettes/appearance.html index c30df9ea7..7b9c28814 100644 --- a/vignettes/appearance.html +++ b/vignettes/appearance.html @@ -450,19 +450,19 @@

Themes and Styles

-tinytable_jyo96m2834xzj6gd3wuw +tinytable_lb5dult3s72u791eryl2
-
mpg
+
@@ -608,12 +608,12 @@

Themes and Styles

@@ -786,13 +786,13 @@

Themes and Styles

-tinytable_b2gtywmo2zsk58ugy5y9 +tinytable_ggy9riftm1d6aywhbadj
-
+
@@ -816,25 +816,25 @@

Themes and Styles

- + - +
Meanmpg 20.09 6.03
hp 146.69 68.56
@@ -910,16 +910,16 @@

Themes and Styles

-tinytable_0fygmd91861j6n6jf2dq +tinytable_0xumlszc2chwpp50gehr @@ -1820,23 +1820,23 @@

Themes and Styles

text_transform(locations = cells_body(columns = 2:6, rows = 1), fn = f)
-
- @@ -2376,23 +2376,23 @@

Themes and Styles

modelsummary(mod, output = "gt")
-
- @@ -2891,23 +2891,23 @@

Themes and Styles

datasummary_crosstab(island ~ sex * species, output = "gt", data = penguins)
-
- @@ -3488,8 +3488,8 @@

Themes and Styles

options("modelsummary_theme_dataframe" = theme_df) modelsummary(mod, output = "dataframe")
-
- +
+

Restore default theme:

@@ -3512,12 +3512,12 @@

Themes and Styles

-tinytable_gsd4n4w1rb783ti9cvgb +tinytable_pjjhdevneeiz588ls4bx
- +
@@ -3596,12 +3596,12 @@

Themes and Styles

datasummary_skim(dat[, c("mpg", "am", "drat")])
@@ -3680,18 +3680,18 @@

Themes and Styles

-tinytable_mqxhc2ok5qceev5q296b +tinytable_6nk827gnsmk6acoof828
-
(1)
+
@@ -3725,7 +3725,7 @@

Themes and Styles

- + @@ -3736,7 +3736,7 @@

Themes and Styles

- + @@ -3747,19 +3747,19 @@

Themes and Styles

- +
Unique 10.4 19.2 33.9
Transmission 0.0 0.0 1.0
drat 2.8 3.7 4.9
diff --git a/vignettes/datasummary.html b/vignettes/datasummary.html index 3e337ac94..378fee8cb 100644 --- a/vignettes/datasummary.html +++ b/vignettes/datasummary.html @@ -477,10 +477,10 @@

Data Summaries

-tinytable_r72mqokptlgq0ac5ldz8 +tinytable_ymros459i5p7tvezii5t
- +
@@ -514,7 +514,7 @@

Data Summaries

- + @@ -525,7 +525,7 @@

Data Summaries

- + @@ -536,7 +536,7 @@

Data Summaries

- + @@ -547,7 +547,7 @@

Data Summaries

- + @@ -558,7 +558,7 @@

Data Summaries

- + @@ -569,7 +569,7 @@

Data Summaries

- + @@ -686,12 +686,12 @@

Data Summaries

@@ -757,13 +757,13 @@

Data Summaries

-tinytable_lxgp5w5pd65fe0we3zug +tinytable_zkqzbyb7i05si7a91u88
-
Unique 1.0 172.5 344.0
bill_length_mm 32.1 44.5 59.6
bill_depth_mm 13.1 17.3 21.5
flipper_length_mm 172.0 197.0 231.0
body_mass_g 2700.0 4050.0 6300.0
year 2007.0 2008.0 2009.0
+
@@ -842,12 +842,12 @@

Data Summaries

@@ -973,14 +973,14 @@

Data Summaries

-tinytable_13ya0c7qn6sewfqutxx9 +tinytable_wnbtl8dzipufb33r2660
-
+
@@ -1077,12 +1077,12 @@

Data Summaries

@@ -1191,21 +1191,21 @@

Data Summaries

-tinytable_51jj21etu2wk1ftv6e5u +tinytable_c55b5kbpcyscc9w9q4tm
-
+
@@ -1392,12 +1392,12 @@

Data Summaries

@@ -1614,20 +1614,20 @@

Data Summaries

-tinytable_ua5843jnaenj5rha4jo6 +tinytable_yk4kolpauk4d0ke13duc
-
mpg
+
@@ -1789,12 +1789,12 @@

Data Summaries

@@ -1979,14 +1979,14 @@

Data Summaries

-tinytable_1n1l4n7wkx3ujs42loh3 +tinytable_azodknnawnimwl4s0nqc
-
carb
+
@@ -2068,12 +2068,12 @@

Data Summaries

@@ -2171,21 +2171,21 @@

Data Summaries

-tinytable_gc3cbalwvvv9du3ukmqn +tinytable_ufl34steobitdd0yeok3
-
species
+
@@ -2312,12 +2312,12 @@

Data Summaries

@@ -2486,13 +2486,13 @@

Data Summaries

-tinytable_f7z4sfuf19bd91lumksj +tinytable_qp8v7p9zat6xnz4s8nxu
-
+
@@ -2541,12 +2541,12 @@

Data Summaries

@@ -2622,11 +2622,11 @@

Data Summaries

-tinytable_0oc8o58rle4vir4jlagy +tinytable_2xazg2wr5sxi3nm8fypz
-
species
+
@@ -2651,12 +2651,12 @@

Data Summaries

@@ -2711,11 +2711,11 @@

Data Summaries

-tinytable_8e2hlswrnqomu78pmoc4 +tinytable_juhabvsox6bgrpwgjjf0
-
Mean
+
@@ -2740,12 +2740,12 @@

Data Summaries

@@ -2801,11 +2801,11 @@

Data Summaries

-tinytable_j5v7hmg8vynw9ut2e8lx +tinytable_ujlh99j6r39njwqr68rb
-
flipper_length_mm
+
@@ -2830,12 +2830,12 @@

Data Summaries

@@ -2893,11 +2893,11 @@

Data Summaries

-tinytable_7mdf14epg6tplt7461i1 +tinytable_7f6louttieuzdq67awtk
-
mean
+
@@ -2922,12 +2922,12 @@

Data Summaries

MinMax <- function(x) paste0('[', min(x, na.rm = TRUE), ', ', max(x, na.rm = TRUE), ']')
@@ -2981,11 +2981,11 @@ 

Data Summaries

-tinytable_078za3ozts6f5b69kczq +tinytable_v00ecm16vt4dolwhr0ui
-
Range
+
@@ -3010,12 +3010,12 @@

Data Summaries

@@ -3072,12 +3072,12 @@

Data Summaries

-tinytable_4ndr0ikwtgv4ym7nlxgg +tinytable_k9caxbs5kadtfjt2qdxa
-
MinMax
+
@@ -3111,12 +3111,12 @@

Data Summaries

@@ -3177,12 +3177,12 @@

Data Summaries

-tinytable_0lrl0y7y9a6aetp3h30z +tinytable_stkwuzlxydvsy4ns2jbh
-
Mean
+
@@ -3236,12 +3236,12 @@

Data Summaries

@@ -3317,12 +3317,12 @@

Data Summaries

-tinytable_gmpomhntrat7k9d0i4e3 +tinytable_tmyrfjvbvpjqcmxkglqr
-
Mean
+
@@ -3356,12 +3356,12 @@

Data Summaries

@@ -3422,17 +3422,17 @@

Data Summaries

-tinytable_61gfvsq6e63e6kvnf1gv +tinytable_m4yifvil1lpu998ia1a6
-
female
+
@@ -3470,12 +3470,12 @@

Data Summaries

@@ -3556,13 +3556,13 @@

Data Summaries

-tinytable_5g2gknzl8ajp7jr2aw6y +tinytable_ey8pqh5qs8j5jvmhicf7
-
+
@@ -3611,12 +3611,12 @@

Data Summaries

@@ -3689,19 +3689,19 @@

Data Summaries

-tinytable_2o40nh8kxq8yip355hnc +tinytable_sxcetvov6yvb3w2wbjut
-
sex
+
@@ -3755,12 +3755,12 @@

Data Summaries

@@ -3861,19 +3861,19 @@

Data Summaries

-tinytable_kpuz8qlbcbo5tfrcs1td +tinytable_si3izgn8vcbesjbi6gjk
-
+
@@ -3926,12 +3926,12 @@

Data Summaries

@@ -4032,19 +4032,19 @@

Data Summaries

-tinytable_1g19moklboiz58hvaspq +tinytable_kegb4vo01ajf4bmqqiec
-
+
@@ -4097,12 +4097,12 @@

Data Summaries

@@ -4209,12 +4209,12 @@

Data Summaries

-tinytable_0dlbmbfoujhcltzgn62l +tinytable_iumsxlta6zg41ityra0j
-
+
@@ -4248,12 +4248,12 @@

Data Summaries

@@ -4315,19 +4315,19 @@

Data Summaries

-tinytable_4lg5ajybsnt7mc21r5tt +tinytable_elradgsleqqzq2dnm9z0
-
Mean
+
@@ -4381,12 +4381,12 @@

Data Summaries

@@ -4487,19 +4487,19 @@

Data Summaries

-tinytable_prmzsvq6vsc6j93abpup +tinytable_mk2hpc9z6m2zcgucz5xh
-
+
@@ -4553,12 +4553,12 @@

Data Summaries

@@ -4659,13 +4659,13 @@

Data Summaries

-tinytable_shg3lq1fzassz2vtqz4c +tinytable_n3lurag5cccmmajojyk2
-
+
@@ -4720,12 +4720,12 @@

Data Summaries

datasummary(sex * (flipper_length_mm + bill_length_mm) + Heading("Body mass (g)", nearData=FALSE) * body_mass_g ~ Mean + SD,
@@ -4799,13 +4799,13 @@ 

Data Summaries

-tinytable_1jwng5p5tqqkn755em2n +tinytable_ck5sgz7fpby2tzdv1tmf
-
sex
+
@@ -4860,12 +4860,12 @@

Data Summaries

@@ -4948,13 +4948,13 @@

Data Summaries

-tinytable_iuhxhtuns5dzwes76shk +tinytable_eq61q01iaatkuz23z13r
-
sex
+
@@ -5021,12 +5021,12 @@

Data Summaries

@@ -5113,13 +5113,13 @@

Data Summaries

-tinytable_0mder98ikpie4acsvb3e +tinytable_ugg61a2fcw5fh73ssepo
-
species sex
+
@@ -5186,12 +5186,12 @@

Data Summaries

@@ -5278,13 +5278,13 @@

Data Summaries

-tinytable_bk8prpbmxl80j6xwm16l +tinytable_ncj0pge4avt822em8vkz
-
species sex
+
@@ -5351,12 +5351,12 @@

Data Summaries

@@ -5453,11 +5453,11 @@

Data Summaries

-tinytable_01n7279q4m7isxyc9p35 +tinytable_u6xr06x66j9udy6bdbyj
-
species sex
+
@@ -5492,12 +5492,12 @@

Data Summaries

@@ -5557,17 +5557,17 @@

Data Summaries

-tinytable_bda7octedv0whbqafr4j +tinytable_7jiapf7qjcmlxc4hhu1z
-
cyl Percent
+
@@ -5614,12 +5614,12 @@

Data Summaries

@@ -5708,12 +5708,12 @@

Data Summaries

-tinytable_xb3z1hpx3lbrxr80f6d0 +tinytable_76pbdi9rf9pge3ij6nba
-
+
@@ -5740,12 +5740,12 @@

Data Summaries

@@ -5804,12 +5804,12 @@

Data Summaries

-tinytable_c9pct73bay4ctr12laor +tinytable_759htqlplz69gmk90hpj
-
mean
+
@@ -5836,12 +5836,12 @@

Data Summaries

@@ -5899,14 +5899,14 @@

Data Summaries

-tinytable_m288rwhi4akdjwnosozq +tinytable_veqgpyihij7b0xdstw4v
-
mean
+
@@ -5937,12 +5937,12 @@

Data Summaries

@@ -6013,11 +6013,11 @@

Data Summaries

-tinytable_f4z199extla26itetb57 +tinytable_87jgtvlo97h3vw0n5e0f
-
Mean
+
@@ -6037,23 +6037,23 @@

Data Summaries

- + - +
weighted.mean
x1.32 0.25
y-0.240.81
@@ -6104,22 +6104,22 @@

Data Summaries

weighted.mean(newdata$x, newdata$w)
-
[1] 1.315068
+
[1] 0.2528909
weighted.mean(newdata$y, newdata$w)
-
[1] -0.236075
+
[1] 0.8139608

But different results from:

mean(newdata$x)
-
[1] 0.3049217
+
[1] -0.07968538
mean(newdata$y)
-
[1] -0.2411163
+
[1] 0.03824354

Logical subsets

@@ -6133,11 +6133,11 @@

Data Summaries

-tinytable_pyhqf60nxviw80ohrhcv +tinytable_0mrj1qvmrwd2zjtvmftr
- +
@@ -6169,12 +6169,12 @@

Data Summaries

@@ -6242,19 +6242,19 @@

Data Summaries

-tinytable_h82z1swtzcrplc82ub4t +tinytable_i8xaudjn5mnk60b34eo1
-
+
@@ -6372,12 +6372,12 @@

Data Summaries

datasummary(island * species * body_mass_g ~ sex * (Mean + SD) * DropEmpty(),
@@ -6523,19 +6523,19 @@ 

Data Summaries

-tinytable_gga58ozg28e7g36rozmd +tinytable_n8jrcz3bdw9i5xhgzrbh
-
+
@@ -6617,12 +6617,12 @@

Data Summaries

@@ -6751,12 +6751,12 @@

Data Summaries

-tinytable_i4taciijcbvi2p1ce0gp +tinytable_ylbwte7zkkjwyuvh1iwf
-
+
@@ -6790,12 +6790,12 @@

Data Summaries

@@ -6855,12 +6855,12 @@

Data Summaries

-tinytable_fke4aukdx87ay8s90e40 +tinytable_jgvmg1nxadjkcudfnifi
-
z N
+
@@ -6894,12 +6894,12 @@

Data Summaries

@@ -6968,19 +6968,19 @@

Data Summaries

-tinytable_qs98r1uy2tqq6ao212x1 +tinytable_0cctplbg8f3xae6kao9j
-
z N
+
@@ -7043,12 +7043,12 @@

Data Summaries

@@ -7158,20 +7158,20 @@

Data Summaries

-tinytable_7g2u2olvpiqaemek0hlt +tinytable_pgiyv9kyp8cwwtudkiw2
-
+
@@ -7212,7 +7212,7 @@

Data Summaries

- + @@ -7222,19 +7222,19 @@

Data Summaries

- +
7.13 217.19 6.48 0.990.52
body_mass_g 384.34 5076.02 504.120.790.94
@@ -7374,12 +7374,12 @@

Data Summaries

-tinytable_uk4yvcbq3zi1qem4o8kj +tinytable_5q567l8nxv8yhtt47pdl
- +
@@ -7406,12 +7406,12 @@

Data Summaries

@@ -7469,12 +7469,12 @@

Data Summaries

-tinytable_337coon4mk3qsa9fdg8f +tinytable_b63qkmjd3gmcbc5jfap4
-
Mean
+
@@ -7501,12 +7501,12 @@

Data Summaries

@@ -7565,11 +7565,11 @@

Data Summaries

-tinytable_m7m8ed84j2a9tptbeswu +tinytable_ljd8ndzsoknxp9yudxt7
-
Mean
+
@@ -7589,27 +7589,27 @@

Data Summaries

- + - + - +
X N
a332,919333,802
b333,564332,990
c333,517333,208
@@ -7671,12 +7671,12 @@

Data Summaries

-tinytable_993pqqsi04yuatltlpsh +tinytable_vimww3kczuljuhamnc25
- +
@@ -7734,12 +7734,12 @@

Data Summaries

@@ -7814,13 +7814,13 @@

Data Summaries

-tinytable_2o2w3a9lvp81qs0jlu6b +tinytable_r9haszoihqb9hqjuj90a
-
Statistics about the famous Palmer Penguins.
+
@@ -7857,12 +7857,12 @@

Data Summaries

@@ -7933,14 +7933,14 @@

Data Summaries

-tinytable_1n7zmk8yj3ove8ladax8 +tinytable_x3w3330a5tfs1pnwm7x4
-
Mean
+
@@ -8022,12 +8022,12 @@

Data Summaries

datasummary_crosstab(cyl_na ~ vs, data = mycars)
@@ -8122,14 +8122,14 @@

Data Summaries

-tinytable_7fdck6ez3an2xwoybr47 +tinytable_gkt9wxpr61k3yhx1t8fe
-
cyl_nona
+
@@ -8225,12 +8225,12 @@

Data Summaries

diff --git a/vignettes/get_started.html b/vignettes/get_started.html index a68dce7c2..f56e87eeb 100644 --- a/vignettes/get_started.html +++ b/vignettes/get_started.html @@ -414,10 +414,10 @@

Getting started

-tinytable_5s5s0ho4i0d11mopqcm0 +tinytable_fu41m92s1ycg9slfxym7
-
cyl_na
+
@@ -451,7 +451,7 @@

Getting started

- + @@ -462,7 +462,7 @@

Getting started

- + @@ -473,7 +473,7 @@

Getting started

- + @@ -484,7 +484,7 @@

Getting started

- + @@ -495,7 +495,7 @@

Getting started

- + @@ -506,7 +506,7 @@

Getting started

- + @@ -546,12 +546,12 @@

Getting started

@@ -617,19 +617,19 @@

Getting started

-tinytable_l9y4jxu9shckkefbll5k +tinytable_jix3v2s3wx24jey8dms4
-
Unique 1246.0 5020.0 37015.0
Literacy 12.0 38.0 74.0
Commerce 1.0 42.5 86.0
Crime_pers 2199.0 18748.5 37014.0
Crime_prop 1368.0 7595.0 20235.0
Clergy 1.0 43.5 86.0
Small
+
@@ -720,12 +720,12 @@

Getting started

@@ -852,16 +852,16 @@

Getting started

-tinytable_8zpjnjnivhvk23crvyu3 +tinytable_6p6juxs5bbgjbyf563kj
-
+
@@ -943,12 +943,12 @@

Getting started

@@ -1052,17 +1052,17 @@

Getting started

-tinytable_h3xk51iw9talhwi0q5um +tinytable_11gc7k5h1ifepyq47x4q
-
Donations
+
@@ -1109,12 +1109,12 @@

Getting started

@@ -1202,12 +1202,12 @@

Getting started

-tinytable_fa6zc8q2mjc0ixwi1rfq +tinytable_tmbigvd1v3gu1torosoe
-
+
@@ -1278,12 +1278,12 @@

Getting started

@@ -1372,18 +1372,18 @@

Getting started

-tinytable_quyfgid783myjatx00rr +tinytable_0oye7fg5i25ioctkqqb4
-
(1)
+
@@ -1498,12 +1498,12 @@

Getting started

diff --git a/vignettes/modelplot.html b/vignettes/modelplot.html index a0bb0848b..76afa3c14 100644 --- a/vignettes/modelplot.html +++ b/vignettes/modelplot.html @@ -489,14 +489,14 @@

Model Plots

-tinytable_q482m33kcr59753r4d4r +tinytable_6rwe5wzzrdn8m4gd12sz
-
+
@@ -629,12 +629,12 @@

Model Plots

diff --git a/vignettes/modelsummary.html b/vignettes/modelsummary.html index 63adbd5d3..29eddedd2 100644 --- a/vignettes/modelsummary.html +++ b/vignettes/modelsummary.html @@ -482,14 +482,14 @@

Model Summaries

-tinytable_99h4l9rdsyut9f7et9pf +tinytable_85prb6brv9r2i92zsojz
-
Small model
+
@@ -610,12 +610,12 @@

Model Summaries

@@ -820,11 +820,11 @@

Model Summaries

-tinytable_y4zw86ddjiphaoex6w02 +tinytable_v89p2apefv2q9wp06a42
-
OLS 1
+
@@ -863,12 +863,12 @@

Model Summaries

@@ -942,14 +942,14 @@

Model Summaries

-tinytable_fbmg0bgkky4jtpu3f3ah +tinytable_k1lsveagj329uqoocvce
-
(1)
+
@@ -1040,12 +1040,12 @@

Model Summaries

@@ -1154,12 +1154,12 @@

Model Summaries

-tinytable_dxxyqjn6le9wlx5095rz +tinytable_rcaipjc1xzb54s94tazd
-
OLS 1
+
@@ -1222,12 +1222,12 @@

Model Summaries

@@ -1308,14 +1308,14 @@

Model Summaries

-tinytable_2us8mde8hmx62g7kpd5f +tinytable_fs3dpzb08binnqf5vor0
-
(1)
+
@@ -1406,12 +1406,12 @@

Model Summaries

@@ -1525,14 +1525,14 @@

Model Summaries

-tinytable_3rc1m6zq2wh2e3e4zwax +tinytable_sqct6zh4jccwa3xfs7nj
-
OLS 1
+
@@ -1653,12 +1653,12 @@

Model Summaries

@@ -1783,14 +1783,14 @@

Model Summaries

-tinytable_soj3htg4a7fkkfo2ph12 +tinytable_hvrwhbxueg4zfpfsb6uq
-
OLS 1
+
@@ -1916,12 +1916,12 @@

Model Summaries

@@ -2049,13 +2049,13 @@

Model Summaries

-tinytable_ibb2hhnnqn9vyqu89koh +tinytable_sl9qae1v8h8wad8bz46i
-
OLS 1
+
@@ -2205,12 +2205,12 @@

Model Summaries

@@ -2348,13 +2348,13 @@

Model Summaries

-tinytable_wcbil11z8fusk24kgxkq +tinytable_86moeycncdqrycp33a8h
-
OLS 1
+
@@ -2403,12 +2403,12 @@

Model Summaries

@@ -2519,13 +2519,13 @@

Model Summaries

-tinytable_cffkbcjlluhfm08hj8ua +tinytable_i7htbq5z2g6vih7eneci
-
OLS 1
+
@@ -2598,12 +2598,12 @@

Model Summaries

@@ -2693,13 +2693,13 @@

Model Summaries

-tinytable_jrgcs1byppk7fgap0vpy +tinytable_ol0haxcslo9szrr1bwg0
-
OLS 1
+
@@ -2748,12 +2748,12 @@

Model Summaries

@@ -2825,13 +2825,13 @@

Model Summaries

-tinytable_cpvgfqjkp7tgmet3t0gs +tinytable_9pd8yz92tzlvj8lrlcrn
-
OLS 1
+
@@ -2880,12 +2880,12 @@

Model Summaries

@@ -2957,13 +2957,13 @@

Model Summaries

-tinytable_6143uaceet8375v5es4v +tinytable_p4exnhbowx10ezakvoei
-
OLS 1
+
@@ -3012,12 +3012,12 @@

Model Summaries

@@ -3089,13 +3089,13 @@

Model Summaries

-tinytable_tyw740p8uhqyomtirxcz +tinytable_4ng1xzp8qlfvdbetl7zp
-
OLS 1
+
@@ -3132,12 +3132,12 @@

Model Summaries

@@ -3201,13 +3201,13 @@

Model Summaries

-tinytable_k87n3hf4xcuoi14wofjs +tinytable_kkzidiuenrxbxosq5w1i
-
OLS 1
+
@@ -3256,12 +3256,12 @@

Model Summaries

@@ -3333,13 +3333,13 @@

Model Summaries

-tinytable_ohscx6fjfyu6kxwz9r55 +tinytable_lp9znvg4qsacloeuh2rn
-
OLS 1
+
@@ -3400,12 +3400,12 @@

Model Summaries

@@ -3490,13 +3490,13 @@

Model Summaries

-tinytable_k698if5lz3ipydsdyooo +tinytable_9m60ph48n11c1hv28smz
-
OLS 1
+
@@ -3580,12 +3580,12 @@

Model Summaries

@@ -3684,13 +3684,13 @@

Model Summaries

-tinytable_wuop2pcek1m6l5flgd7a +tinytable_zi7hiyfnn6zaq5u7y4j3
-
(1)
+
@@ -3804,12 +3804,12 @@

Model Summaries

@@ -3930,13 +3930,13 @@

Model Summaries

-tinytable_d70sxpfvztc2wa8kgvcf +tinytable_gri94lragg0xnixalrnk
-
mpg
+
@@ -4030,12 +4030,12 @@

Model Summaries

@@ -4140,12 +4140,12 @@

Model Summaries

-tinytable_n2ffwqg0pwp931eisxtr +tinytable_hy6ctwrhu4yjogd11hhv
-
(1)
+
@@ -4232,12 +4232,12 @@

Model Summaries

@@ -4327,14 +4327,14 @@

Model Summaries

-tinytable_xokbwxidmw9iskee7rft +tinytable_yd7jsyv55spygve4wit4
-
(1)
+
@@ -4443,12 +4443,12 @@

Model Summaries

@@ -4569,14 +4569,14 @@

Model Summaries

-tinytable_7qg08l2emi025vu0r1ef +tinytable_vu6rdqs7u790ppasd3wi
-
OLS 1
+
@@ -4661,12 +4661,12 @@

Model Summaries

@@ -4796,14 +4796,14 @@

Model Summaries

-tinytable_l1bk8vi8xpz2bl9irwmz +tinytable_yomxtq8uu8x5dckkpr15
-
OLS 1
+
@@ -4865,12 +4865,12 @@

Model Summaries

@@ -4962,13 +4962,13 @@

Model Summaries

-tinytable_b6g3yvy4ra2ipaxzphnw +tinytable_w9bxopa3zlubjhqj8hdm
-
OLS 1
+
@@ -5067,12 +5067,12 @@

Model Summaries

@@ -5197,13 +5197,13 @@

Model Summaries

-tinytable_0fvgw29rsgoi2rzet0c8 +tinytable_uqeukr2xwi1993gzg66h
-
(1)
+
@@ -5292,12 +5292,12 @@

Model Summaries

@@ -5405,12 +5405,12 @@

Model Summaries

-tinytable_dbt1j652k5dsry1dv6vw +tinytable_gvxx11zwzlmlxe6n01vc
-
(1)
+
@@ -5464,12 +5464,12 @@

Model Summaries

@@ -5544,19 +5544,19 @@

Model Summaries

-tinytable_6wq9xs0pmvbqoj2c9917 +tinytable_era8a74xfo7uu80e5pmz
-
(1)
+
@@ -5618,12 +5618,12 @@

Model Summaries

@@ -5732,19 +5732,19 @@

Model Summaries

-tinytable_y8gy4u2z9y6uu125wr19 +tinytable_33cqm5etwh6wf9vstami
-
+
@@ -5807,12 +5807,12 @@

Model Summaries

@@ -5947,13 +5947,13 @@

Model Summaries

-tinytable_acr2zvourq9zwecvqt70 +tinytable_tivra0mxkzdop8f1yv0o
-
+
@@ -6038,12 +6038,12 @@

Model Summaries

@@ -6143,13 +6143,13 @@

Model Summaries

-tinytable_6jv7kmo5efo0m52s8kuh +tinytable_csw4aot1onqmeqb2wa7c
-
+
@@ -6233,12 +6233,12 @@

Model Summaries

@@ -6330,12 +6330,12 @@

Model Summaries

-tinytable_csdz8yqwhu6ghauoumv4 +tinytable_2fqs6dihbm72q4yk1im4
-
+
@@ -6406,12 +6406,12 @@

Model Summaries

@@ -6507,14 +6507,14 @@

Model Summaries

-tinytable_y983v9oe0oiaouncc3kt +tinytable_kqnnz69un3lcjdwhqysf
-
(1)
+
@@ -6608,12 +6608,12 @@

Model Summaries

@@ -6748,14 +6748,14 @@

Model Summaries

-tinytable_mh0rh4x36zji6idjis27 +tinytable_db6m43uvrfmvm9agdguz
-
(1)
+
@@ -6849,12 +6849,12 @@

Model Summaries

@@ -6976,17 +6976,17 @@

Model Summaries

-tinytable_o7l69z8rk6pj9qinpdy5 +tinytable_pxtrux1ja6chraeg3sje
-
(I)
+
@@ -7103,12 +7103,12 @@

Model Summaries

@@ -7250,16 +7250,16 @@

Model Summaries

-tinytable_glh2tfj40vrzbc6l8hzb +tinytable_073hvhj1uymt3tqdoc9q
-
+
@@ -7344,12 +7344,12 @@

Model Summaries

@@ -7466,15 +7466,15 @@

Model Summaries

-tinytable_rx0se4nak144lxodtco6 +tinytable_oqucziaa2f5rxye5oddz
-
+
@@ -7563,12 +7563,12 @@

Model Summaries

@@ -7697,15 +7697,15 @@

Model Summaries

-tinytable_avz1abqpghyn15q768ft +tinytable_a02mgv0yq2aqefnf2nxf
-
(1)
+
@@ -7804,12 +7804,12 @@

Model Summaries

rm("glance_custom.fixest")
@@ -7969,13 +7969,13 @@

Model Summaries

-tinytable_42s2q5mlksjckp5p75nz +tinytable_z9qa903vn1cxonyijtx1
-
(1)
+
@@ -8079,12 +8079,12 @@

Model Summaries

@@ -8191,12 +8191,12 @@

Model Summaries

-tinytable_1shpq2wa1cpkyejdqpgk +tinytable_i462aw95jiwanebf1vcy
-
OLS
+
@@ -8259,12 +8259,12 @@

Model Summaries

@@ -8339,13 +8339,13 @@

Model Summaries

-tinytable_c15lx9n0y2928sp8vpb6 +tinytable_ierdr440co0ittkvrkis
-
(1)
+
@@ -8419,12 +8419,12 @@

Model Summaries

@@ -8531,12 +8531,12 @@

Model Summaries

-tinytable_ilm86p0fvjfgpjpfr2ms +tinytable_b7lpy6o8nvigde8rkmkp
-
(1)
+
@@ -8619,12 +8619,12 @@

Model Summaries

@@ -8739,12 +8739,12 @@

Model Summaries

-tinytable_ydt55vodj93gkxcu138j +tinytable_ik4q684zuzkm1p8epj9p
-
(1)
+
@@ -8826,12 +8826,12 @@

Model Summaries

@@ -8966,12 +8966,12 @@

Model Summaries

<head> <meta charset="UTF-8"> <meta name="viewport" content="width=device-width, initial-scale=1.0"> - <title>tinytable_wd2p3rre3btolfnvj1e1</title> + <title>tinytable_81hl7auedfh8w7f5qwmh</title> <style> -.table td.tinytable_css_c0xazs972bxdfed0u1t0, .table th.tinytable_css_c0xazs972bxdfed0u1t0 { border-bottom: solid 0.1em #d3d8dc; } -.table td.tinytable_css_3dp8uus41ymhe93e5b6h, .table th.tinytable_css_3dp8uus41ymhe93e5b6h { text-align: left; } -.table td.tinytable_css_fp2odl38al328h1phmpm, .table th.tinytable_css_fp2odl38al328h1phmpm { text-align: center; } -.table td.tinytable_css_btmepwmwd9kej9dtkji6, .table th.tinytable_css_btmepwmwd9kej9dtkji6 { border-bottom: solid 0.05em black; } +.table td.tinytable_css_2i97j7tjrnvyb873si2p, .table th.tinytable_css_2i97j7tjrnvyb873si2p { border-bottom: solid 0.1em #d3d8dc; } +.table td.tinytable_css_1bylhko206yu4pic1doq, .table th.tinytable_css_1bylhko206yu4pic1doq { text-align: left; } +.table td.tinytable_css_y9xylka3k21i45qc7wxb, .table th.tinytable_css_y9xylka3k21i45qc7wxb { text-align: center; } +.table td.tinytable_css_dr6ybqipd0iv3huqoxdw, .table th.tinytable_css_dr6ybqipd0iv3huqoxdw { border-bottom: solid 0.05em black; } </style> <script src="https://polyfill.io/v3/polyfill.min.js?features=es6"></script> <script id="MathJax-script" async src="https://cdn.jsdelivr.net/npm/mathjax@3/es5/tex-mml-chtml.js"></script> @@ -8989,7 +8989,7 @@

Model Summaries

<body> <div class="container"> - <table class="table table-borderless" id="tinytable_wd2p3rre3btolfnvj1e1" style="width: auto; margin-left: auto; margin-right: auto;" data-quarto-disable-processing='true'> + <table class="table table-borderless" id="tinytable_81hl7auedfh8w7f5qwmh" style="width: auto; margin-left: auto; margin-right: auto;" data-quarto-disable-processing='true'> <thead> <tr> @@ -9052,12 +9052,12 @@

Model Summaries

</div> <script> - function styleCell_tinytable_wn0cfg0rrf6tneafdah2(i, j, css_id) { - var table = document.getElementById("tinytable_wd2p3rre3btolfnvj1e1"); + function styleCell_tinytable_e028ka9fujpe5fx6oh6y(i, j, css_id) { + var table = document.getElementById("tinytable_81hl7auedfh8w7f5qwmh"); table.rows[i].cells[j].classList.add(css_id); } function insertSpanRow(i, colspan, content) { - var table = document.getElementById('tinytable_wd2p3rre3btolfnvj1e1'); + var table = document.getElementById('tinytable_81hl7auedfh8w7f5qwmh'); var newRow = table.insertRow(i); var newCell = newRow.insertCell(0); newCell.setAttribute("colspan", colspan); @@ -9065,8 +9065,8 @@

Model Summaries

// this may be unsafe, but innerText does not interpret <br> newCell.innerHTML = content; } - function spanCell_tinytable_wn0cfg0rrf6tneafdah2(i, j, rowspan, colspan) { - var table = document.getElementById("tinytable_wd2p3rre3btolfnvj1e1"); + function spanCell_tinytable_e028ka9fujpe5fx6oh6y(i, j, rowspan, colspan) { + var table = document.getElementById("tinytable_81hl7auedfh8w7f5qwmh"); const targetRow = table.rows[i]; const targetCell = targetRow.cells[j]; for (let r = 0; r < rowspan; r++) { @@ -9093,36 +9093,36 @@

Model Summaries

targetCell.colSpan = colspan; } -window.addEventListener('load', function () { styleCell_tinytable_wn0cfg0rrf6tneafdah2(0, 0, 'tinytable_css_c0xazs972bxdfed0u1t0') }) -window.addEventListener('load', function () { styleCell_tinytable_wn0cfg0rrf6tneafdah2(0, 1, 'tinytable_css_c0xazs972bxdfed0u1t0') }) -window.addEventListener('load', function () { styleCell_tinytable_wn0cfg0rrf6tneafdah2(0, 0, 'tinytable_css_3dp8uus41ymhe93e5b6h') }) -window.addEventListener('load', function () { styleCell_tinytable_wn0cfg0rrf6tneafdah2(1, 0, 'tinytable_css_3dp8uus41ymhe93e5b6h') }) -window.addEventListener('load', function () { styleCell_tinytable_wn0cfg0rrf6tneafdah2(2, 0, 'tinytable_css_3dp8uus41ymhe93e5b6h') }) -window.addEventListener('load', function () { styleCell_tinytable_wn0cfg0rrf6tneafdah2(3, 0, 'tinytable_css_3dp8uus41ymhe93e5b6h') }) -window.addEventListener('load', function () { styleCell_tinytable_wn0cfg0rrf6tneafdah2(4, 0, 'tinytable_css_3dp8uus41ymhe93e5b6h') }) -window.addEventListener('load', function () { styleCell_tinytable_wn0cfg0rrf6tneafdah2(5, 0, 'tinytable_css_3dp8uus41ymhe93e5b6h') }) -window.addEventListener('load', function () { styleCell_tinytable_wn0cfg0rrf6tneafdah2(6, 0, 'tinytable_css_3dp8uus41ymhe93e5b6h') }) -window.addEventListener('load', function () { styleCell_tinytable_wn0cfg0rrf6tneafdah2(7, 0, 'tinytable_css_3dp8uus41ymhe93e5b6h') }) -window.addEventListener('load', function () { styleCell_tinytable_wn0cfg0rrf6tneafdah2(8, 0, 'tinytable_css_3dp8uus41ymhe93e5b6h') }) -window.addEventListener('load', function () { styleCell_tinytable_wn0cfg0rrf6tneafdah2(9, 0, 'tinytable_css_3dp8uus41ymhe93e5b6h') }) -window.addEventListener('load', function () { styleCell_tinytable_wn0cfg0rrf6tneafdah2(10, 0, 'tinytable_css_3dp8uus41ymhe93e5b6h') }) -window.addEventListener('load', function () { styleCell_tinytable_wn0cfg0rrf6tneafdah2(11, 0, 'tinytable_css_3dp8uus41ymhe93e5b6h') }) -window.addEventListener('load', function () { styleCell_tinytable_wn0cfg0rrf6tneafdah2(12, 0, 'tinytable_css_3dp8uus41ymhe93e5b6h') }) -window.addEventListener('load', function () { styleCell_tinytable_wn0cfg0rrf6tneafdah2(0, 1, 'tinytable_css_fp2odl38al328h1phmpm') }) -window.addEventListener('load', function () { styleCell_tinytable_wn0cfg0rrf6tneafdah2(1, 1, 'tinytable_css_fp2odl38al328h1phmpm') }) -window.addEventListener('load', function () { styleCell_tinytable_wn0cfg0rrf6tneafdah2(2, 1, 'tinytable_css_fp2odl38al328h1phmpm') }) -window.addEventListener('load', function () { styleCell_tinytable_wn0cfg0rrf6tneafdah2(3, 1, 'tinytable_css_fp2odl38al328h1phmpm') }) -window.addEventListener('load', function () { styleCell_tinytable_wn0cfg0rrf6tneafdah2(4, 1, 'tinytable_css_fp2odl38al328h1phmpm') }) -window.addEventListener('load', function () { styleCell_tinytable_wn0cfg0rrf6tneafdah2(5, 1, 'tinytable_css_fp2odl38al328h1phmpm') }) -window.addEventListener('load', function () { styleCell_tinytable_wn0cfg0rrf6tneafdah2(6, 1, 'tinytable_css_fp2odl38al328h1phmpm') }) -window.addEventListener('load', function () { styleCell_tinytable_wn0cfg0rrf6tneafdah2(7, 1, 'tinytable_css_fp2odl38al328h1phmpm') }) -window.addEventListener('load', function () { styleCell_tinytable_wn0cfg0rrf6tneafdah2(8, 1, 'tinytable_css_fp2odl38al328h1phmpm') }) -window.addEventListener('load', function () { styleCell_tinytable_wn0cfg0rrf6tneafdah2(9, 1, 'tinytable_css_fp2odl38al328h1phmpm') }) -window.addEventListener('load', function () { styleCell_tinytable_wn0cfg0rrf6tneafdah2(10, 1, 'tinytable_css_fp2odl38al328h1phmpm') }) -window.addEventListener('load', function () { styleCell_tinytable_wn0cfg0rrf6tneafdah2(11, 1, 'tinytable_css_fp2odl38al328h1phmpm') }) -window.addEventListener('load', function () { styleCell_tinytable_wn0cfg0rrf6tneafdah2(12, 1, 'tinytable_css_fp2odl38al328h1phmpm') }) -window.addEventListener('load', function () { styleCell_tinytable_wn0cfg0rrf6tneafdah2(4, 0, 'tinytable_css_btmepwmwd9kej9dtkji6') }) -window.addEventListener('load', function () { styleCell_tinytable_wn0cfg0rrf6tneafdah2(4, 1, 'tinytable_css_btmepwmwd9kej9dtkji6') }) +window.addEventListener('load', function () { styleCell_tinytable_e028ka9fujpe5fx6oh6y(0, 0, 'tinytable_css_2i97j7tjrnvyb873si2p') }) +window.addEventListener('load', function () { styleCell_tinytable_e028ka9fujpe5fx6oh6y(0, 1, 'tinytable_css_2i97j7tjrnvyb873si2p') }) +window.addEventListener('load', function () { styleCell_tinytable_e028ka9fujpe5fx6oh6y(0, 0, 'tinytable_css_1bylhko206yu4pic1doq') }) +window.addEventListener('load', function () { styleCell_tinytable_e028ka9fujpe5fx6oh6y(1, 0, 'tinytable_css_1bylhko206yu4pic1doq') }) +window.addEventListener('load', function () { styleCell_tinytable_e028ka9fujpe5fx6oh6y(2, 0, 'tinytable_css_1bylhko206yu4pic1doq') }) +window.addEventListener('load', function () { styleCell_tinytable_e028ka9fujpe5fx6oh6y(3, 0, 'tinytable_css_1bylhko206yu4pic1doq') }) +window.addEventListener('load', function () { styleCell_tinytable_e028ka9fujpe5fx6oh6y(4, 0, 'tinytable_css_1bylhko206yu4pic1doq') }) +window.addEventListener('load', function () { styleCell_tinytable_e028ka9fujpe5fx6oh6y(5, 0, 'tinytable_css_1bylhko206yu4pic1doq') }) +window.addEventListener('load', function () { styleCell_tinytable_e028ka9fujpe5fx6oh6y(6, 0, 'tinytable_css_1bylhko206yu4pic1doq') }) +window.addEventListener('load', function () { styleCell_tinytable_e028ka9fujpe5fx6oh6y(7, 0, 'tinytable_css_1bylhko206yu4pic1doq') }) +window.addEventListener('load', function () { styleCell_tinytable_e028ka9fujpe5fx6oh6y(8, 0, 'tinytable_css_1bylhko206yu4pic1doq') }) +window.addEventListener('load', function () { styleCell_tinytable_e028ka9fujpe5fx6oh6y(9, 0, 'tinytable_css_1bylhko206yu4pic1doq') }) +window.addEventListener('load', function () { styleCell_tinytable_e028ka9fujpe5fx6oh6y(10, 0, 'tinytable_css_1bylhko206yu4pic1doq') }) +window.addEventListener('load', function () { styleCell_tinytable_e028ka9fujpe5fx6oh6y(11, 0, 'tinytable_css_1bylhko206yu4pic1doq') }) +window.addEventListener('load', function () { styleCell_tinytable_e028ka9fujpe5fx6oh6y(12, 0, 'tinytable_css_1bylhko206yu4pic1doq') }) +window.addEventListener('load', function () { styleCell_tinytable_e028ka9fujpe5fx6oh6y(0, 1, 'tinytable_css_y9xylka3k21i45qc7wxb') }) +window.addEventListener('load', function () { styleCell_tinytable_e028ka9fujpe5fx6oh6y(1, 1, 'tinytable_css_y9xylka3k21i45qc7wxb') }) +window.addEventListener('load', function () { styleCell_tinytable_e028ka9fujpe5fx6oh6y(2, 1, 'tinytable_css_y9xylka3k21i45qc7wxb') }) +window.addEventListener('load', function () { styleCell_tinytable_e028ka9fujpe5fx6oh6y(3, 1, 'tinytable_css_y9xylka3k21i45qc7wxb') }) +window.addEventListener('load', function () { styleCell_tinytable_e028ka9fujpe5fx6oh6y(4, 1, 'tinytable_css_y9xylka3k21i45qc7wxb') }) +window.addEventListener('load', function () { styleCell_tinytable_e028ka9fujpe5fx6oh6y(5, 1, 'tinytable_css_y9xylka3k21i45qc7wxb') }) +window.addEventListener('load', function () { styleCell_tinytable_e028ka9fujpe5fx6oh6y(6, 1, 'tinytable_css_y9xylka3k21i45qc7wxb') }) +window.addEventListener('load', function () { styleCell_tinytable_e028ka9fujpe5fx6oh6y(7, 1, 'tinytable_css_y9xylka3k21i45qc7wxb') }) +window.addEventListener('load', function () { styleCell_tinytable_e028ka9fujpe5fx6oh6y(8, 1, 'tinytable_css_y9xylka3k21i45qc7wxb') }) +window.addEventListener('load', function () { styleCell_tinytable_e028ka9fujpe5fx6oh6y(9, 1, 'tinytable_css_y9xylka3k21i45qc7wxb') }) +window.addEventListener('load', function () { styleCell_tinytable_e028ka9fujpe5fx6oh6y(10, 1, 'tinytable_css_y9xylka3k21i45qc7wxb') }) +window.addEventListener('load', function () { styleCell_tinytable_e028ka9fujpe5fx6oh6y(11, 1, 'tinytable_css_y9xylka3k21i45qc7wxb') }) +window.addEventListener('load', function () { styleCell_tinytable_e028ka9fujpe5fx6oh6y(12, 1, 'tinytable_css_y9xylka3k21i45qc7wxb') }) +window.addEventListener('load', function () { styleCell_tinytable_e028ka9fujpe5fx6oh6y(4, 0, 'tinytable_css_dr6ybqipd0iv3huqoxdw') }) +window.addEventListener('load', function () { styleCell_tinytable_e028ka9fujpe5fx6oh6y(4, 1, 'tinytable_css_dr6ybqipd0iv3huqoxdw') }) </script> </body> @@ -9232,13 +9232,13 @@

Model Summaries

-tinytable_bgyur1ad2rtggxu697lm +tinytable_myl0s6bnpg44bqowtle9
-
Another math expression: $\sum_{i=1}^n x^-i$
+
@@ -9347,12 +9347,12 @@

Model Summaries

@@ -9472,14 +9472,14 @@

Model Summaries

-tinytable_dnpksjevzf413uytw944 +tinytable_0lrpjbx6d6z8avuxxh14
-
(1)
+
@@ -9570,12 +9570,12 @@

Model Summaries

@@ -9706,13 +9706,13 @@

Model Summaries

-tinytable_gnxqelpt3e58rikaxvvx +tinytable_k2n4ehsa16320dp7gqma
-
4
+
@@ -9733,33 +9733,33 @@

Model Summaries

- - + + - - + + - - + + - - + + - + - + @@ -9806,12 +9806,12 @@

Model Summaries

@@ -9933,12 +9933,12 @@

Model Summaries

-tinytable_vnnj050bm86wrx2jlr2i +tinytable_mlspi5k0y98jwq9glrge
-
(1)
(Intercept)326.012 281.967 326.362 283.790
(30.638)(41.371)(31.592)(41.181)
mpg -8.966 -10.205 -8.991 -10.225
(1.390) (2.339) (1.410) (2.207)
drat 19.036 18.796
(20.568)(19.682)
Num.Obs.
+
@@ -9958,27 +9958,27 @@

Model Summaries

- + - + - + - + - + - + @@ -9986,31 +9986,31 @@

Model Summaries

- + - + - + - + - + - + - + @@ -10022,23 +10022,23 @@

Model Summaries

- + - +
(1)
fit_x_endo_1 -0.174 13.669
(4.108) (39.671)
fit_x_endo_2 3.060 77.421
(11.055) (190.021)
x1 0.329 -17.688
(0.508) (45.941)
Num.Obs.
R2 -2.741 -2286.721
R2 Adj. -2.871 -2366.156
R2 Within -8.812 -5998.883
R2 Within Adj. -9.017 -6123.881
AIC 578.0 1540.4
BIC 596.1 1558.4
RMSE 1.60 39.47
Std.Errors
Wald (x_endo_1)50.8615423860559 7.24363130222479
Wald (x_endo_2)0.5815924698063610.858059193776838
@@ -10165,14 +10165,14 @@

Model Summaries

-tinytable_3a5oeypthhhlna2s2bdl +tinytable_50onqcwlrm5lbajno0z3
- +
@@ -10194,43 +10194,43 @@

Model Summaries

- - - + + + - - - + + + - - - + + + - - - + + + - - - + + + - - - + + + - + @@ -10242,43 +10242,43 @@

Model Summaries

- - - + + + - - - + + + - + - + - + - + - + @@ -10287,12 +10287,12 @@

Model Summaries

@@ -10474,7 +10474,7 @@

Model Summaries

x <- broom::tidy(mod)toc()
-
tidy: 0.003 sec elapsed
+
tidy: 0.002 sec elapsed
tic("glance")
 x <- broom::glance(mod)
@@ -10486,13 +10486,13 @@ 

Model Summaries

x <- parameters::parameters(mod) toc()
-
parameters: 0.026 sec elapsed
+
parameters: 0.021 sec elapsed
tic("performance")
 x <- performance::performance(mod)
 toc()
-
performance: 0.014 sec elapsed
+
performance: 0.011 sec elapsed

In my experience, the main bottleneck tends to be computing goodness-of-fit statistics. The performance extractor allows users to specify a metrics argument to select a subset of GOF to include. Using this can speedup things considerably.

@@ -10505,12 +10505,12 @@

Model Summaries

-tinytable_wbc4i00xeuv5562ue5j1 +tinytable_zd23lfshk9ui5tb2okyn
-
Listwise deletion
(Intercept)81.719 75.699 79.645 71.717 73.303 72.284
(14.584)(13.342)(13.468)(14.112)(14.664)(12.809)
Literacy -0.638 -0.499 -0.541 -0.418 -0.470 -0.435
(0.234) (0.205) (0.216) (0.221) (0.228) (0.194)
Commerce -0.305 -0.283 -0.331 -0.269 -0.266 -0.297
(0.168) (0.145) (0.148) (0.159) (0.157) (0.152)
Num.Obs. 59 60 86 86
R2 0.121 0.078 0.102 0.068 0.072 0.077
R2 Adj. 0.089 0.055 0.079 0.035 0.047 0.054
AIC 557.0 561.8
BIC 565.3 570.2
Log.Lik. -274.488-276.887
F 3.843 2.071
RMSE 25.37 24.43
+
@@ -10585,12 +10585,12 @@

Model Summaries

@@ -10700,10 +10700,10 @@

Model Summaries

-
         term      estimate         mad conf.level     conf.low    conf.high prior.distribution prior.location prior.scale group std.error statistic p.value
-1 (Intercept) -2.2246277000 0.599969846       0.95 -3.433826756 -1.055312644             normal        0.40625  1.24747729              NA        NA      NA
-2          hp  0.0006919802 0.001109785       0.95 -0.001499742  0.002809575             normal        0.00000  0.01819465              NA        NA      NA
-3        drat  0.7030982373 0.139586860       0.95  0.434089902  0.984676752             normal        0.00000  2.33313429              NA        NA      NA
+
         term      estimate        mad conf.level     conf.low    conf.high prior.distribution prior.location prior.scale group std.error statistic p.value
+1 (Intercept) -2.1971590667 0.57768137       0.95 -3.334876772 -1.105943165             normal        0.40625  1.24747729              NA        NA      NA
+2          hp  0.0006333653 0.00105191       0.95 -0.001422686  0.002819079             normal        0.00000  0.01819465              NA        NA      NA
+3        drat  0.6992566587 0.13402411       0.95  0.437680965  0.969048697             normal        0.00000  2.33313429              NA        NA      NA

This shows that there is no std.error column, but that there is a mad statistic (mean absolute deviation). So we can do:

@@ -10726,12 +10726,12 @@

Model Summaries

-tinytable_qnegdj09ycari5ihgf74 +tinytable_r1vayi7jelm981qpeb1x
-
(1)
+
@@ -10751,11 +10751,11 @@

Model Summaries

- + - + @@ -10767,11 +10767,11 @@

Model Summaries

- + - + @@ -10779,19 +10779,19 @@

Model Summaries

- + - + - + - + @@ -10799,7 +10799,7 @@

Model Summaries

- + @@ -10818,12 +10818,12 @@

Model Summaries

@@ -10905,9 +10905,9 @@

Model Summaries

get_estimates(mod, centrality = "mean")
         term      estimate     std.dev conf.level     conf.low    conf.high prior.distribution prior.location prior.scale group std.error statistic p.value
-1 (Intercept) -2.2256516592 0.604144261       0.95 -3.433826756 -1.055312644             normal        0.40625  1.24747729              NA        NA      NA
-2          hp  0.0006990604 0.001121095       0.95 -0.001499742  0.002809575             normal        0.00000  0.01819465              NA        NA      NA
-3        drat  0.7031661013 0.140682478       0.95  0.434089902  0.984676752             normal        0.00000  2.33313429              NA        NA      NA
+1 (Intercept) -2.2124440913 0.579236863 0.95 -3.334876772 -1.105943165 normal 0.40625 1.24747729 NA NA NA +2 hp 0.0006557409 0.001073215 0.95 -0.001422686 0.002819079 normal 0.00000 0.01819465 NA NA NA +3 drat 0.7008098831 0.136555046 0.95 0.437680965 0.969048697 normal 0.00000 2.33313429 NA NA NA
modelsummary(mod, statistic = "std.dev", centrality = "mean")
@@ -10916,12 +10916,12 @@

Model Summaries

-tinytable_yo5obmqtlumjxzrgh4yf +tinytable_89ye4dcynow3zz9elow2
-
(1)
(Intercept)-2.225 -2.197
(0.600)(0.578)
hp
drat 0.703 0.699
(0.140)(0.134)
Num.Obs.
R2 0.497 0.495
R2 Adj. 0.431 0.437
Log.Lik. -12.071-12.133
ELPD -15.2 -15.1
ELPD s.e.
LOOIC 30.4 30.2
LOOIC s.e.
+
@@ -10941,11 +10941,11 @@

Model Summaries

- + - + @@ -10957,11 +10957,11 @@

Model Summaries

- + - + @@ -10969,19 +10969,19 @@

Model Summaries

- + - + - + - + @@ -10989,7 +10989,7 @@

Model Summaries

- + @@ -11008,12 +11008,12 @@

Model Summaries

@@ -11094,10 +11094,10 @@

Model Summaries

get_estimates(mod, test = c("pd", "rope"))
-
         term      estimate         mad conf.level     conf.low    conf.high     pd rope.percentage prior.distribution prior.location prior.scale group std.error statistic p.value
-1 (Intercept) -2.2246277000 0.599969846       0.95 -3.433826756 -1.055312644 0.9995               0             normal        0.40625  1.24747729              NA        NA      NA
-2          hp  0.0006919802 0.001109785       0.95 -0.001499742  0.002809575 0.7330               1             normal        0.00000  0.01819465              NA        NA      NA
-3        drat  0.7030982373 0.139586860       0.95  0.434089902  0.984676752 1.0000               0             normal        0.00000  2.33313429              NA        NA      NA
+
         term      estimate        mad conf.level     conf.low    conf.high     pd rope.percentage prior.distribution prior.location prior.scale group std.error statistic p.value
+1 (Intercept) -2.1971590667 0.57768137       0.95 -3.334876772 -1.105943165 0.9995               0             normal        0.40625  1.24747729              NA        NA      NA
+2          hp  0.0006333653 0.00105191       0.95 -0.001422686  0.002819079 0.7270               1             normal        0.00000  0.01819465              NA        NA      NA
+3        drat  0.6992566587 0.13402411       0.95  0.437680965  0.969048697 1.0000               0             normal        0.00000  2.33313429              NA        NA      NA
diff --git a/vignettes/modelsummary_extension.html b/vignettes/modelsummary_extension.html index 79c479ff5..982ec86fc 100644 --- a/vignettes/modelsummary_extension.html +++ b/vignettes/modelsummary_extension.html @@ -423,12 +423,12 @@

Extension and Customization

-tinytable_jksl040r3pxtt6k384tx +tinytable_urqnt8gm8dgtlm7xko2e
-
(1)
(Intercept)-2.226 -2.212
(0.604)(0.579)
hp
drat 0.703 0.701
(0.141)(0.137)
Num.Obs.
R2 0.497 0.495
R2 Adj. 0.431 0.437
Log.Lik. -12.071-12.133
ELPD -15.2 -15.1
ELPD s.e.
LOOIC 30.4 30.2
LOOIC s.e.
+
@@ -483,12 +483,12 @@

Extension and Customization

@@ -631,12 +631,12 @@

Extension and Customization

-tinytable_5twluwvpajnufzz0zw3n +tinytable_ab02b4lvfzpm7ypayfvc
-
(1)
+
@@ -708,12 +708,12 @@

Extension and Customization

@@ -827,13 +827,13 @@

Extension and Customization

-tinytable_m5fjx7sp2ezy631papdo +tinytable_sccr6fhs89g8wlpjbn8w
-
(1)
+
@@ -942,12 +942,12 @@

Extension and Customization

@@ -1080,12 +1080,12 @@

Extension and Customization

-tinytable_h4l0flseibxj7c69crx7 +tinytable_v5tlkoopaevlgnaetdns
-
(1)
+
@@ -1140,12 +1140,12 @@

Extension and Customization

@@ -1250,13 +1250,13 @@

Extension and Customization

-tinytable_utn1rzbcwfztkd0j2ikt +tinytable_ua5gn2kfm4t1cyiowe8f
-
(1)
+
@@ -1336,12 +1336,12 @@

Extension and Customization

diff --git a/vignettes/tinytable_assets/id0514m942vvnijlnihcrn.png b/vignettes/tinytable_assets/id0514m942vvnijlnihcrn.png new file mode 100644 index 0000000000000000000000000000000000000000..5fb35cb5416f169de1aa3b0cbcb0c4dbe86dcf71 GIT binary patch literal 1295 zcmeAS@N?(olHy`uVBq!ia0y~yV1B{C!05}t3=~;nymb+fatiPXaRt)W*47RV4mmkF zMMXtjU0stWPhPQN#mbc{*RNl{VZ(-v8#nIRv*+#Gx9{G)d;k9ZhYuea~&Dm)SRsEngL$;EzZPeBr-2{*6{I z=ijn#K7CaZpO~i!{yNIB*Y5?V(|X~mrVFoI<|%x!TBuGZAw;0z2+Lt7%>4Y5UP;9M z^o56iaYEC}u=69S@c)I$ztaD0e0sx_9xTgRB literal 0 HcmV?d00001 diff --git a/vignettes/tinytable_assets/id51top1lgh29wn36x1i3q.png b/vignettes/tinytable_assets/id51top1lgh29wn36x1i3q.png new file mode 100644 index 0000000000000000000000000000000000000000..98112fa9caa967494486e8f84cbc20994b07e9a1 GIT binary patch literal 1433 zcmeAS@N?(olHy`uVBq!ia0y~yV1B{C!05}t3=~;nymb+fvJCJEaRt)y^749mdM++5 zp`oGa>FF668F_hmixw?fv0}x_l`Ge;U%z3)hI8l6y?OKI-Me=mK79D|=g*Q@sN+sUs<)cA5bGxWUseg0_%BEMe0 zi7T(R`c=1q1*{B*?hz_HdwP3lZO||+;xFdU=)vr!Dt#FFAeGtpO+_k$u9k)y8-!T2)|6A7s4ka&S_7+Aj$B;{+ aI))zU)mc&OYx;p@EQ6=3pUXO@geCxUuqCDd literal 0 HcmV?d00001 diff --git a/vignettes/tinytable_assets/id7gq3p7xrmxzgz3czxz5e.png b/vignettes/tinytable_assets/id7gq3p7xrmxzgz3czxz5e.png new file mode 100644 index 0000000000000000000000000000000000000000..1e7a9f616ee89c03bb9130a89453216cf63eb6d9 GIT binary patch literal 1728 zcmeAS@N?(olHy`uVBq!ia0y~yV1B{C!05}t3=~;nymb+f3J>rJaRt(WXNX4ADm)+MzgbO%3 zT0WO~vgLp2tq&)JnUkCk3EQs@E68ttel`9;_xD#X*%{u?yO7v`13CD=sNYj}Z@#}g zV_ufi|HoHv|Uc^yJx-Rl6{x8OuJ;q>X9Y* z-u=aVyZ4Lz=hYpwudAuzYiT)mFx>xqhZ~s^H!T&!Wt~vdGZTg|^*WX^Dy3H3Fvz*!)@t}I< Y#YdYbcg-x41Xe{1p00i_>zopr0FUvi5C8xG literal 0 HcmV?d00001 diff --git a/vignettes/tinytable_assets/idbvvzhsj7tpyk2th6f6xm.png b/vignettes/tinytable_assets/idbvvzhsj7tpyk2th6f6xm.png new file mode 100644 index 0000000000000000000000000000000000000000..8648ddbfd4143e28e1e233dbb3663e263986fbd1 GIT binary patch literal 2316 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 literal 0 HcmV?d00001 diff --git a/vignettes/tinytable_assets/idi8gnz0s7w0v95g9caeh2.png b/vignettes/tinytable_assets/idi8gnz0s7w0v95g9caeh2.png new file mode 100644 index 0000000000000000000000000000000000000000..1560aef70c580ff6d4cf7310650122249796eec4 GIT binary patch literal 2344 zcmeAS@N?(olHy`uVBq!ia0y~yV1B{C!05}t3=~;nymb+fvJCJEaRt)F#l=lcO&uK_ zGiT0Rv0}x_l`Ge;U%z3)h8s6-+`D)0;lqbdo;-Q_^y#~I?>>C^@a4;wZ{NQC|Nme1 z`KDtG3>>RGT^vIy=DfWexh}$-$Hg(d&-nS<`i+c#&N4J5tXAEW#rl0ysa-9@+gh)B zh7WH!W!VI*coa$`99|eSTu5YCc$mSdow0?FnFA>CYwo|FuLJ)t(|7lLQU2@8nlDc^ zZa(#U8S{OqzWYhNa%60}@U9Ww4I&jnJxtDgn^N#PE6#H(Al??fA@TOHl^yl(wEO*sqPEsz4QH6e%Eud*B@0d8V=M<59v4MUta&^%PG6> z$DF#g_orNV$h~mC_X{22U%Ok*8I5da{hx1#7w_}7m%FFz8KB@2xkF0`Iw za1ys-=7@a(th7c2NDGe-fBXA?1;4m(|GZQCKWH6~v+^faB3}PX{H6U&f9A*Uk9r|r r&shGeTJz!73ysV1HZ81pKFF&car|Y?yNnyybP0l+XkKI}O&n literal 0 HcmV?d00001 diff --git a/vignettes/tinytable_assets/idir7hvoenps9jcos2892c.png b/vignettes/tinytable_assets/idir7hvoenps9jcos2892c.png new file mode 100644 index 0000000000000000000000000000000000000000..b3b581202a685d9adbcebf655a19e6c6636b0358 GIT binary patch literal 12855 zcmbWeWmJ^i7dJeJ$}J*DcL)k15~7GOl!A1}Al;yJ4PAhCpVv{ocC0_egkJM$na-~o{GA1tA45Rws8AcU9hCdHjTnF zNm4nIFwS=U@1!O;VGWdI5@gDE-whofo0vDcKQ$q_y|d}aV0GE6t+m@*D6{-^(!%bU zb`b)c23vhjipGI{xMXOd2OopD1g_vijEH9n`m=DeJs$Wtfc@V*G|$I{%_%j=%1A5t z++%hj#AKV_P+x(;(n(tA{b&TnwTNufYCN|#FW{OCuRlsjzU~lFk{{?Cdi#u3>sI2p z>YVQ-_Dj?Qny|OMHheS+FXf)H;pw>YTO1oRq(110ETNWAifd&Sf!3FQyh7iN{K(BP_W!$L3S^p%`WIompa>cu!prDr--Fi zzS~SztdF_o`^(9o^5ix==O~E`%U<0Qn126UoVNkVXj|dqbiNCLC9HaD}8|)rF1f`T*1|gDc?srzA^hm zxA9PgqNY>47RP1zp)lA9F7!$%vhSlA$LRB-FMpa!$;y=VVmx`vO|NcXFEhV9)N(oh zb3ukd)x<@u*^%pCg`BY83WXn2XBU&^^u8T4Pgtje z!Kg5>nX#VgTz1Avcl+bL&$g<+w2%so|3$=d6L!a#cCf2u^R2zmMiRoBbDw~1qf%zQ zcKg!#(FNvgbWu7$gMwHD-y(m8D@fAFWbScMh(|`hkuD+z8|NF zc{36Zn9g%ODSag3+m<~6(FE&UGMTqzJe6(037Mw0W!SldQ7F zV;D)4E=KQ61A-{h!2xfF(WxCJ;A(lb_ug1b3>nf`L;pbSd6(aN+(7wrZRBlOGYhDO2m>udF^2S4unlWKq%aBGuoit<*jy})s{t(w|Wj$h($23c|(OQ zt&q!6M7|DKGwZjW%O zN>0XtDisQR{(MHKp2;hiT3WnQJ$*Usp+E2XN(1;P0-P3l9@X7a;+F~qVK&%bB_F_U z=m{xvSB2H7?EWtQ4fQJE2N{&iU?yLvt}2ijAsIULxtjXO5aJ-ExOuD0t8}8XF#W9B z8?f{aDvaN68HI2=dS#clhPq-8(Cm^dPvzQeBOjrXlni{N0c>Ih0Jgu;u~8$9DtY1P zw93Lf!M4t~C|=*3Of7_d`PTQ~yhNbVewXuMa6^fTiDZ#24!%b{mYQN2QS2#M)k~;3 zbNzRD!4P7nfdGrBUEK2!O8ku(F=QYy?V!ZhIBzntH-c-gKd)23{8Ejoaodf@4~lmq zUP)G}OdB0cU}Z(GEQ+piw0215+Ty@gNdw@9WIi){<3Afj``7boahaJ(-e|R>Jbq_8 zpvQ9SAk;nliE^$5Z2#)oVhL~_7m_S|te!J>b#l?zJ8e?8GAIDqIJC?U5LCU|nPiiM z_2IiejtW{QJCC?+#A{L2rxf@~FJw3D6z13T(;kmN%R}37-=mGKBDh3F7Kwk^+J?vL zS+zAF)eoRD}Ir7e`a_QHTK;l5LQGMZ?5x2HbjriNl(Im@xb z!_gW*w$5Zgwzy=#(2y}-H$vzG5`8)!{x8`B*G$v!v#U(eN$G%$Q&yINeUGO?A-3h41 zOMymJ3l^3}}mDE@yOUjsUSeRN=Jw#H;KmkCYZsevKfduOjYntocM zN&+eTpTBto>BmFE(YRLRIuk2q4s2-lPF&Hn7*Zlx8)33+h$SjYSFvpc+L^*o?t*E< z8|XOWI3n{f+i(A#wa^dRHDL@qH`d3CFZ1D%@$Ho{vjcRO@BZfGi^E`#cGYhVnsjlS z(4yHJF8%LIfzM78_O&6WV6VDE`%g4||EMsm#`UnaU+G5al~nDjOuzRcX5cV+K0$}w zstjvLg2Zx7C>G}c9knI5koIFDO!}4u_3)!oO;5(6=TZ<7I9wP%eOV9U;avSS1(xWo zLV%Yq=PbuaDyOKHix~1h7*i8)b_YY%KNSM`j8L>0DmM2I{`|z%q09wRS>z9Zr~CSh z@4IjQwJNgA$N1sXggwTv4U49puU_5&67lnDQ==9esF#)bZ)bNg$@KFS>c7Ogj>|XF zU$k)K{w?^`MnCwJG2-obok+p-mQ#!HBh@jZhQd%1=a(6)l0EEO+O{#HE@0}~I_NUa{+#Sa3O2vlC8P-&DJA?v!Y_wE?8KkyUSS{1{Gv*a*#4_!`t*#n|3G zE30mjPr7`k+ba$+DAXFLhNBn%m5x!l;3O_0+6F&Q@jW3NsaC1KGliA=2y8=4e|~{* zwKmaY;?SnqvSW7Vm_jpD%4&s39io5(P>?fS>vsRyqI!p5K0KX>75OD>*0$R7@ZZa+ zb3hq~wf`VfrdYF+>(&WZgFTfNW44Z(K1wE%|4;|MqSH)w3TGN+v(*~yQs`3uiT8EZ z>!lOw3~k7^7D0SW&rpr|OUZrZ=o|^&PilO>=ea7X$T*V@@z?_*#cFP_|G8X33Z{9( zrM@BII(1p)PVgWe;(0ja*J?m$N)N^83llpYIeQwQ=?9g#TzGR;hQ?loX#~Pxj-){0 zUz-FTC(}Hp2?Hk-RiYNLe+xXDl8T@ctbm;R$FEw10qon(1omu5(T>-SmZ6N1bGi*-7gt`fe#r0V} zbF|ks2<89I#{tF|*eW?~L;A+H1tP!iy{Mr zyIt5k;X?{W+TXn;t;I6Nw%LL=B>d91CS;0HTLXK6uKKt<=n4NZMS*hck7-W*QffP_=k42&@GsZ`_d?6Qe(V#+q|_A3i(Ewt)D@H5u{ z|B20C!*6@Gk~;yxW{|}&F&0)`bYMFu;zs`Q@Db=v`w>#DUhmD8a(kPi;2$sS_!twk zHGf+hy)qLAOJB*?{cK{H=br$9LGMsQ-ob@4KT1@${%znJ0XAsP7r4;YG(m|!36oqt ziZ=51Tr#zQqP~J^1r&Z8XyWULGI#r{v7#6oT#s4 z%Ui=0#>^a@$ocd3Vu$xiNPH2Lx$I~H;bI>N?k(?E(_{xu-;i7OAGI#u+&syGp{pB+sqjM!xj_Uv0{ApZqNF36fYG8N0* zb{9aF26=nm5Pq=W7XHH{m5f~3Hb6p&(|LY!Q0~cL{|2<6q@#_#lZ}n2m?NRjG7w{_ z{yJ4^`lO?g@Be%Fo{ygLFvw{|D(h8XTjQ5+2IJ=*_qu-#L8<5*yFzP~yoICljo0Fk z`CasblEH^pc$Y$^*<=qml>O7v^OLh+ zJK;X?F=TTo_cNuN(4Ul&Z$l|Bpc54Bd-7LDGezCgdnM_$xNb!7ereP2*fzhhX21drC50>b_oM zN$Fkbh{y!Cj}0h5vm4O9se_jIzXg<@^VS8mxShCa{$`iImO%ah(D#d42!lsjmGKU( zYanNYc)POG*U6adHifxINi2OXr?;U!sDOqz_Qmhxq4L`;1MgYs$T3XS-1YDZg~*qL z$d8IX5lRmj4wo@DDi*xaDW~GVYnd_K75W6~W>mra96$(L41X}}c}QT0YT2oQOYh6x z3eCO=`I(FsdpyUV`#DCQ$BcwWYSTE2p*RYr+cRk`wyBVlYX1cEgNtgoN|AhWkb+O$ z6^31EXVG%(T$)RK3;ckg1ORuNV*!Jm9VnkL(tYG1o5%cwR?{mJnAhk3C|&2g5AQsh zZCpqZT!LQS&dbG9oy8X?V-)UCY4KDIG0p!# zwFjWOM#ZEoY4+_F{N$#$QO|)1GCfk1wEltJT2ONeeFdCjvmvxYTYwqk%`avs+$+$y zu_<8dPx_+*l#+@!0KPM#pLM@b@9JXC9C$Xpp^{QMVULs3nhWT7Ll8jRteiTkIPX@K zSoi_*IzGPc`BL=Sr{S&@D0zWN5ZndeZGlQ>bEdq+${S7ZhuL)`7cHSo8(4=TGXW{| z{PUVlPKeFhP#SPX%9mIc5H^?fEac)!AnPZ%1D0@poV|5%;fjFobX^aI6q62M$nR)C3>M! zX_T89%D)Nl09o7bPy&}4^avtp`%<-(YpW3l^0)LKiqh9C>X&_m%Y{g*#Atdkss)ywu|2OIp> zt!=b25-&Y%=xJ6D^SJxY_drb~@CfO%fOiA;qXYd7zp^^kQ1&MHjrxKfqNRP4;xnb! z@1C89U59Ol`vzR|H9K9Mi?RU(c!I#u4VUy4sA>ZI4ccuI&nZneIv?~GafB5>6wIzN zjn}&mU(m8amdyalke!?lG}XRit1_`9Ksx^R$HBd0Mpr#GIsdau{e=a>`k9imQSDm= z^qqWWp|bvEySG_gA-g*b0d_%ibsj8NaLQIqp^|cqDw3|~;0-g!2&Qm(R0YJ2RYopM zvz7H5!FpSE1U#}w{#jXWnio%nueRlP0N|h~0Prd<`lSAwT~|>?%x$e)MI3_Pm1-oZ zDxTPEWuOD;7QlF~Y-Sd@8ZNZ9#PrwJxk1AdUh9+yvG^3cFY4xe^{VQ*$Rt~Eup|=S zu$n|QbKud2e+T#fGP4Fy)?KDc6%6SW1fsbzYH@j-b8NegSA<;B+#nZla1+Gvs~4^d zXBCu%E=-~)ns<+1MH%#O<@|dH6u|&A3Ih0&DGom$+p7aM1ADF48sCiAh^%f6zk=8V zl~8k&wYEThEgpbLbU7QaNw7H^W*2zfkN;;I{as?Haq*_0l_(?TgqNBr%|?{7Dkk5% z^e`G?0}1kL;;8Yz@T1}ZOFXjwj$&3KxVO)jNg)6>001ODY!$8@f|Ko`0VRId)uk2U zZ9~mAQfKSyFF?)dhcT|k9lAH@B<Wz6WVj21vq9TuslS zKL`}Mh?U~EW!j)lcKvCf41T)JK2W8nTRQ1-tuUA#c)+`B)J#f@saFourVs(pyBU>l zWjp=^O^bg85rm1E85EP=rRO`tC0QKLm4S~G1ig~K-U7647ouz$U z16o^tT$bA$%O$oYsnbvpU8Uf{@JNnpQQxtwE?iHW)0RNu`;B(>#?ADY&J5i-{CWr_ z0<|AP;h%r6q#eFfe~%_y<#JNPdIf!^;oE!H`p>F3s;gU8C8TBuEOny>GOyKcdwlG@ z?7Hk6|L?Y(6$BJ$*h}UBT}jFRh~_A%#cifN*{#qG+t+W}2mqo|j>zHV;p#Xp?3Xn~ z;d*3*rX}Re=!#?{{d)$^mNxgWyr8i)xTD|Ks!pv4W{bG52CKk+p{)I4*C2*yR z(#p^wb91P+OJ661*|G1&9_X{uRxuPS`!hNdG`j)E+rDra79$l-hnWV>!LQ0fO&LKL z=hGl4>gk~b6z*Y58-4rtFyG%Q3TcQ(#emE@L0_dfh6+*V^>1ePQtNP_uxmuts3Y87 z&Qk!|1*mRm&Dj$l`T{GI00<3G?at$MYk)cF&;FF4KGbl6x!I*{$IB;qgpQ;kfO%uX zLg56nt1tW7ZsU+`XjmK^n6)wB ze+{Iy$dTIJ90`&-P`K+}y^Ll_GsPv4(+)V$yZ3at*m?@X0>F+`qQdZ)lHNRZPe{H6 z1$HK)dif|H4l}f-j`y|Nd|Mp9b5I>n6@oUkL1VKe9zk4DY#~-G;Lf_s#sV?410#?p zkC|EKjgxB5?Ih*imq01%$#&&MCJY;FR_0Y_4guz3Gr)_rJhM~n7|{TFHP3;$FXzGL zy77mZcQYEep-vqjlXTh@B06EmA9gH2FZW(2e&=nHQngoZVVlR!y(Kcz_jpt=?4Bn)uN1XAE6amG>X^ouH7 z$t_^b2PuamDR>S4>|M+j;^&Elm$I520yK3Wk;RyK$JDu6A~~H)Abu18KS7~6F3BfL zJ7Nr7u)DjCvD`Nw+*u`ux^+POOrs!O4PX-HtT8Gw<~VCu44uR|_Z=WLTczYho+dvR z&W6C(ZMF}*M>SbeoTDYJnOc7BBxCUzc1~_>#$vVE!3qG|d1<`<_I8u48nFNE4>`PpnxOq$S5Z`MQ~!oSIpvy|Z|nU|sg2C5W+U8o zpFEIs%n-KFd$7YfGTx>q=0bj-h1(vXSOmbxBXdQu*+iw~HI@$LqHsnzN}egQ9FcmkU#g1~+%bRdMPA!;xk$BjUY3(AsDV zr~*^1Cr<4a8xZoP87Wgi*@?AD&=_*duXs@@7}%D@6T`(+VC zG+!5ua|Cbry_A!Wt${CQRgUfP!DYYfYoy@9u727FG7MTeP4FFTZqY7n7lCyS)hA-h z=MVdm_>-R5!DkN%#iSs-3^6C^dxV89Fl>$_`?!cqAxXruTrKO3ueY>q!q=H$hSlOL zz;Eo0{ymdIX-wlZcP6~ewD7a0PIR{1Ubu;-kJ!>KuKmxi6j*_?w&_?FVV{*X1B(kH zUkyf8x=LB*RU#zg^7XklqUCuDn1k}D61c7wgEj~&QYgDJv_$n45+4>MArepS`QRva zxK&2&s|!trAfDfEqiS*2I~%G+y7L^<>!6DAyZY;p3}#(b-?wfOt&Z>ee_E#aq)v$g z&4yNUODKshwwg8f&p_VfH!33?we1t@Pnl`9-%P~%7|E@rfFy>sbl3-S;R{r{|H>7a z4I_4X3WDCwN}1zg=L0ZsBYV6#V%O~FBAnyshZpGzG(|w^SIJG(j?UG~vht#JGML-b zr~$JMY5^aGe9fXi83TAYMS%$kj&7i523B*fz3b{*r%3zrywQUl+WCk}BvSaB;}iLO z#IEgZo@dMv3%>R)ZW_)aVF27&ZZ>^Sq}Ww(6!=lt_KIaST?4a)U1(8*)nBnI)*=r? z9&P6Doxf_ZdN^3!`JJ7N;tdiH`0nca*sbj38qVX?po|zDy;&M0ZABqE-3gkj z4Z~Kc!5eLj+bhM|LN*st#@|6;gSoSC$@nyJQ?@LgvbblVIM=OpYK#T8yZIhz*sW@G z%|gusCRj?leV}4BMXjsyb~>j?+k`5R&SHGR^%`n+*YEcqYcmMPJSLsIww#SAK1yYH zJsna@dH8T?abaGy;!C-wmgmZXJAF)QT=MzexWUzv8~9`k{P?g>R2XIM<=w4H1*;N< zFY1ufhdqoA`GQv8saBU`JV7UP0|%o zhQWyUpt}I5va*v96vFxW$<;_@6yiTn z>W+P`*l3gdkD7+P8D6h(3|U*OJB= z7CkqjST@G4=m=GT@dITSN&I~W8IrX7Pi~RKFh%^mzZMII`ShEG-EQu2>^l8*mebuR z?ZuXD23SDIJYg)zR_C&_zQ%^W)qxIRvI9*yyeE!Vd0=+znsI+Oc5J*(y+F6p+~!K~ z{Z9scv0(PZ9gp0;d!vwf&hUDhJCmjs~Zu?G4HtaO@fV_Yu$KddxduFyA`r2 z+{=V@hZ0D^9Bt7c9$}|7rU}$YEHB~utr`}K?ar-^1?`GA!|iu;@OkjGuo4a4h=!gYAnTndVH4vPr zlPkZ&7@PsRI50nvY7#Eb0hvzvJheKHw4Wy4w1=vC*K>c`OErdgxYdXk+~mN!PwuJ; zGpkMS}R9ngp(kX`tQ4Nvn~H#+p57Y@vkh6c0T$ zyV@?>FB}teBcOi%{dN4V7v-JL*IVeZ_xS`Gkz(USNv&875P)Dj|IL?{VLzTT=vQ0i zEci;5d56{D&$y<)oem@TG;+Yi6y!*ogi(x2a(y&tDJ4Bbwxi!VGgArA zRMZNXYuBP4s|`G@FKB{Tn-@gNjWCiIFsG8{^v&ZI@<;OlC- z|4ju)gE4*2~ZN(0d~CjgJhP1M~&c|^*lXpOds zUZ-Pn1&0QTFwCsJZVis`2W189v#R`uLP4hE)N!RGL6p|c3$#G`a{ zO_oyUreHQ(neXK13gm*(IdzD4YO*!p6_bCn1*US2Y_b#>3aP3xr#QRAo%~`!JU2Mt zw2b^|ZJJ;ua$M}mQpXq$%z0=WUglPH{rab=%Pvj7CCA6)-|d9EVE8bjfRNN47%`jfgMb(X%G}&L45ZVQ&F_EzWMLtkA9=hU?83ROunhr1#S-|d%<)IXBj2hTgS;Xu*4+QC zB5}0d4>IxwwNNw{NC<$gJ#Aq#ZJX(gk*x z<2JT1kRXo{-Kd2wp&%TxbW*4M`34|7dt$6OD-7o^Vt9n0fHoX_K&@4FZc#(MalRBV zomIb)*Z+Rrr24NCXa$ktp(A|k&28{@!Q4`4BNk(}v#dsoGej=*Gv%ldpMGl-R@OWR96kPH4Hu@4`P%p<<`UtPL zM;a3DL;$-=kRGMCH=@;ZJ#9(Os_p39Xl7qJe^zC$zv(8n2l$ILdDA7v78OD62Xj<#V8hxL zj%B94ol`qF7xht2!ENYhn;yF;TiKWSE5)_SGQ$Aj&7%xD!N_v;{oN$gp5MPpU{F(c zDr^GeCo2O~HSW(Kj)fL6Otey=b<55z+6-Wjp_YQ{-PSfO{h;YH{oTzCb7GNi{t0`& zvoKgEWhwVk%yw%_!RZISz(Si8jTNy0p7GDW!}jsM{^1yIhkH4)A)x5iF^(7^jJG6= zzqa8;wv{U40M&6n45^eML-^XDUqE z((!yJ)#vNtWSUF-we$NxA=KgS;uKqPQ7oeCPaU(?DOPa;>Pn&9r?Xifmxi@+7fPEz zS41P=@dRf?w63OiL!BvBFyASCmw0)!gp3rHt!|{KGJFb?j6OB zw6TC4L5GF*%R$AWl4M1-*Zje+#s%Y?+MD3?G`Py%8X|8^&0={^_&ig?-hrRaBEr^s z^)Dt{xWR!82pT4?+^^?D#b)+coaWTyUjao(_IJVdKUI=6rHdcv>7`-pE|lX8QW^!d~#3Q zwm;lKr1+n=+mD(ku@py8PbkKm8hU7oe8h+OmA*i#QC!`((XOHsJv;k=s1N63u6G!f z15KwM3umj*3di_$qPTzV-%#Sb!ED8pJ;DCR`-qNqaz@}E@-0>e zN%SAif6On!)kr~8P4u&3qla;^)wMvFV-MeFTHu zB@Xsxmphhr&fmA#k3$n~eiOuV51KD#1Vi=}C5+?274>92$9IOs5`vJ*D;g@wbldel-r zAHYHvVDV1W4r@Jg-gc*ljnJ0$#_ilJE~P|+GeyN$1uoG`D=0iLbbK#Peo!6$62KY*tpq#Q~+F4fqO2q6(a^D zt75+&L6Y+msiU}8a1=`BoF=qY?$LKz(ErmD>>CO89Y})@|K1zVeZH`k326;g$eGeo zs6R=}I?rAP@z$yQ=-ZQ5_6@D}no0$I&*4^0d=yVm`Xx~Yc=gkrI7^te+{`UT0sRaq?Z11#_m>Z3UXW?dP&J^ zZ!T?>)c$7|GG8p|yx7N0@ma`zHGV{7=&2Y!r8)%Q=U@a!(@bPoM_WbYM&!MgiKAq5 zD8S7%D$<{Np!eLB7)4jn%G!VKKAlMbI3k(TdXCwa4um(B-=l7ZebxM)T(Zu5 z&K}??BI8C;g$;MkkuakNS!WN&`Ys&P_r zg=cCXq3AMFs>dD<+pY(>GP(e%z~`?CP+1E8uKa?z6AQ>FV;VBHe%33lB+4-9uH?Sslw*ik@rv zJ>aUgb4w4IfTvXdOwI_4HQ*AB%zR9%_>DMChpfKaqwUv~W z4KFGepAT7T$X74WXv=XJe{{!PbAS1>ZS{(&#iv;T*OiGpI6wDHjrSSGKle-P%BS11 z0g)Eg66`a5dCB*VnSBvn$>lOZi3A=&(EOz!WXf)p|oCBLUb6(y0>uCs9l z(9G39O==RX?)QbowcGAA+)Db=@*nOuk?enPVP04_-B>hSSzKJ*Tv*;*$EIpL|3+Dp?b`gQK*OC(jA5X?KOH@_Wq77O* zvNG@IWM;BH$hm)?wMpJ9HY$;mdE)bR;?goQI0w5i=j+0@E=f9@)^9&vOazq|kuB_J z02Bf^IHVRx9&pK|HhihRAFLEdd3CNC0yR#K35i-`WDd`tR{daKFt#){Us?QiTC%P5PE}29e~Yq? zrp)eFH8BuHqSn=Un}WnMny}y?$!DzJe+MOmNV3q7hP6wyN`T*={C+F{+C()s67|XK zr&o}?ynJtee}ACCLtnDTZw7~=2fU=s4;;|9B8?fk@|Hi~(?d#N zeg}>147;V{4)Hz^P*5Gde@_E^+Ye*YzjylyKWSKy%{}6$9KS7XZeQ*Dk~lu@Rp8|8 zy~GA`>etqm*=-2P_|hwwo0~UY7z1d;Fx_2U?$|xE%d6UnO=nN3(erci!^1F;q`?f; pPZq!pmjAc^ocRC$&&AFato_u|%v#Ey9Bc@ad95f>{L1jd{{iKQtMUK< literal 0 HcmV?d00001 diff --git a/vignettes/tinytable_assets/idiwkunjr9bokgaaske8uh.png b/vignettes/tinytable_assets/idiwkunjr9bokgaaske8uh.png new file mode 100644 index 0000000000000000000000000000000000000000..760becf8f6582d980604e61d6417552b0089657b GIT binary patch literal 1917 zcmeAS@N?(olHy`uVBq!ia0y~yV1B{C!05}t3=~;nymb+f$`9}faRt&sLPAnfQrgFMd6ot@LBO`AD$=KT5d zSFBjEYSpUs>(}qzz5C$7gNF|vzJC4sg9i^DK79D}>C<=b-hKG+;p4}T-@bkO{rmU- z|NoO-7ky!1U_0sQ;uumf=j~8$Zfj;%E3*@6^uP!pF@aD<)v2qfipz@M1&5g+#`MhnYYUaeqE2rL|>W{{?ZOUv@YIUwmGFtM+gCuLaYDt#tqS$X_XP zTHbnLbBiDM!gS8LVov9UtaMxEsg^`>*m}R%B2YE$LZ;#uorRa3UPO*6Bqw$d({#>l@ZD;Z~ynZ{I8wodY*H4Wq-Z?^8KJJ?m`}C=})A@0df0pzr9}= z+|OQkxCXg8`B1WOzh^&_&9k$UTmSvj{a~~A_ktFCostJx$f__Z9X{?q?5dXdl)sZ{NOs_wL_g}w$ z{r>&?KM;JAyU4)6p5p1^7*a9k?cGE%X?MZaKz1c2zJnH=2M=Aaw+FiKD(3{D0+{Xc#C z`0vW^z8?>@*j0MHIRD}ByV;LgIct?lxHyO;N?QMYJp8zJul0jy&be!}zuaA$t6E~T z@VbE2%nR8ZbA4Wzw)m-ik#bTOuHs!dnR9R3g_A9D&M#7&)+>%G8x0UTrjU={fo046 zyZWb^Ip(&$FWaxduT&!TZ`W_vN`Zx&6~2f$r8~aRZ8_I;A(~?@>%#2Zv&kJjgxy_ul z>nrxigAAzo+>-n2DQD)NUoFM|zO>}m{rEdAGmq=<-*G>6NS2&b{#P zXv{mWUsekbckjG2^-HN!yLj6^0-K z-nA^O-(M{f@#_^Zm9>NH``zC9@2T+fFYoWN-*|ETF8hv)&u0t0`xVSxFcr1d!%`uB auy2Z8*z>1uF9)!eXYh3Ob6Mw<&;$UN0@4)# literal 0 HcmV?d00001 diff --git a/vignettes/tinytable_assets/idpf8ieywfpep7fblh2nxg.png b/vignettes/tinytable_assets/idpf8ieywfpep7fblh2nxg.png new file mode 100644 index 0000000000000000000000000000000000000000..e0b4c89b2480ffc2eba4418f43b1cd7be13a0a2e GIT binary patch literal 2676 zcmeAS@N?(olHy`uVBq!ia0y~yV1B{C!05}t3=~;nymb+fN)GS|aRt&kIyy#1M%LEW zc6N65_Vx}A4smgD@$vCVNl7UwDe39yxw*MBXU?28Yu5bv^Or4KwqnJK_3PJPxNzap zrArSVK797<*^3u1-o1PG{{8z8A3l8g^y%BTZ{NRv|MlzF@87@w|Nn1vJ2!@bf%A-~ zi(^Q|oVT~#C#9P6xLllKzIIyX&Pmt*g|F09>(O{6I#HqEJeQDuMf(5O@eFTI+A;9-Rz0}?-&pNRcd~JH(Yt{9p<**HwAx{zgs=g z4=5~X6?DQj!NSR%YbQI8`wI`n?+p(*WHq128OSVDZUrh;D+Po>c9iDsR2Y*r4U#)`w^MKc8RY{f=>J zOj zX5L}eQv8z4an}c^UEr5tOP<>I1}~1k5>DomfmXEC@hqG@(8erl`SUvfSh}eYau(>kI{-?wE|VzEpjJ7!I0m2ff?-SwE|TN zATRC}9W`V$Oa@yz(f+^Z$?q$FO+HQorRW2v%-^Lq-4+C;*s0}krl`|#XHc?EXua@J z0F>Y(6iaMeKv^M-LzW+`deAHRa`AVK{jS}S6RQt!Eqv_s{?6SsU=I~4I^B1Du|r_t zd!>??jtk|2R(dWkc5}#zD}9M=>EjmsrRQ|Km7`W1sHbIL_l3c({L9VXCHMdRnl-Ov z$Myfc7aGHVJ~Xv`S+M@U^g`zKPA?8HwD9pb;G*&+etGX(e`h}bj>ETG{~fI5YM8p6 z`!D-$e literal 0 HcmV?d00001 diff --git a/vignettes/tinytable_assets/idqm4203et4k7rt9d9hzyj.png b/vignettes/tinytable_assets/idqm4203et4k7rt9d9hzyj.png new file mode 100644 index 0000000000000000000000000000000000000000..2f1fb5257adafb30fa3b4d3885c6b79a24f16e8b GIT binary patch literal 2024 zcmeAS@N?(olHy`uVBq!ia0y~yV1B{C!05}t3=~;nymb+fN(=A_aRt(o;uJ zaPs8IGiT0RzI^%S&6|%OKYsc0<=eM!-@SYH{{8z8A3l8j`t{eZU;qFAf3d~l0RscO zt*47)NX4ADcQZHLIL6x=c(hZdf74u-Pc|9% znn0Ds zwfWDVg-7hWYa`oVEV?byf2Rp&;k(k8{dbEy?28JN3d!#V=t_%iAtQbIz553WkQh$Wg}-#j12v z5EORj>#D*Z<$nL3&be^@-wS^eAEwVdpQt-=L=&AhO)>%#e#bD=GD zY9;HGz8Eho7F{@>bM9)6VXXA&=5p10>DPaAw(xoGJHPI`Fo*0UjCulR1%e^*Kz@Gs zkMHaY5C8qAT(Sdy?Sr8iRxP1Qd?;G@e|t68hw^{llNQ$h>Gl6seb#XQHJRWoZT{cg mH6BL1IFNy(euEkGM}DKRTgKWK8EwESo59o7&t;ucLK6Tnns>+m literal 0 HcmV?d00001 diff --git a/vignettes/tinytable_assets/idruwrdfp1vfhcj5ks8dg1.png b/vignettes/tinytable_assets/idruwrdfp1vfhcj5ks8dg1.png new file mode 100644 index 0000000000000000000000000000000000000000..73baabf5efdbae0185fb425e2526b4c954993902 GIT binary patch literal 1656 zcmeAS@N?(olHy`uVBq!ia0y~yV1B{C!05}t3=~;nymb+fat-haaRt(%qN3K;)(#F1 zE-o&SigS#o;`aG9z1yC#*KUT?mc<(+zkc>)_0yRjv*Cu-d>KL6q+i~a`D@`3te4b{L8A^2;{Ub7aC+FNnbPAzu1>v+Ca}=|cD8fJh2=n{E-x;ByCtCXC3B=H|MKph{Ox*)do6O`Pk)ndGhcX|b1t_N zzp#~fi=0}C9*3>Zix`2b85edcd@)#9?D!(l>3P$I!!74n7q*Wo9D%`eZu759>v{Tr zr|$Ut-91jNWZqT&c=5OUKPnbJ{|)9(y}-Wk^O_brj=AZoUmRc9XfNb3-I?EkK}@Uh}ScFY@g7A`dn-~!bs N44$rjF6*2UngAUkmbL%@ literal 0 HcmV?d00001 diff --git a/vignettes/tinytable_assets/ids456uxws03qlzan7a5xl.png b/vignettes/tinytable_assets/ids456uxws03qlzan7a5xl.png new file mode 100644 index 0000000000000000000000000000000000000000..eeec9ad354ff506f0baf1e073757c896861f9d82 GIT binary patch literal 2936 zcmeAS@N?(olHy`uVBq!ia0y~yV1B{C!05}t3=~;nymb+fat-haaRt&kIy$<#x_Wwg z_V)G;4h}9ZE@^3LMMXvP=g(iUV#TUetJbeyziHE^vuDq~diCnfn>X*?y?g)u{f7@9 zzI^%e@87@w|Np-fKGw>>!1d14#WAE}&fCl3eX8yv&Ic!!E9ZaPAM)_uXGUI+CkvJ< ziA^|>^z`Qk{tq{Qe^{x{@P$)W&f&!e2B&s*0V|t^3lAAv`1ln{Di{_XX667%1$@8$ z-nM?vOE#zWZTsy_YHLo5w(#ZNy-*Kf;M9jzXYoSVq<_t+dJ{E>gKNXdEx%T zv9u6q=U)!n6?%GK3>V5TWWRc})lTh;@|OjphKz>EXgV3qJEKLxXz@5&WsFv%qpbpB zT1q#nIsYbqop=9R&F9pQAJ*^FlZ%V})BWh^eyw?bOFw_m->)eb_jj)R|Lqt4|NOi6 z*W0=C?%M8od3W8XJpF&qXA9Luzc{d44XG81(V7G|Q2%fz9N(q&t;yvcunEoJ>FVdQ I&MBb@0Dh%>hyVZp literal 0 HcmV?d00001 diff --git a/vignettes/tinytable_assets/idtik5javjkduihvbp61cr.png b/vignettes/tinytable_assets/idtik5javjkduihvbp61cr.png new file mode 100644 index 0000000000000000000000000000000000000000..e9a59f3d7ea102b476057aace39a4927ead8c874 GIT binary patch literal 1150 zcmeAS@N?(olHy`uVBq!ia0y~yV1B{C!05}t3=~;nymb+fQVH-0aRt&VR;*aLa^?E< z>o;uJaR2`OckkZ4fB*i&hYz1WfBy32%m4rX`=|6hVPIep^>lFzshIQj3U}Ti2Ofum zQ~aYI{QLfvalxfkw=^c07cx&QdICbMNlw{!p zrFZY%STAT*v#tBW!ykT5?T>{KP9)hhZ2lZI1T*eO!(=drNkiqr`QPJMf1FN@deJXh p;cxHE+26`nV}d;&L*nv*_?ouTvn=zwbb$p4gQu&X%Q~loCICn{UZem3 literal 0 HcmV?d00001 diff --git a/vignettes/tinytable_assets/iduaergfij55nl3egazed4.png b/vignettes/tinytable_assets/iduaergfij55nl3egazed4.png new file mode 100644 index 0000000000000000000000000000000000000000..4e1ff0a72c3081fd6daa5eed5888dce5ffbea85b GIT binary patch literal 2214 zcmeAS@N?(olHy`uVBq!ia0y~yV1B{C!05}t3=~;nymb+fatiPXaRt&wMn(<}4vC40 z>FMbm9UUuHtXR2n<@)vOH*DCjd-v`=d-fbSaNyXnV>fQxxOeZ~{rmUdy?giJ!-tO_ zKmPpr^Z)<(MX%kv!j8ZAa6i=2!PUfbf`jl( zv5=3CYkx{t+?)P}pW&Ram5D-0hQo^s4Hp(NE_7ygYG-TVW*60kD)Q1PO^?(dR+ zr|K;4eJXpgzxL;vf0O@~?0Ne3LjBoyr86&Zs(zW(;-|6jx=M)?=U%mi!d@>-Ip+pA zt@nJyqrDXZe{!?^K_3FM^4?Fvv7O4;IG=7vyH!e z({tLdUtQdG@1E<6@2UCcF5KSD@ps>wvyxTS;tTIj-)rfd|6b|KZ=lW>Z)02P;=euP z*}J#83kMqYG^fa{JyU%EwOsisy*&=F7Iue`MXe0{y^3A^>qvu^DZblybw?* z;SjK5;gDr&;bU}aXISXma6$3Gt_%15KGuB*JF!da%k$Hgas6@Jf#I$HJ}Po`;-CumEv9?-$T)CvG#ZK62HAk&lNtoa-pBHPCzRbK3>H5NW z;pVOj=}zgQ3(vQl({h^6IX9Gs3U}P?U;KJ+!A&0nH9WE&_>h_m21%=i_Zze@wq$&i(gs@9e*}&(F*+J~wAe r+wHyaQ$Lh0Wd3goE(~z^{(
Wald