问题描述
是否可以使用omit
选项忽略观星者中的互动?通常,我会将变量名写入omit=c('varname')
中,但是在交互的情况下,我不知道该写什么.有什么暗示吗?您如何在xtable
之类的其他程序包中解决此问题?
Is it possible to omit interactions in stargazer using the omit
option?Normally I would write the variable name into the omit=c('varname')
but in the case of an interaction I do not know what to write. Any hints on that?How do you solve this problem in other packages like xtable
?
\documentclass{article}
\begin{document}
%Load dataset and run regression
<< lm, echo=FALSE >>=
load('dataset.RData')
library(stargazer)
lm1 <- lm(y~ x + factor(v)*z ,data=dataset)
@
<< table_texstyle, echo=FALSE, comment=NA, results='asis' >>=
stargazer(lm1 ,omit=c('???'), omit.labels=c('Omitted interactions'),
omit.yes.no = c("Yes", "No")))
@
\end{document}
推荐答案
如果要忽略所有交互,请尝试
If you want to omit all interactions, try
stargazer(m1, omit = ":")
之所以有效,是因为omit
参数需要正则表达式.这是过滤字符串时非常强大的工具.请参阅?regexpr
或在Stackoverflow上浏览regex
选项卡.
This works because omit
argument is expecting a regular expression. This is a very powerful tool when filtering strings. See ?regexpr
or browse the regex
tab here on Stackoverflow.
这篇关于如何忽略使用stargazer或xtable的交互?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!