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
Post a Comment