VSCode上での「R Markdown」
1. VSCodeで「R Markdown」ドキュメント作成環境の構築
1-1. Rのインスト―ル
- Download R-4.2.1 for Windows からダウンロード後インストールします。

1-2. pandoc をインストール
Visual Studio を閉じます。
pandoc.org の pandoc をインストールします。
1-3. パッケージのインストール
- knitr および rmarkdown パッケージをインストールします。
- Rでインストールします。
install.packages("knitr")
install.packages("rmarkdown")

1-4. VSCodeの拡張機能をインストールします。
- [R Tool]と[R]をインストールします。

2. RMDファイル作成とプレビュー
---
title: "R ドキュメントの作成"
output: html_document
---
This is an R Markdown document. Markdown is a simple formatting syntax for authoring HTML, PDF, and Microsoft Word documents. For more details on using R Markdown see <http://rmarkdown.rstudio.com>.
When you select the **R Tools | Publish | Preview** 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}
summary(cars)
```
You can also embed plots, for example:
```{r, echo=FALSE}
plot(cars)
```
Note that the `echo = FALSE` parameter was added to the code chunk to prevent printing of the R code that generated the plot.
- VSCode上でのプレビュー

以上