Reputation: 1
I'm super new to R and I'm struggling to create a header above the column names.
colnames(system_table) <- c("System 1", "System 2", "System 3","System 4")
I want to add a title above these that says "All Systems" but I can't seem to find the function to do so.
Upvotes: 0
Views: 7426
Reputation: 41469
You can use something like this in Rmarkdown
:
---
title: "Test"
output: html_document
---
```{r, echo=FALSE, warning=FALSE, message=FALSE}
library(magrittr)
library(knitr)
library(formattable)
system_table <- data.frame(v1 = c(1,2,3),
v2 = c(3,2,5),
v3 = c(5,3,2),
v4 = c(3,2,1))
colnames(system_table) <- c("System 1", "System 2", "System 3","System 4")
formattable(system_table) %>%
kable("html", escape = F, caption = "All Systems")
```
Output:
Upvotes: 1