Stéphane Stéphane - 3 years ago 203
R Question

difference between 2 syntaxes of the 'reactive' instruction

warning: I'm pretty new to R and R studio ==> I don't realize whether this question is interesting.

I have a Data base in DB. Is there a difference between

DBtoto <- reactive({DB()})
DBtoto <- reactive({DB})
? If so, what is it ?

In fact I don't see what
(with parentheses) means.

Answer Source

Yes, there's a difference. DB() is a call to the function named DB. DB is the function itself. If it's not a function, then DB() doesn't make sense, and will trigger a run-time error (unless there's another object somewhere which is a function).

reactive() is a Shiny function, that says the value of its argument may change over time. Usually it would make more sense to think the value of the function call would change, but it's (remotely) possible that the function itself could change.

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download