I am trying to make a report in a LaTeX format using R. The file format is in .Rnw
. I am preparing a table using the kable and kableExtra packages but I have only one problem.
Here's the screenshot of the table I made:
I wanted to make the two species (in rows 1 and 2 of column 1) to be in italics. How to make it?
Thanks.
Here's the data:
df1 <- data.frame(`Species Name` = c("Encrasicholina punctifer", "Stolephorus indicus", "Others", "Total"),
`2014` = c(171.12, 0, 0.59, 171.72),
`2015` = c(231.18, 3.07, 0.29, 234.55),
`2016` = c(412.1, 0, 0.44, 412.54),
Total = c(814.4, 3.07, 1.33, 818.8),
Percent = c(99.46, 0.38, 0.16, 100))
By the way, here's the R code:
\begin{table}[H]
\centering
<<table_2>>=
df1 %>%
kable(format = "latex",
booktabs = T) %>%
kable_styling(latex_options = c("HOLD_position"),
position = "center",
font_size = 9) %>%
row_spec(0, bold = T) %>%
row_spec(4, bold = T)
@
\end{table}