R-knitr: kable - How to display a table without column names?

I currently have this data frame (PS):

Column heading table

My code to display this table:

kable(PS) %>%
kable_styling(bootstrap_options = c("striped", "hover", "condensed", "responsive"))

I want to display a table without column names as follows: enter image description here

Problem

1) Column names must not be empty, and attempts to use empty names will have unsupported results

2) If I convert the data frame and delete the column names, and then use kable as follows:

PS.mat <- as.matrix(PS)
colnames(PS.mat) <- NULL
kable(PS) %>%
kable_styling(bootstrap_options = c("striped", "hover", "condensed", "responsive"))

I get the following error

Error in kable_info$colnames[[length(kable_info$colnames)]] : attempt to select less than one element in integerOneIndex

I also tried the following option, but with no results

kable(PS, col.names = NA) 

EDIT 1:

Playable example:

if (!require(pacman)) install.packages("pacman")
p_load("lubridate","knitr","kableExtra","scales")

Statistics <- c("AUM",
            "Minimum Managed Account Size",
            "Liquidity",
            "Average Margin / Equity",
            "Roundturns / $ Million / Year",
            "Incentive Fees",
            "Instruments Traded")
Value <- c("$30K","$30K","Daily","50%","6,933","25%","ES")
AI <- data.frame(Statistics,Value);
kable(AI) %>%
kable_styling(bootstrap_options = c("striped", "hover", "condensed", "responsive"))
+4
source share
1 answer

Depending on the output format you want, you can use such functions. For pandoc:

x = kable(AI, format="pandoc") %>%
    kable_styling(bootstrap_options = c("striped", "hover", "condensed", "responsive"))
cat(x[3:9], sep="\n")

For html:

x = kable(AI, format="html") %>%
    kable_styling(bootstrap_options = c("striped", "hover", "condensed", "responsive"))
gsub("<thead>.*</thead>", "", x)

(, - ...)

+4

Source: https://habr.com/ru/post/1679940/


All Articles