Error in data$runtime : object of type 'closure' is not subsettable
Hi @Yulia, welcome to community!
I am a bit lost for context here. Could you kindly give a bit more information, idealing with a reproducable example? (here's a link with a bit of info on why and how FAQ: What's a reproducible example (`reprex`) and how do I do one?)
If I were to take a wild guess, you're working with a shiny app and you use a function outside of a
reactive call. But that's just wild, downright-irresponsible speculation. I'm looking forward to finding out.
The second part looks like a typical error, so just guessing that you haven't defined
data or that you made a typo when you defined it. Better run
class(data) to see if you have defined it and if it is of a class which is not a function. Then make sure to define your
data object and it should run fine.
The issue arises, because
data() is a name from a function from the utils package, which is always loaded by default. When you don't have a non function object called also
data, R will try to apply the
$ generic to the function
data(), which gives the error, because there is no meaningful $ method for functions.
However, I am not sure why there is "runtime" in the error message. If my guess is not correct, I would also say, that one needs more information (best a reprex) to help here.