简体   繁体   English

观星笔记根本没有出现

[英]stargazer notes not appearing at all

library(stargazer)

I'm trying to use the notes argument with stargazer, but its apparently not working. 我正在尝试在stargazer中使用notes参数,但是它显然不起作用。 Here's code adapted from a previous stack overflow stargazer question: 下面的代码改编自先前的堆栈溢出观星者问题:

stargazer(mtcars, notes=c("A very very long note that I would like to put below the table,",
                     "but currently runs off the side of the page",
                     "when I compile my document.",
                     "How do I get this to wrap into paragraph form?"))

When I compile my document, the note does not appear at all. 当我编译文档时,该注释根本没有出现。

You need to change the note's multicolumn alignment (I guess the default is l ) to p{\\linewidth} . 您需要将笔记的多列对齐方式更改为p{\\linewidth} (我想默认为l )。 This isn't an option (only clr ), but you can do the following. 这不是一个选项(仅clr ),但是您可以执行以下操作。

  • use gsub to replace the {l} with {p{\\linewidth}} 使用gsub{l}替换为{l} {p{\\linewidth}}
  • undo the side effects of gsub with cat(, sep="\\n") cat(, sep="\\n")撤销gsub副作用

The following works for me. 以下对我有用。

cat(gsub("\\{l\\}", "{p{\\\\linewidth}}", stargazer(mtcars, notes="A very very long note that I would like to put below the table, but currently runs off the side of the page when I compile my document. How do I get this to wrap into paragraph form?")), sep="\n")

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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