[R] Data Table not rendering properly using R shiny

Jeff Newmiller jdnewm|| @end|ng |rom dcn@d@v|@@c@@u@
Sat Nov 7 16:41:32 CET 2020

This looks odd...


This would only work if you had rownames on that data frame corresponding to the names of the Regions. This is a common R mistake... you probably need

logical_idx <- max_usage_hours_per_region$Region == input$Region
max_usage_hours_per_region[  logical_idx,]

That said, it is very difficult to separate out R questions when mixed into shiny code, so you would help yourself and this list to work on minimal reproducible examples that focus on the R syntax if possible for posts here. Read the Posting Guide.

On November 7, 2020 2:42:58 AM PST, Ritwik Mohapatra <ritm84 using gmail.com> wrote:
>Hi All,
>I have a data output as below.I want to display them in an interactive
>report using shiny but the data table is not rendering properly and
>giving NA values.
>Region Sum_as_Hours
>1 Africa 1156.0833
>2 Americas 740.1667
>3 APAC 740.2833
>4 Europe 1895.2000
>5 PDO 1053.3500
>6 UK 0.0000
>Rshiny code:
>ui <- fluidPage(
>Region",max_usage_hours_per_region$Region,selected = TRUE),
>server <- function(input, output) {
>output$table <- renderTable(
>shinyApp(ui = ui, server = server)
>	[[alternative HTML version deleted]]
>R-help using r-project.org mailing list -- To UNSUBSCRIBE and more, see
>PLEASE do read the posting guide
>and provide commented, minimal, self-contained, reproducible code.

Sent from my phone. Please excuse my brevity.

More information about the R-help mailing list