小编sco*_*coa的帖子

如何使用pander向表添加网格?

我正在使用R,knitr和pander,我找不到允许我在带有pander的桌子上打印网格的选项.我试过了 :

pander(tableToPrint, style='grid') 
Run Code Online (Sandbox Code Playgroud)

但它没有做任何事情,无论是使用此选项还是使用'multiline','rmarkdown'......我总是得到一条水平线,然后是列名,另一条水平线,我的所有数据和一条水平线.我想在每一行之间有一条水平线.另一种选择是交替行颜色.

latex r pandoc knitr r-markdown

4
推荐指数
1
解决办法
944
查看次数

无法使用自定义样式编织为pdf

尝试使用自定义mystyles.sty文件从RStudio编织为pdf.这曾经工作正常,但现在我已升级到RStudio 1.044我得到一个错误.

例:

---
title: "Test"
output:
  pdf_document:
    includes:
      in_header: mystyles.sty
---



## R Markdown

This is an R Markdown document. Markdown is a simple formatting syntax for             authoring HTML, PDF, and MS Word documents. For more details on using R Markdown     see <http://rmarkdown.rstudio.com>.

When you click the **Knit** button a document will be generated that includes both content as well as the output of any embedded R code chunks within the document. You can embed an R code chunk …
Run Code Online (Sandbox Code Playgroud)

latex pandoc rstudio r-markdown

4
推荐指数
1
解决办法
453
查看次数

RMarkdown ztable的pdf_output | xtable | HTMLTABLE

我使用ztable,xtable或htmlTable包成功生成表,没有任何问题.但是,我想知道这些表是否可以作为pdf文档输出.当我尝试编织pdf_output时,不会显示该表.相反,信息显示为多个字符串.我试过改变乳胶引擎(使用ztable)和其他方法没有运气.

我看过这里:http:
//www.mzan.com/article/29773068-rmarkdown-latex-table-output-difficulties.shtml

我也看过小插曲等

示例(RMarkdown):

---  
output: pdf_document
---

```{r, message = F, results = 'asis'} 
# will throw out Error: pandoc document conversion failed with error 43
library(ztable)
data(iris)
options(ztable.type="latex") 
zt <- ztable(iris[1:5,], caption = "ztable")
zt <- addcgroup(zt,
                cgroup = c("group 1", "group 2"),
                n.cgroup = c(2,3))
print(zt)
```  

