Error in ssrVerify: unused arguments (f1, f2)
I source in my function ssrVerify() and then at the top to use in the shiny program. This function works perfectly when I run it in the R workspace, but when I run it within the Shiny program it yields the error above.
Below are current minimal server.r and ui.r code that can be dropped in to see how I have set things up. Unfortunately, I cannot post my ssrVerify function or sample data as both of those contain proprietary information; I hope this doesn't prevent problem solving this, though I realize the limitations in not providing it.
When I comment out my ssrVerify() function and replace it with any other function that also makes use of the same data, it works just fine. So, I'm not sure why my function ssrVerify works in the R workspace, but kicks out this error when run within Shiny.
Thanks for any help offered and if there is more information I can provide please let me know.
Harold
options(shiny.maxRequestSize=100*1024^2)
source('ssrVerify.R')
### Begin server.r
shinyServer(function(input, output, session) {
###################################################################
# server.r code for SSR Verification
###################################################################
filedata1 <- reactive({
infile <- input$file1
if (is.null(infile)) return(NULL)
read.csv(infile$datapath, header=input$header, sep=input$sep, quote=input$quote)
})
filedata2 <- reactive({
infile <- input$file2
if (is.null(infile)) return(NULL)
read.csv(infile$datapath, header=input$header, sep=input$sep, quote=input$quote)
})
output$structure1 <- renderPrint({
input$structure1
isolate({
df1 <- filedata1()
str(df1)
})
})
output$structure2 <- renderPrint({
input$structure2
isolate({
df2 <- filedata2()
str(df2)
})
})
# reactive expression used so that 'fm' can be passed to other functions
ssrVerify <- reactive({
input$ssrVerify
isolate({
f1 <- filedata1()
f2 <- filedata2()
#if(is.null(f1)) return(NULL)
#if(is.null(f2)) return(NULL)
ssrVerify(f1,f2)
#foo(f1)
})
})
output$ssrVerify <- renderPrint({
input$ssrVerify
isolate({
result <- ssrVerify()
if (is.null(result)) return(NULL)
result
})
})
}) # end Program
#### Begin UI
library(markdown)
shinyUI(navbarPage("Toolbar",
tabPanel("Overview",
h1('Online Statistics and Item Response Analysis Tool', align = 'center', style = 'color:blue'),
fluidRow(
column(4,
includeHTML("overview.html")
),
column(4,
includeHTML("data.html")
),
column(4,
includeHTML("methods.html")
)
)
), # end tabpanel
tabPanel("SSR Verification",
sidebarLayout(
sidebarPanel(
fileInput('file1', 'Choose SSR File',
accept=c('text/csv',
'text/comma-separated-values,text/plain', '.csv')),
fileInput('file2', 'Choose Score File',
accept=c('text/csv',
'text/comma-separated-values,text/plain', '.csv')),
tags$hr(),
h6("Check box if datafile has variable names in first row"),
checkboxInput('header', 'Header', TRUE),
radioButtons('sep', 'Separator',
c(Comma=',',
Semicolon=';',
Tab='\t',
Pipe ='|'),
','),
radioButtons('quote', 'Quote',
c(None='',
'Double Quote'='"',
'Single Quote'="'"),
'"'),
actionButton("structure1", "View SSR data structure"),
actionButton("structure2", "View Score data structure"),
actionButton("ssrVerify", "Run SSR Verification")
),
mainPanel(
verbatimTextOutput('ssrVerify'),
verbatimTextOutput('structure1'),
verbatimTextOutput('structure2')
)
)
) # end tabpanel for SSR Verification
)) # end program