I would like to mention small numbers as × 10
in the Rmarkdown
table, similar to the code here.
Here is the code:
library(knitr)
library(kableExtra)
library(janitor)
x <- cbind(c("Term", "s(MERRA_WS)", "s(MERRA_T)", "s(MERRA_P)", "s(MERRA_WD)"),
c( "edf",
round(6.69852,2),
round(6.69852,2),
round(6.69852,2),
round(6.69852,2)),
c("Statistics",
round(6.69852,2),
round(6.69852,2),
round(6.69852,2),
round(6.69852,2)),
c("P-value", "$< 2 \\times 10^{-16}$","$< 2 \\times 10^{-16}$","$< 2 \\times 10^{-16}$","$< 2 \\times 10^{-16}$"),
c("Significance", "***", "***","***","***")
)
x <- as.data.frame(x) # set as dataframe
x <- janitor::row_to_names(x, 1, remove_rows_above = FALSE) %>% clean_names() # set the 1st row as header
rownames(x) <- NULL
x %>%
knitr::kable(digits = 2,
caption = "\\label{table:par-4} Estimates of parametric parameters for the modified model 4", align = c("l","c","c","c","c"),col.names = c("Term","edf", "Statistic", "P-value", "Significance"),
format = "latex", booktabs = T) %>% kable_styling(font_size = 8,
latex_options = "hold_position",
full_width = F) %>%
row_spec(0, bold = T) %>%
column_spec(1, border_right = F)
and here is the output in which the P-Value column doesn't convert to scientific form:
I would like the output in the P-Value column looks like this: