0

When I run the following code in R, I get the table below.

df<-data.frame(color=rep(c("red", "blue", "green"), 10), numbers=c(1:5, 2:6, 3:7, 4:8, 5:9, 6:10))
table(df)

enter image description here

When I run the code in Shiny, using renderTable, I get what's below. I would prefer having a table set up like the one above because this one takes up a lot of space and is more difficult to read through. Especially since I actually have 30 "numbers" and 7 "colors", which would be 210 unique pairs instead of 30. How can I get the set up of the above table to output in Shiny?

enter image description here

Lost
  • 331
  • 1
  • 12
  • `renderText()` or `renderPrint()`? – Ryan Morton Jul 23 '18 at 19:00
  • @RyanMorton They just output strings of text. renderText() gives me `numbers color 1 2 3 4 5 6 7 8 9 10 blue 0 1 1 1 2 2 1 1 1 0 green 0 1 1 1 2 1 2 1 0 1 red 1 0 1 2 1 2 1 1 1 0` and renderPrint gives `0 0 1 1 1 0 1 1 1 1 1 2 2 2 1 2 1 2 1 2 1 1 1 1 1 0 1 0 1 0` – Lost Jul 23 '18 at 19:17
  • Well, if you don't like the renderTable function, you'll need to format the table yourself. – Ryan Morton Jul 23 '18 at 19:36
  • @RyanMorton How can I format it to get the first output I shared? – Lost Jul 23 '18 at 19:42

0 Answers0