I am trying to render a table that should contain a column of code. It renders properly with output: html_document but in xaringan the code column is italic with spaces in the wrong places.
---
title: "Bug: posterior prints as two words"
output:
xaringan::moon_reader
---
```{r echo = FALSE}
`Table 2.1` <- data.frame(
Algorithm = c("Linear discriminant analysis", "Generalized Linear model",
"Mixture discriminant analysis", "Decision tree",
"Random forest", "Gradient boosting machine"),
Package = c("MASS", "stats", "mda", "rpart", "ranger", "gbm"),
Code = c("`predict(obj)`",
"`predict(obj, type = 'response')`",
"`predict(obj, type = 'posterior')`",
"`predict(obj, type = 'prob')`",
"`predict(obj$predictions)`",
"`predict(obj, type = 'response', n.trees)`"))
suppressMessages(library(kableExtra))
kable(`Table 2.1`, format = 'html') %>% column_spec(1:3, background = "white")
```
How can I get the table to render in xaringan like it does in html_document?