Last active
January 24, 2018 19:22
-
-
Save daroczig/84d44ea5d944da6e4c44e1d1c6cba784 to your computer and use it in GitHub Desktop.
Multiple regression models in a markdown table with memisc and pander
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
m1 <- lm(mpg ~ hp, data = mtcars) | |
m2 <- lm(mpg ~ hp + drat, data = mtcars) | |
m3 <- lm(mpg ~ hp + drat + factor(gear), data = mtcars) | |
library(pander); library(memisc) | |
panderOptions('table.alignment.rownames', 'left') | |
pander(relabel( | |
mtable(m1, m2, m3, | |
summary.stats=c('N', 'R-squared', 'F')), | |
'(Intercept)' = 'Constant', | |
'hp' = 'Gross horsepower', | |
'factor(gear): 4/3' = 'Four forward gears', | |
'factor(gear): 5/3' = 'Five forward gears', | |
'N' = 'Observations')) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
------------------------------------------------------------------ | |
m1 m2 m3 | |
------------------------ ------------- ------------- ------------- | |
**Constant** 30.099***\ 10.790*\ 16.306*\ | |
(1.634) (5.078) (6.429) | |
**Gross horsepower** -0.068***\ -0.052***\ -0.064***\ | |
(0.010) (0.009) (0.011) | |
**drat** \ 4.698***\ 3.510\ | |
(1.192) (1.851) | |
**Four forward gears** \ \ -0.276\ | |
(2.135) | |
**Five forward gears** \ \ 3.761\ | |
(2.161) | |
**Observations** 32 32 32 | |
**R-squared** 0.6 0.7 0.8 | |
**F** 45.5 41.5 24.2 | |
------------------------------------------------------------------ |
"the most recent version of the pander package dropped support for mtable but there are plans to re-integrate it at Rapporter/pander#304"
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
any idea what the error means?