Use external function in R shiny -


i call function shiny server module. actual function complex i'm putting simple example here. want call "callfunction" server part calculations.

error message: "cannot coerce type 'closure' vector of type 'character'"

callfunction = function(one,two) {   #write.csv(buildpath, file = "test.csv")   res= paste(one,two,sep = "")   return(res) }   library(shiny)  ui = fluidpage(    titlepanel("mind map", windowtitle = "mind map"),    textinput(inputid = "username",              label = "enter username"),    textinput(inputid = "contact1",              label = "contact 1"),    #submit button    actionbutton("submitact", label = "go!!"),    textoutput("texty") )  server = function(input, output){       p1 <- eventreactive(input$submitact, {     input$username     })      p2 <- eventreactive(input$submitact, {       input$contact1     })    output$texty = rendertext({callfunction(p1,p2)}) }  shinyapp(ui=ui, server=server) 

whenever "closure" message that's sign somewhere calling reactive function though variable.

in case, need change 1 line to:

output$texty = rendertext({callfunction(p1(),p2())}) 

Comments

Popular posts from this blog

c# - How Configure Devart dotConnect for SQLite Code First? -

c++ - Clear the memory after returning a vector in a function -

erlang - Saving a digraph to mnesia is hindered because of its side-effects -