2

Currently I have a function [degtest] which is created in the shiny server, that returns a list,

return(list(datatable=datatable, predicttable=predicttable, esttable=esttable)

I want this list to be accessible after the function has run so that I can use different parts of the list to be rendered separately.

 outlist <- reactive({
   if(is.null(input$file2)){return(NULL)}
   if(input$d2 == 0){return(NULL)}
   with(data = reactdata$degdata, degtest(reactdata$degdata[,input$selectTemp], reactdata$degdata[,input$selectPot],reactdata$degdata[,input$selectWeight], reactdata$degdata[,input$selectTime], input$Temp0))
   })

input$file2 is my reactdata (reactdata$degdata and input$d2 is an action button.

I thought i'd be able to reference outlist$datatable but R says ' object of type 'closure' is not subsettable'

1 Answer 1

4

When you are making an object reactive, you are actually making it into a sort of function (closure), so you have to use it as outlist() rather than outlist. See this similar question. It's hard to answer your question considering you did not provide a reproducible example, but I think your solution will be something like outlist()$ObjectYouAreTryingToAccess.

Sign up to request clarification or add additional context in comments.

1 Comment

Thank-you for this explanation, it worked and it's helped my understanding of it. Simply adding the () into where I was trying to reference it worked perfectly. Thank-you for your help.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.