I am trying to create a LaTeX table using the table and Hmisc packages however, I am having trouble getting the caption to appear.
Here is a reproducible example:
```{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)
```
The knitted table does not contain the caption. I am new to LaTeX and my only experience with LaTeX is through R and Rstudio. Any advice would be greatly appreciated.