2
我正在嘗試使用表格和Hmisc包創建LaTeX表格,但我無法使標題顯示。當使用Hmisc LaTeX功能編織時,標題不出現在LaTeX表格中
這裏是一個重複的例子:
```{r, results = "asis"}
# data:
dow <- sample(1:7, 100, replace=TRUE)
purp <- sample(1:4, 100, replace=TRUE)
dow <- factor(dow, 1:7, c("Mon", "Tues", "Wed", "Thurs", "Fri", "Sat", "Sun"))
purp <- factor(purp, 1:4, c("Business", "Commute", "Vacation", "Other"))
dataframe <- data.frame(dow, purp)
# The packages
library(tables)
library(Hmisc)
# The table
#tabular( (Weekday=dow) ~ (Purpose=purp)*(Percent("row")+ 1) ,data=dataframe )
# The latex table
tab <- latex( tabular( (Weekday=dow) ~ (Purpose=purp)*(Percent("col")+ 1) ,data=dataframe ), caption = "This is a Caption")
print(tab)
```
針織表不包含標題。我是LaTeX的新手,我唯一的經驗是通過R和Rstudio。任何建議將不勝感激。
據我所知,看起來乳膠是從包大鼠鼠她比Hmisc(見'latex.tabular')並沒有似乎有相同的選項。您可以capture.output乳膠和手動添加標題 – user20650
請參閱https://stackoverflow.com/questions/21541718/how-to-add-caption-with-the-tables-r-package爲alt方式 – user20650