baptiste / gridExtra

Miscellaneous Functions for "Grid" Graphics
http://cran.r-project.org/web/packages/gridExtra/index.html
15 stars 4 forks source link

theme as result of ifelse #42

Closed Tlopasha closed 7 years ago

Tlopasha commented 7 years ago

Hi ,

I'm trying to add theme to tableGrob depending on ifelse result's (if nummber odd or even ) but i get an Error

this my example :

library(gridExtra)
library(gtable)
tt1 <- ttheme_default()
tt2 <- ttheme_minimal()

tableGrob(iris[1:4, 1:2], theme=ifelse(4%% 2 == 0,tt1, tt2))

I got this Error

 Error in data.frame(fg_params, label = as.vector(label_matrix), stringsAsFactors = FALSE) : 
  arguments imply differing number of rows: 0, 8

Can you please help me with this issue

Thanks,

baptiste commented 7 years ago

ifelse(4%% 2 == 0,tt1, tt2) does not return a theme like you expect.