```{r, message = F }
# since it's html, will produce text only
library(htmlTable)
data(mtcars)
colnames(mtcars) <- NULL
htmlTable(mtcars[1:5,], caption = "htmlTable",
          cgroup = c("group 1", "group …
Run Code Online (Sandbox Code Playgroud)

r r-markdown

2
推荐指数
1
解决办法
846
查看次数

stat_smooth - 可变长度不同

我想使用 ggplot 将两个变量相互绘制。稍后我想使用非线性拟合,但我遇到了一个我不完全理解的错误消息的问题。我可以看到其他人也有类似的问题,但我可能不够聪明,无法理解答案

我有一个包含 4 个变量的数据集 ost。数据集中没有NA。

使用 ggplot2 我想用回归线绘制数据。为简单起见,我从简单的线性回归开始

library(ggplot2)

qt_int <- c(404, 402, 426, 392, 418, 410)
rr <- c(1000, 958, 982, 752, 824, 844)
gender <- c('male','female','female','female','female','female')
deltnr <- c(10445, 1022, 9122, 60, 246, 306)
df = data.frame(deltnr, gender, qt_int, rr)   

p <- ggplot(df, aes(rr, qt_int))
p <- p + geom_point (size = 2)
p <- p + stat_smooth(method = "lm", formula = qt_int ~ rr)
p
Run Code Online (Sandbox Code Playgroud)

我收到以下警告消息:

警告消息:1:'newdata' 有 80 行,但发现的变量有 6702 行 2:计算失败stat_smooth():arguter …

r ggplot2

2
推荐指数
1
解决办法
3549
查看次数

Pandoc LaTex PDF 标题和页脚

我正在使用 pandoc v 1.18 我想添加页眉和页脚文本。

我想要完全控制意味着我想将加热器文本放置在左侧、中间和中间,并且与页脚相同。

但我连一个地方都找不到。

我的降价文件中的 YAML 标头中有以下内容

---
header: This is fancy
footer: So is this
headertext: This is fancy
footertext: So is this
#abstract: This is a pandoc test . . .

documentclass: report
output:
  pdf_document:
    fontsize: 12pt
    mainfont: Roboto
    geometry: [top=2cm, bottom=1.5cm, left=1cm, right=1cm]
css : pandoc.css
linkcolor : cyan
toc : true
---
Run Code Online (Sandbox Code Playgroud)

我也尝试过单独使用header和headertext,但效果不佳。

markdown latex pdf-generation pdflatex pandoc

2
推荐指数
1
解决办法
3059
查看次数

仅在 ioslides RStudio 的第一张(主)幻灯片上添加徽标

我在 RStudio 中使用 ioslides (rmarkdwon) 从 R 创建演示文稿。我想添加徽标,但仅添加到呈现此信息的第一张幻灯片(主):

---
title: "Presentation"
author: "Tom Hanks"
output: ioslides_presentation
logo: logo.jpg
---
Run Code Online (Sandbox Code Playgroud)

我不希望每张幻灯片的左下角都有徽标。谁能告诉我怎么关掉?

r pandoc knitr r-markdown

1
推荐指数
1
解决办法
1832
查看次数

如何在R markdown投影仪中打印较长的书目(超过一页)?

我有一个问题,导致书目覆盖多个页面,因为只有第一个使用RMarkdown和Beamer输出打印。

相同的问题已发布在http://rmarkdown.rstudio.com/authoring_bibliographies_and_citations.html#comment-2398115545,但没有任何帮助。

---
title: "Sample Document"
output: beamer_presentation
bibliography: bibliography.bib
---
Run Code Online (Sandbox Code Playgroud)

r beamer bibliography pandoc r-markdown

1
推荐指数
1
解决办法
1262
查看次数

删除Markdown默认代码

在RStudio中,每当我创建一个新的Markdown时,它总是有默认代码.我该如何删除它?

这是显示的代码.

```{r setup, include=FALSE}
knitr::opts_chunk$set(echo = TRUE)
```

## R Markdown

This is an R Markdown document. Markdown is a simple formatting syntax for authoring HTML, PDF, and MS Word documents. For more details on using R Markdown see <http://rmarkdown.rstudio.com>.

When you click the **Knit** button a document will be generated that includes both content as well as the output of any embedded R code chunks within the document. You can embed an R code chunk like this:

```{r …
Run Code Online (Sandbox Code Playgroud)

r rstudio r-markdown

1
推荐指数
1
解决办法
858
查看次数

幻灯片的文字太多:如何变小

我试图用 Rmarkdown 做一个非常简单的演示,不涉及任何块。我想要很多文字,所以没有打印出来,因为它们是禁区。

是不是有一个选项,beamer 会设置文本的大小,以便所有文本都可见,或者至少是一种手动缩小文本的快速方法?

beamer r-markdown

1
推荐指数
1
解决办法
1139
查看次数

将多个具有大量NA的列组合到R中的一个因子列中

我有一个带有观察结果的.csv导入表.

ED1 ED2 ED3 ED4 ED5 
1   NA  NA  NA  NA 
NA  NA  1   NA  NA 
NA  1   NA  NA  NA 
NA  NA  NA  NA  1 
Run Code Online (Sandbox Code Playgroud)

<-----等------>

因此每行只包含一个值"1",一行中的其他列包含NA.我需要将这五列合并为一个因子列.

喜欢:

EDU

2

3

3

1

2

1

或者这可能是因子列"ED1","ED2","ED3"等因素(作为源列的名称).

csv r

0
推荐指数
1
解决办法
257
查看次数

在ggplot2中的x轴上分组

在ggplot中,我想在x轴上创建子类别,如下所示:

在此处输入图片说明

Multirow轴标签中带有嵌套分组变量的解决方案 不起作用。

charts r ggplot2 axis-labels

-2
推荐指数
1
解决办法
2692
查看次数