-
Notifications
You must be signed in to change notification settings - Fork 2
/
formatting.Rmd
50 lines (40 loc) · 1.15 KB
/
formatting.Rmd
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
---
date: "`r Sys.Date()`"
author: "Author"
title: "Title"
output:
officedown::rdocx_document:
mapstyles:
Normal: ['First Paragraph']
---
```{r setup, include=FALSE}
knitr::opts_chunk$set(echo = TRUE, fig.cap = TRUE, tab.cap = TRUE)
library(officedown)
library(officer)
library(flextable)
library(dplyr)
```
# Paragraph
```{r echo=FALSE}
italic <- shortcuts$fp_italic(font.size = 11)
italic_blue <- update(italic, color = "blue")
```
```{r, echo=FALSE}
fpar(
ftext("Lorem ipsum dolor sit amet, consectetur adipiscing elit. ", italic_blue),
ftext("Lorem ipsum dolor sit amet, consectetur adipiscing elit. "),
ftext("Lorem ipsum dolor sit amet, consectetur adipiscing elit. ", italic)
)
```
Lorem ipsum dolor sit amet, consectetur adipiscing elit.
# Table
```{r, echo=FALSE, tab.cap="Head of diamonds dataset", tab.id="diamonds"}
dat <- head(ggplot2::diamonds, n = 10)
qflextable(dat) %>%
color(~ price < 330, ~ price + x + y + z, color = "orange") %>%
color(~ carat > .24, ~ cut, color = "red") %>%
compose(
j = "clarity",
value = as_paragraph(as_chunk(clarity, props = fp_text_default(color = "blue", italic = TRUE)))
)
```