Making updates to columns of a reactive data frame

I have reactive data frame in the server.R program. I want to update the columns of the data frame. In the code below the attempt to perform str_trim on a column of the data frame throws the error:

Error in <-: invalid (NULL) left side of assignment

If I leave the str_trim line out the code below works fine.

server <- function(input, output, session) {
observeEvent(input$gobutton, {
TD <- odbcConnect(dsn="yyyy", uid="xxxxx", pwd=rstudioapi::askForPassword())

DB_Table <- paste0(input$DB,".",input$TableName)

Sql <- paste0("select ColumnName, ColumnType from DBC.ColumnsV where databaseName ='",input$DB,"' and tableName = '",input$TableName,"'")

ColNames <- reactive({sqlQuery(TD, Sql)})

Int_Cols <- reactive({ColNames() %>% filter(ColumnType %in% c("I ","I1") & ColumnName != "Emp_ID") })

This line produces the error.

Int_Cols()$ColumnName <- reactive({str_trim(Int_Cols()$ColumnName)})

shiny output

output$OutputMessage <- renderText({paste("QC results")})
output$QCresults <- renderTable({Int_Cols()})


I don't quite understand how to work with reactive objects or when they are needed in a shiny app. Can anyone point to a source of info on the 'reactive' concept?

This topic was automatically closed 54 days after the last reply. New replies are no longer allowed.

If you have a query related to it or one of the replies, start a new topic and refer back with a link.