Simple question:
I have an Rmarkdown
script where I generate tables and figures:
---
title: "test"
output: html_document
---
```{r setup, include=FALSE}
knitr::opts_chunk$set(echo = TRUE)
```
```{r libraries}
library(knitr)
library(kableExtra)
library(ggplot2)
```
# Table
```{r print.table,warning=FALSE,message=FALSE}
df <- data.frame(id=LETTERS,value=1:26)
knitr::kable(df) %>% kable_styling()
```
# Figure
```{r print.params.table,warning=FALSE,message=FALSE}
ggplot(data=df,aes(x=id,y=value))+geom_point()
```
My question is if there's a way to be able to save the tables and figures to files (e.g., csv and pdf, respectively) from the html report?
What I mean by that is suppose I'm sending this html report to a collaborator and he want to have a separate copy of the tables and figures without having to write any line of code. Does Rmarkdown or knitr enable that in the html report in a form of a button or do I have to programmatically save these to files?
If you add keep_md
option then image files are kept in your directory (like in "xxx_file" folder), which you can send to your colleague. But I don't think there is an option for tables.
---
title: "test"
output:
html_document:
keep_md: true
---
```{r setup, include=FALSE}
knitr::opts_chunk$set(echo = TRUE)
```
```{r libraries}
library(knitr)
library(kableExtra)
library(ggplot2)
```
# Table
```{r print.table,warning=FALSE,message=FALSE}
df <- data.frame(id=LETTERS,value=1:26)
knitr::kable(df) %>% kable_styling()
```
# Figure
```{r print.params.table,warning=FALSE,message=FALSE}
ggplot(data=df,aes(x=id,y=value))+geom_point()
```
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With