2017-05-09 105 views
0

我正在使用.Rmd文檔並將其呈現給html_document。我的表的前綴是「表」,但是,我想用我的第一語言。作爲pdf_document,我想我的報告的語言設置爲葡萄牙語,像這樣:如何通過r markdown在html文檔中設置語言html

--- 
title: "Code" 
author: "Guilherme" 
date: "May 9, 2017" 
lang: "pt-br" 
output: 
    html_document: default 
--- 

有沒有辦法做到這一點?

+0

如何添加表格前綴?你的YAML前端事件不會產生任何結果。 – scoa

+0

如果您使用bookdown獲取您的表格/圖表參考,則國際化顯示在此頁面上:https://bookdown.org/yihui/bookdown/internationalization.html –

+0

Hy @scoa,我使用此命令'options(table_counter = TRUE,width = 10000)'在我的報告中,哪個表是哪個表。我用來生成表格的命令是'htmlTable(...,caption =「描述性測量...」)。它創建了標題:表1:....的描述性測量 –

回答

0

對於htmlTable軟件包,無法執行此操作,因爲「Table no」位已硬編碼到此軟件包中(請參閱source code)。

如果您需要本地化,那麼您需要使用另一種方式來製作字幕。另一種方法是captioner package

```{r} 
library(htmlTable) 
library(captioner) 

table_nums <- captioner(prefix = "Tabela") # from google translate :) 

htmlTable(table(iris$Species,iris$Species), 
      caption = table_nums("desc_iris", "Descriptive Measuraments of...")) 
``` 
相關問題