2016-07-24 6 views
1

私はR Markdownを使用していますが、テーブルを生成してワードドキュメントに配置しようとしています。ことができるように代わり​​の:下記の私は、コードのこの部分を実行すると、テーブル名はので、私は\ @ref(表-つのタブ)を取得解決することはありませんテストRMarkdown、MS Wordのセンターテーブルと参照テーブル

Table \@ref(tab:table-single) is a simple example. 

```{r table-single, tidy=FALSE} 
knitr::kable(
    head(mtcars, 10), booktabs = TRUE, 
    caption = 'A table of the first 10 rows of the mtcars data.' 
) 
``` 

としてgithubから取られているコードがあります見て、最終的なdocument

    私のコードで私はMS Wordの

    に編んでいます

私の表を参照の関係でミスを犯している

  • 誰かが見ることができますあなたはマークダウンをレンダリングするbookdownパッケージを使用する場合は、適切な相互参照を取得します

    おかげ

  • +0

    一度に一つの質問を投稿してください。その方法を参照している –

    +0

    はラテックス出力の場合にのみ機能します。他の出力についてはhttps://github.com/lierdakil/pandoc-crossrefを試すことができます。 – scoa

    答えて

    1

    --- 
    output: bookdown::word_document2 
    --- 
    
    Table \@ref(tab:table-single) is a simple example. 
    
    ```{r table-single, tidy=FALSE} 
    knitr::kable(
        head(mtcars, 10), booktabs = TRUE, 
        caption = 'A table of the first 10 rows of the mtcars data.' 
    ) 
    ``` 
    

    enter image description here