2

So I have a Shiny App that is basically a dataframe passed to the datatable function and formatted in a specific way (see picture below).

I want to put a string where there are 99999999999% values and blank cells while I keep the rest of the cells as numeric (I need the rest of the cells to be of numeric type so as to apply a color scale formatting on them). However, because of the very nature of dataframes, it is not possible to have different types in the same columns.

enter image description here

The question is: Do you know a way to have strings and numeric types in the same column of a data frame? Should I make some other workaround? In this case: Any idea?

intael
  • 508
  • 2
  • 7
  • 21
  • 1
    Hope this background shades are for testing, they are eye killer. Regarding your question, convert dataframe all columns to formatted character. – zx8754 Jun 16 '16 at 11:16
  • @zx8754 Yep, they are obviously for testing. The problem of converting the columns to character is that I won't be able to apply color scales conditional to the values. – intael Jun 16 '16 at 12:51
  • 1
    You can do as @zx8754 suggested and use hidden columns (with the original numeric values) to determine the colors: http://stackoverflow.com/questions/31888834/conditional-formatting-of-a-table-in-rshiny/33509303#33509303 – user5029763 Jun 16 '16 at 22:00
  • Just as an FYI, this http://rstudio.github.io/DT/010-style.html is the official documentation. The feature is not yet available on the CRAN version. – Sumedh Jun 20 '16 at 13:47
  • You can use a list column. – Stéphane Laurent Jun 11 '19 at 20:50

0 Answers0