context('Test that make_row_heat_tgrob works properly')
test_that('get_row_bg returns appropriate values', {
df <- data.frame(x = 'text',
y = seq(-5, 5),
z = paste('dummy', 1:length(seq(-5, 5)), sep = '_')) %>%
tidyr::spread(z, y)
row_bgs <- get_row_bg(df = df)
expect_equal(class(row_bgs), 'matrix')
expect_true(all(grepl('grey|^#[[:xdigit:]]{6}$', row_bgs %>% as.character())))
})
test_that('make_row_heat_tgrob works properly', {
df <- data.frame(x = 'text',
y = seq(-5, 5),
z = paste('dummy', 1:length(seq(-5, 5)), sep = '_')) %>%
tidyr::spread(z, y)
expect_true('gtable' %in% class(df %>% make_row_heat_tgrob))
# no numeric columns throws error
expect_error(df %>%
tidyr::gather(z, y, -x) %>%
tidyr::spread(y, z) %>%
make_row_heat_tgrob())
})
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.