Last active
March 23, 2016 12:03
-
-
Save kazutan/2923d174d5b7a72a95bb to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| --- | |
| title: "rmarkdown v0.9.5のテスト" | |
| author: "kazutan" | |
| date: "2016年3月23日" | |
| output: | |
| html_document: | |
| theme: "yeti" | |
| code_folding: hide | |
| toc: true | |
| toc_float: true | |
| md_extensions: -ascii_identifiers | |
| --- | |
| ```{r setup, include=FALSE} | |
| knitr::opts_chunk$set(echo = TRUE) | |
| ``` | |
| このファイルのコードは[このgist](https://gist.github.com/kazutan/2923d174d5b7a72a95bb)にあります。 | |
| ## Rコードブロックをhide | |
| yamlのところに以下を指定することで、コードブロックが隠れます(表示もできます): | |
| ``` | |
| --- | |
| output: | |
| html_document: | |
| code_folding: hide | |
| --- | |
| ``` | |
| このドキュメントでは`hide`を指定します。この場合、ページ先頭の右にリストボタンが表示され、また各出力の右上にもボタンが表示されるようになります。これを切替(orクリック)すると表示/非表示を切り換えることができます。 | |
| ## table of contentsを浮かせる(常に表示) | |
| yamlのところに以下を指定することで、コンテンツ一覧表が浮いて表示されるようになります: | |
| ``` | |
| --- | |
| output: | |
| html_document: | |
| toc: true | |
| toc_float: true | |
| --- | |
| ``` | |
| `toc`は"table of contents"の略称で、コンテンツ一覧表を表示させるかどうかを指定します。これ自体は以前からありましたが、これに加えて`toc_float: true`と指定することで、このページのようにいつでも表示されるようになります。 | |
| 見出しの深さ(どこまで掘り下げるか)を指定したい時は、`toc_depth`で調整してください。 | |
| ## タブセクション {.tabset} | |
| タブセクションを簡単に作ることができるようになりました。ドキュメント内に、以下のようにするとタブセクションが作成できます: | |
| ``` | |
| ## タブセクションのタイトル見出し {.tabset} | |
| (タブ前の内容) | |
| ### タブその1 | |
| (タブその1の内容) | |
| ### タブその2 | |
| (タブその2の内容) | |
| ``` | |
| たとえば、以下のようにするとタブ機能が実装されます(行頭の`\`は無視してください): | |
| ``` | |
| \## タブセクション {.tabset} | |
| \### たぶ1 | |
| \```{r} | |
| library(ggplot2) | |
| ggplot(iris, aes(x=Sepal.Length, y=Sepal.Width, color=Species)) + | |
| geom_point() | |
| \``` | |
| \### たぶ2 | |
| \```{r} | |
| ggplot(iris, aes(x=Petal.Length, y=Petal.Width, color=Species)) + | |
| geom_point() | |
| \``` | |
| ``` | |
| 実行結果はもうちょっと下のところにおいています。 | |
| <div class="panel panel-warning"> | |
| <div class="panel-heading">注意事項</div> | |
| <div class="panel-body"> | |
| タブ見出しを日本語のみ(非asciiのみ)にしたものが複数ある場合、そのままだと崩れます。これを回避するにはyamlの部分で以下のように`md_extensions: -ascii_identifiers`を指定してください(説明は[こちら](http://gihyo.jp/admin/serial/01/r-markdown/0004)): | |
| ``` | |
| --- | |
| output: | |
| html_document: | |
| md_extensions: -ascii_identifiers | |
| --- | |
| ``` | |
| </div> | |
| </div> | |
| ### たぶ1 | |
| ```{r} | |
| library(ggplot2) | |
| ggplot(iris, aes(x=Sepal.Length, y=Sepal.Width, color=Species)) + | |
| geom_point() | |
| ``` | |
| ### たぶ2 | |
| ```{r} | |
| ggplot(iris, aes(x=Petal.Length, y=Petal.Width, color=Species)) + | |
| geom_point() | |
| ``` | |
| ## その他の追加機能について | |
| ### 出力フォーマット追加 | |
| 新たにOpenDocumentやRTF、GitHubのフォーマットに対応しました。[公式サイト](http://rmarkdown.rstudio.com/)の`Formats`から探してみてください。 | |
| ### テーマの追加 | |
| 新たに“lumen”、“paper”、“sandstone”、“simplex”、“yeti”のテーマが追加されました。Rmarkdownにテーマを設定する方法については[こちら](http://qiita.com/kazutan/items/cd8ff3d26119e8541a35)をご覧ください。なおこの記事は"yeti"を使用しています。 | |
| ### バグ修正 | |
| 色々修正されています。詳しくは[NEWS](https://cran.r-project.org/web/packages/rmarkdown/NEWS)などをご覧ください。 | |
| ### その他(未検証) | |
| - モバイルブラウザ向けにデフォルトHTMLテンプレートに修正が加えられています | |
| - 組み込まれているJQueryが`v1.11.3`になり、Bootstrapが`v3.3.5`になりました | |
| - マルチページの`html_document`で、bootstrapのnavbarが組み込めるようになったそうです | |
| - `html_document`フォーマットに`abstract`フィールドがサポートされたそうです | |
| ### さらなる情報について | |
| さらなる詳細については[RStudio Blogの該当記事](http://blog.rstudio.org/2016/03/21/rmarkdown-v0-9-5/)もしくは[NEWS](https://cran.r-project.org/web/packages/rmarkdown/NEWS)などをご覧ください。 | |
| Enjoy! |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment