我尝试使用功能kable()的 “ markdown”格式创建表,但是列之间的间隔太宽,以至于该表在页面上延伸。无论如何,是否有必要调整单元格的大小,以使Markdown格式的表格不会在页面上延伸?它以乳胶格式保留在页面中,但是我既不需要这种格式,也不需要html。我希望输出文件为.pdf。我知道在这里也曾提出过类似的问题,但我的问题仅针对格式降价。如果您觉得这是重复的,请合并问题。
可重现的示例:
---
title: "Example"
author: "JAQuent"
date: "7 Juni 2017"
output: pdf_document
---
\tiny
```{r results='asis', echo = FALSE, warning = FALSE}
library(knitr)
table1 <- data.frame(Factor1 = c('level 1', 'level 1', 'level 2', 'level 2'),
Factor2 = c('level 1', 'level 2', 'level 1', 'level 2'),
Parameter1 = sample(1000000:9999999, 2),
Parameter2 = sample(1000000:9999999, 2),
Parameter3 = sample(1000000:9999999, 2),
Parameter4 = sample(1000000:9999999, 2),
Parameter5 = sample(1000000:9999999, 2),
Parameter6 = sample(1000000:9999999, …Run Code Online (Sandbox Code Playgroud) Is it possible to include a Greek letter in the title of R markdown document?
I tried this:
---
title: "?-Amylase"
author: "author"
date: "8 March 2017"
output:
pdf_document:
keep_tex: true
toc: yes
toc_depth: 6
---
Run Code Online (Sandbox Code Playgroud)
And this:
---
title: "$\alpha$-Amylase"
author: "author"
date: "8 March 2017"
output:
pdf_document:
keep_tex: true
toc: yes
toc_depth: 6
---
Run Code Online (Sandbox Code Playgroud) 当我使用R Markdown为投影仪演示文稿创建幻灯片时,文本垂直居中,如果您只想使用1-2行幻灯片,则该文本看起来确实很奇怪。无论如何,是否可以将文本与幻灯片的顶部对齐(在幻灯片标题下方)?
寻找答案,我找到了这篇文章,并试图在R Markdown中使用它,但是没有任何尝试。
您可以使用以下命令来更改水平文本对齐方式和字体大小,例如
\begin{flushright}
\begin{tiny}
bla..
\end{tiny}
\end{flushright}
Run Code Online (Sandbox Code Playgroud)
垂直文本对齐是否有类似的东西?到目前为止,我已经尝试过了:
尝试1:
---
title: "Untitled"
author: "Author"
date: "25 Januar 2017"
output: beamer_presentation
---
\documentclass[t]{beamer}
## Caption 1
test
Run Code Online (Sandbox Code Playgroud)
尝试2:
---
title: "Untitled"
author: "Author"
date: "25 Januar 2017"
output: beamer_presentation
---
## Caption 1
\begin{frame}[t]
test
\end{frame}
Run Code Online (Sandbox Code Playgroud)
尝试3:
---
title: "Untitled"
author: "Author"
date: "25 Januar 2017"
output: beamer_presentation
---
## Caption 1
\begin{flushleft}[t]
test
\end{flushleft}
Run Code Online (Sandbox Code Playgroud) 我想提取字符串中两侧有两个标记/模式的所有数字。然而,R 中的正则表达式是我的祸根。
我有这样的事情:
string <- "<img src='images/stimuli/32.png' style='width:341.38790035587186px;height: 265px;'><img src='images/stimuli/36.png' style='width:341.38790035587186px;height: 265px;'>"
marker1 <- "images/stimuli/"
marker2 <- ".png"
Run Code Online (Sandbox Code Playgroud)
想要这样的东西
gsub(paste0(".*", marker1, "*(.*?) *", marker2, ".*"), "\\1", string)
[1] "32" "36"
Run Code Online (Sandbox Code Playgroud)
不过我得到这个:
[1] "32"
Run Code Online (Sandbox Code Playgroud)
PS 如果有人有一个很好的指南来理解正则表达式如何在这里工作,请告诉我。我很确定答案很简单,但我只是不明白正则表达式:(