Learn R Programming

tableHTML (version 2.1.2)

add_css_row: Add css to tableHTML's rows

Description

add_css_row will add css to a tableHTML's rows

Usage

add_css_row(tableHTML, css, rows = NULL)

Value

A tableHTML object.

Arguments

tableHTML

A tableHTML object created by the tableHTML function.

css

A list of two elements with the corresponding css. The first element of the list should be an atomic vector with the style definitions (e.g. background-color). The second element will be an atomic vector with the same length as the first element, which will contain the style definitions' values (e.g. red). Check the examples for more information.

rows

A numeric atomic vector with the indices of the rows on which the style definitions will be applied. headers and second_headers are included in the rows.Default is NULL which means that it will be applied to all rows.

Details

add_css_row will add css to a tableHTML's rows. The only thing you need to be cautious about is the rows argument. headers and second_headers are still considered rows. add_css_row affects the tr tag of the HTML code internally.

Examples

Run this code
tableHTML(mtcars) %>% 
  add_css_row(css = list(c('background-color', 'border'), c('lightgray', '3px solid green'))) 

tableHTML(mtcars) %>% 
  add_css_row(css = list(c('background-color', 'border'), c('lightgray', '3px solid green')), 
              rows = 1:33)
        

Run the code above in your browser using DataLab