Ashu
Ashu

Reputation: 61

How to show data frame data into table in R using shiny

My data look like as follow in data frame:

X
a        date     b     c    d     e     f     g     h     i 
1    7 Jan 17    80    80   -4    26    58    16    12    12

I want to show this data in table view in shiny.

In ui.r I have done as follow:

tableOutput("futureData")

and in server.R I want to show that data frame data in table

output$futureData <- renderTable()

What should I do?

Upvotes: 2

Views: 3229

Answers (1)

Uwe
Uwe

Reputation: 42544

Please, try

output$futureData <- renderTable(
  {
    X <- data.frame(a = 1L, date = "7 Jan 17", b = 80L, c = 80L, d = -4L,
                    e = 26L, f = 58L, g = 16L, h = 12L, i = 12L)
    return(X)
  }
)

Note that return(X) can be replaced by a single X.

Upvotes: 3

Related Questions