'R package formattable: adding a main title to a table

Background

I have a dataframe like the following:

mydata <- structure(list(Wife = c(15.972, 12.715, 8.333, 6.276, 2.179, 
-1.408, -1.649, -4.647, -7.039, -5.299, -7.411, -9.776, -9.612
), Alternating = c(-2.622, -0.548, -1.331, 3.9, -1.802, 2.08, 
1.481, 9.53, 7.709, -0.953, -4.823, -4.878, -5.245), Husband = c(-7.012, 
-5.823, -3.99, -3.324, -5.828, -4.869, -3.941, 0.515, 9.551, 
-0.868, 4.843, 24.544, -5.812), Jointly = c(-8.283, -7.569, -4.048, 
-6.564, 4.418, 4.284, 4.157, -3.006, -7.306, 7.066, 7.086, -8.306, 
19.397)), row.names = c("Laundry", "Main_meal", "Dinner", "Breakfeast", 
"Tidying", "Dishes", "Shopping", "Official", "Driving", "Finances", 
"Insurance", "Repairs", "Holidays"), class = "data.frame")

With the formattable package it is not difficult to turn that into a nicely (however basic) formatted table:

mytable <- formattable(mydata)

Question

I have done some web-searches but I have not been successful in finding a viable way of adding a simple main title to the table; something that could simply appear right on top (maybe in bold, and with a slightly larger font size). Perhaps I am overlooking something easy. Indeed, the gt package can easily do that, but I would like to stick with formattable because for other customizations it proves quite handy.



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source