I have this dataframe and I want to create a DT datatable which will have sub headers like Gender
and Race
like the image below. How can I do it using DT ?
<code># Create the dataframe using data.frame
df <- data.frame(
attribute = c("male", "female", "hispanic", "african"),
value1 = c(10, 20, 30, 40),
value2 = c(50, 60, 70, 80)
)
library(DT)
datatable(df)
</code>
<code># Create the dataframe using data.frame
df <- data.frame(
attribute = c("male", "female", "hispanic", "african"),
value1 = c(10, 20, 30, 40),
value2 = c(50, 60, 70, 80)
)
library(DT)
datatable(df)
</code>
# Create the dataframe using data.frame
df <- data.frame(
attribute = c("male", "female", "hispanic", "african"),
value1 = c(10, 20, 30, 40),
value2 = c(50, 60, 70, 80)
)
library(DT)
datatable(df)