当RStudio中的ioslides为type = HTML时,调整stargarzer表的大小 [英] Resize stargarzer table when type=HTML for ioslides in RStudio

查看:72
本文介绍了当RStudio中的ioslides为type = HTML时,调整stargarzer表的大小的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我不熟悉使用R Markdown在RStudio中创建幻灯片演示文稿.我无法在网上找到任何能解决我的特定问题的东西.这是关闭,但是我遇到了相反的问题,即我想缩小HTML观景台的输出以适合单个幻灯片.这个问题基本相同,但尚无答案.有任何想法吗?这是我的降价代码的风格化示例:

I am new to using R Markdown to create slides presentations within RStudio. I haven't been able to find anything online that addresses my specific question. This was close, but I'm having the opposite problem, i.e. I am tyring to shrink HTML stargazer output to fit on a single slide. This question is basically the same but no answers yet. Any ideas? Here is a stylized example of my markdown code:

---
title: "test"
author: "Scott Murff"
date: "September 4, 2015"
output: ioslides_presentation
---

## Slide with R Code and Output

```{r, echo=FALSE, results='asis', eval=TRUE, warning=FALSE, message=FALSE}
library(stargazer)
data<-data.frame(y=rnorm(30),x1=rnorm(30), x2=rnorm(30), x3=rnorm(30), x4=rnorm(30))
fit1<-lm(y~x1,data)
fit2<-lm(y~x2,data)
fit3<-lm(y~x3,data)
fit4<-lm(y~x4,data)


stargazer(fit1, fit2, fit3, fit4, type='html')
```

推荐答案

在您的上下文中,我还没有找到直接通过stargazer选项的方法,但是这是通过幻灯片参数解决的方法:

In your context, I haven't find a direct way through the stargazer options yet, however here's a work around through the slide parameters :

  1. ,您可以通过直接在标题中添加{.smaller}来启用smaller选项:

## your slide title {.smaller}

来源: http://rmarkdown.rstudio.com/ioslides_presentation_format.html#visual-外观

您还可以通过添加.flexbox.vcenter来居中:

you can also center it by adding .flexbox and .vcenter :

## your slide title {.smaller .flexbox .vcenter}

来源: http://rmarkdown.rstudio.com/ioslides_presentation_format.html#advanced-布局

但是,您无法完全控制大小.

However you don't have a full control of the size.

在YAML中添加:

---
output:
  ioslides_presentation:
    css: styles.css
---

然后在styles.css文件(您应该将其放置在演示文稿文件夹中)中,可以放置:

then in the styles.css file (that you should place in your presentation folder), you can put :

.reduced{
   font-size: 0.8em;
}

然后将其发送回标题幻灯片的属性中,就很好了:

and send it back in the attribute of your title slide, and you're good :

## your slide title {.reduced}

source: http://rmarkdown.rstudio.com/ioslides_presentation_format.html#visual-外观在自定义CSS段落中

source : http://rmarkdown.rstudio.com/ioslides_presentation_format.html#visual-appearance in the custom css paragraph

您最终的html输出仍然是独立的,并且使用css文件,您可以管理更多的自定义.

Your final html output is still self-contained and with the css file you can manage even more customization.

之后,如果您想使用 查看全文

登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