Error in func()

520 views
Skip to first unread message

Jana

unread,
Apr 4, 2013, 2:28:02 PM4/4/13
to shiny-...@googlegroups.com
Hi,

I tried to get some plots based on text inputs and I keep getting the error message below

Error in func() : could not find function "func"

My Srever.r and Ui.r are given below. Can someone help me to fix this?

Thanks

# Server.r
eset <- load("expressionset.RData")

shinyServer(function(input,output) {
    output$Plot <- reactivePlot({
    gene <- as.character(input$genes)
    datas <- eset[grep(gene,featureNames(eset))]
    dataf = melt (exprs(datas[1]),varnames = c("genes"))
    pheno = cbind(pData(datas[1]), sample = rownames(pData(datas[1])))
    covr <- data.frame(sample = pheno$sample,risk=pheno$risk)
    #Merge according to sample names
    dataf = merge(dataf,covr,by.x = "NA.",by.y = "sample")
    # add column name
    colnames(dataf) = c("sample","gene","value","type")
    # check for the input variable
ggplot(dataf, aes(y=value, x=type)) + 
ylab("Log 2 value") + 
xlab("Type") + 
geom_boxplot()+ 
opts(title=paste(gene) + theme_bw() +  
opts(legend.position="none"))

    })
})

# UI.r
library(shiny)

shinyUI(pageWithSidebar(
  
        sidebarPanel(   
textInput("genes", "Enter a gene symbol", value = "MYCN"),
br()
),
  
        #Show a tabset that includes many plots
mainPanel(
tabsetPanel(
tabPanel("Boxplot", plotOutput("Plot")), 
tabPanel("Survial", plotOutput("Survial"))
  )
)
))

Winston Chang

unread,
Apr 4, 2013, 3:58:14 PM4/4/13
to shiny-...@googlegroups.com
Instead of "reactivePlot({ ... })", you need "renderPlot({ ... })". Also make sure you're using the latest version of Shiny.

-Winston


--
You received this message because you are subscribed to the Google Groups "Shiny - Web Framework for R" group.
To unsubscribe from this group and stop receiving emails from it, send an email to shiny-discus...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.
 
 

Jana

unread,
Apr 4, 2013, 5:53:33 PM4/4/13
to shiny-...@googlegroups.com
Thanks
Reply all
Reply to author
Forward
0 new messages