How about something like this:
--- title: "Reproducable Example" author: "dimitris_ps " date: "17 December 2016" output: html_document --- <style> #DataTables_Table_0 { visibility: hidden; } #DataTables_Table_0_paginate { visibility: hidden; } </style> ```{r setup, include=FALSE} knitr::opts_chunk$set(echo = TRUE) library(DT) dt <- datatable(mtcars, rownames=T, # filter = 'top', callback=JS('$("a.buttons-collection").css("background","#008CBA"); $("a.buttons-collection").css("font-size","15px"); $("a.buttons-collection").css("border-radius", "8px"); $("a.buttons-collection").css("margin-right","0px"); return table;'), extensions = 'Buttons', options = list(searching=F, paging = T, bInfo = F, columnDefs = list(list(className = 'dt-left', targets = 0), list(className = 'dt-center', targets = 1:11)), pageLength = 1, initComplete = JS("function(settings, json) {", "$(this.api().table().header()).css({'background-color': '#99ccff', 'color': '#003333'});", "}"), dom = 'Bfrtip', buttons = list( list(extend = 'collection', buttons = c('excel', 'csv'), text = 'DOWNLOAD DATA') ) ) ) ``` <br> ```{r mtcars, echo=FALSE} dt ```
You will need the DT library installed
source share