Johnny Banana
Johnny Banana

Reputation: 123

R - instead of plotting, just show the table

this is my R code:

output$heatmap_viewed_ads <- renderPlotly({
  plot_ly(  x = c(1,2,3,4,5), y = casted_viewed_ads$FEED, z = as.matrix(casted_viewed_ads[2:15]), type = "heatmap",colors = "Greens"  )%>%
  layout(title =  "#Views", xaxis=list(title="Position of Display"))})

I am plotting right here this data. I do now want to just show the matrix that is generated by

as.matrix(casted_viewed_ads[2:15])

Can someone help me please? I'm new to R. I'm using Shiny and Plotly.

Thanks!

Upvotes: 0

Views: 77

Answers (1)

Barbara
Barbara

Reputation: 1168

You can use renderTable to display your matrix in the Shiny app.

Server

output$matrix <- renderTable({

yourmatrix <- as.matrix(casted_viewed_ads[2:15])

yourmatrix 

})

UI

mainPanel(
plotOutput("heatmap_viewed_ads"), #you can eliminate this line if you just want to show the table
tableOutput("matrix")
)

Upvotes: 1

Related Questions