Objects of type 'closure' is not subsettable - while using a module

I'm new to modules approach, and I'm getting the most sought out error in r shiny. Objects of type 'closure' is not subsettable,

I have checked how the function calls are made, and it looks reasonable to me. I'm not able to find an error in my function usage.

Below is my code,

ui.R

options(shiny.maxRequestSize=100*1024^2)
ui <- dashboardPage(skin = "yellow",
                    dashboardHeader(title = "Modelling Automation"), 
                    dashboardSidebar(
                      sidebarMenu(
                        # Setting id makes input$tabs give the tabName of currently-selected tab
                        id = "tabs",
                        
                        menuItem("Data Processing", tabName = "DP", icon = icon("database"),
                                 menuSubItem("Data", tabName = "Data"),
                                 menuSubItem("Plot", tabName = "Plot")),
                        menuItem("Parameter Extraction", icon = icon("book-open"), tabName = "PE",
                                 menuSubItem("Parameters", tabName = "Parameters")),
                        menuItem("Model QA", tabName = "QA", icon = icon("angellist"))
                      ),
dashboardBody(
                      tabItems(
                        tabItem("DP", "Dashboard tab content"),
                        tabItem("PE", "Widgets tab content"),
                        tabItem("Data", sidebarLayout(sidebarPanel(fileInput("datasets", "choose the files", accept = c(".txt",".esd"), multiple = TRUE)),
                                                      
                                                      mainPanel(div(style='overflow-x:scroll',tableOutput("filetable"),tableOutput("filetable1"))))
                        ),
                        
                        tabItem("Plot",sidebarLayout(sidebarPanel(width=3,
                                                                  #selectInput("plotdata","Choose a dataset to plot",choices = name, selected = 1, multiple = FALSE),
                                                                  uiOutput("plotdata"), uiOutput("chip"),
                                                                  uiOutput("macro"),
                                                                  uiOutput("device"),uiOutput("temperature"), uiOutput("varx"),
                                                                  uiOutput("vary")), mainPanel(width=9, plotlyOutput("PLOT")))))

server.R

server <- function(input,output, session) {

output$plotdata <- renderUI({
    myfiles <- input$datasets
    selectInput("plotdata","choose a dataset to plot",choices = myfiles$name, multiple = FALSE)
  })
  
  
  #sgptlpdata <- reactive({
    #callModule(sgp_tlp, "sgptlpdata")
  #})
  input_file <- reactive({
    if(startsWith(input$plotdata,"C")){
      dmacsCVdata()
    }else if(startsWith(input$plotdata,"D")){
      dmacsDCdata()
    }else if(startsWith(input$plotdata,"T")&endsWith(input$plotdata,".esd")){
      jasperdataTLP()
    }else if(startsWith(input$plotdata,"T")&endsWith(input$plotdata,".txt")){
      source("sgp_tlp.R")
      callModule(sgp_tlp, "input_file")
    }else if(startsWith(input$plotdata,"V")&endsWith(input$plotdata,".esd")){
      jasperdataVFTLP()
    }else{
      SGPjasperdataVFTLP()
    }
  })
  
  
  # output$example <- renderTable({
  #  head(input_file())
  # })
  
  
  
  output$chip <- renderUI({
    Data <- input_file()
    #TLPdata$chip <- paste(TLPdata$chip)
    selectInput("chip", "select the chip", choices = unique(Data$chip),multiple = TRUE, selected = unique(Data$chip)[1])
  })
  
  output$macro <- renderUI({
    Data <- input_file()
    #TLPdata$Macro <- paste(TLPdata$Macro)
    Datachipfiltered <- Data[Data[,"chip"] == input$chip,]
    selectInput("macro", "Select the Macro", choices = unique(Datachipfiltered$macro), multiple= TRUE , selected = unique(Data$macro)[1])
  })

sgp_tlp.R #using this module in a seperate file

sgp_tlp <- function(input, output, session) {
  
  SGPjasperdataTLP <- reactive({
  myfiles <- input$datasets
  if(is.null(myfiles)){
    return(NULL)
  }
  SGPmyjasperTLPfile <- myfiles[which(startsWith(myfiles$name,"T")&endsWith(myfiles$name,".txt")|startsWith(myfiles$name,"t")&endsWith(myfiles$name,".txt") ),]
  
  #read the input file
  DATA <- readLines(SGPmyjasperTLPfile$datapath)
  
  #get Macro details
  Macroid <- vector(mode = "numeric", length = 0)
  Macroid <- grep ( "Macro ID:", DATA, value = TRUE)
  #Macroid <- str_extract(Macroid, "(?<=:\t).+")
  Macroid <- substring(Macroid,10)
  
  
  #get device details
  DeviceName <- vector(mode = "numeric", length = 0)
  DeviceName <- grep ( "Device ID/Name:", DATA, value = TRUE)
  #DeviceName <- str_extract(DeviceName, "(?<=:\t).+") 
  DeviceName <- substring(DeviceName,16)
  
  #get numerical values
  StartPos <- str_which(DATA, "File Name:") 
  DataStartPos <- StartPos + 21
  DataEndPos <- c(StartPos[2:length(StartPos)]-1, length(DATA))
  
  #Create a new data frame
  Values <- data.frame()
  
  #Seperate numeric data and META data and bind to data frame
  for (i in seq_along(DataStartPos)){
    tmp <- as.data.frame(DATA[DataStartPos[i]:DataEndPos[i]])
    tmp <- separate(tmp, col = 1, c("Amps", "Volts", "Leakage"), sep = "\t")
    tmp$macro <- Macroid[i]
    tmp$device <- DeviceName[i]
    tmp$chip <- paste("0 0")
    
    Values <- rbind(Values,tmp)
  }
  Values
  })
return(SGPjasperdataTLP)
}

Hello,
first problem, can we run your app and reproduce your error, without data ? I think it could be a problem.
Two options, make a version of your code that is simpler, has built in data, and just shows the minimal problem that you have. or... share some data, and instructions how to use the app to trigger the error.

Aside from that, I loaded your app and threw a random text file at it, and it errored. but the error was forseeable. The code looks for a SGPjasperdataVFTLP that is never defined in the code as provided.
Can you review that ?

I have attached the data file. Kindly use this as the file name, "TLP.txt" to satisfy the condition where I'm calling the module. The input file must be .txt file.

File Name:	DUT_12_05-22-19_05'10'55_PM.txt	05/22/2019	05:10:55 PM
Operator:	M.Seva1
Device ID/Name:	DUT_12
Wafer Manufacturer Lot:	Manufacturer Lot
Macro ID: HV_NFET_1	
Wafer ID:	
Device Type:	Device Type
Design Technology:	Design Technology
Pulse Pin:	PulsePin
Ground Pin(s):	GroundPin
Leakage Test Voltage:	3.00E+01
Leakage Current Limit:	9.00E-07
Start Pulse Voltage:	 .1
Stop Pulse Voltage:	 230
Pulse Step Voltage:	 10
Pulse Current Limit:	 12
Pulse Voltage Limit:	No Limit
Pulse Width:	 100
File location:	V:\SHARE\Data\130nm\130BCDLite-Gen2\MPW1399\7XYT35603 W#01\TLP\Selected DUT\TYPE_F_HV_NFET_1\Site_1\
Software Version:	1.28.0
TLP I(AMPS)	TLP V(VOLTS)	I(LEAKAGE)
6.239807E-08	3.814697E-06	5.031684E-09
5.863665E-04	1.103846E+00	5.024262E-09
8.960332E-04	2.125752E+00	5.028087E-09
1.158754E-03	3.142988E+00	5.026689E-09
2.077270E-03	4.214194E+00	5.024051E-09
2.440571E-03	5.172394E+00	5.026277E-09
2.450079E-03	6.233009E+00	5.025292E-09
3.000960E-03	7.309345E+00	5.024874E-09
3.598375E-03	8.414818E+00	5.027082E-09
3.869933E-03	9.484002E+00	5.026222E-09
4.422583E-03	1.042092E+01	5.024921E-09
5.100840E-03	1.141954E+01	5.028387E-09
5.527094E-03	1.246498E+01	5.029340E-09
5.925164E-03	1.355835E+01	5.028017E-09
6.511196E-03	1.465404E+01	5.028439E-09
6.988368E-03	1.577041E+01	5.030630E-09
7.009336E-03	1.683455E+01	5.032785E-09
7.643472E-03	1.798853E+01	5.036283E-09
8.337267E-03	1.853063E+01	5.030301E-09
8.781826E-03	1.956639E+01	5.030897E-09
8.997823E-03	2.053162E+01	5.031330E-09
9.099531E-03	2.150464E+01	5.033534E-09
1.025762E-02	2.263739E+01	5.032131E-09
1.048102E-02	2.362283E+01	5.032460E-09
1.117063E-02	2.463645E+01	5.030236E-09
1.143505E-02	2.571084E+01	5.029513E-09
1.140511E-02	2.676439E+01	5.032406E-09
1.219862E-02	2.793970E+01	5.034049E-09
1.253032E-02	2.893677E+01	5.034369E-09
1.330105E-02	2.999629E+01	5.035118E-09
1.364693E-02	3.118472E+01	5.031430E-09
1.426878E-02	3.209792E+01	5.030610E-09
1.468201E-02	3.334975E+01	5.027839E-09
1.477108E-02	3.432727E+01	5.025968E-09
1.564755E-02	3.540960E+01	5.031115E-09
1.647853E-02	3.659948E+01	5.036907E-09
1.651090E-02	3.767636E+01	5.031228E-09
1.704582E-02	3.862834E+01	5.022089E-09
1.750865E-02	3.980640E+01	5.019765E-09
1.790756E-02	4.081136E+01	5.018582E-09
1.875544E-02	4.269915E+01	5.010022E-09
2.007528E-02	4.364330E+01	5.015846E-09
1.284799E-01	3.892088E+01	5.011870E-09
1.517454E-01	3.885571E+01	5.017070E-09
1.748289E-01	3.865034E+01	5.025512E-09
1.980964E-01	3.845067E+01	5.030766E-09
2.206585E-01	3.858709E+01	5.036871E-09
2.410004E-01	3.842691E+01	5.031055E-09
2.612080E-01	3.846095E+01	5.030979E-09
2.809383E-01	3.850418E+01	5.029324E-09
3.015532E-01	3.830061E+01	5.027242E-09
3.412229E-01	3.865723E+01	5.028767E-09
3.841884E-01	3.848333E+01	5.021398E-09
4.266047E-01	3.856112E+01	5.025145E-09
4.664215E-01	3.877881E+01	5.029294E-09
5.109774E-01	3.877785E+01	5.025337E-09
5.505747E-01	3.892723E+01	5.029884E-09
5.926577E-01	3.895586E+01	5.026501E-09
6.319336E-01	3.908075E+01	5.024218E-09
6.777087E-01	3.919463E+01	5.032057E-09
7.140396E-01	3.933329E+01	5.032570E-09
7.554069E-01	3.949151E+01	5.030326E-09
7.886468E-01	3.957840E+01	5.024515E-09
8.272396E-01	3.978258E+01	5.020425E-09
8.690757E-01	3.976747E+01	5.024988E-09
9.102669E-01	3.996528E+01	5.021268E-09
9.499123E-01	4.015997E+01	5.028120E-09
9.892700E-01	4.024074E+01	5.029864E-09
1.026853E+00	4.042958E+01	5.028690E-09
1.069117E+00	4.047610E+01	5.028426E-09
1.113146E+00	4.062540E+01	5.029539E-09
1.151732E+00	4.075476E+01	5.022329E-09
1.195145E+00	4.082866E+01	5.031044E-09
1.236654E+00	4.107898E+01	5.028508E-09
1.279677E+00	4.131062E+01	5.022544E-09
1.315303E+00	4.123980E+01	5.024188E-09
1.416728E+00	4.162891E+01	5.025754E-09
1.523320E+00	4.197533E+01	5.025324E-09
1.631011E+00	4.210937E+01	5.022613E-09
1.726954E+00	4.233191E+01	5.027485E-09
1.834727E+00	4.255820E+01	5.034194E-09
1.942229E+00	4.286988E+01	5.025687E-09
2.047906E+00	4.301897E+01	5.024139E-09
2.151548E+00	4.335761E+01	5.022932E-09
2.257638E+00	4.367443E+01	5.022672E-09
2.367121E+00	4.380559E+01	5.025385E-09
2.474151E+00	4.410883E+01	5.017970E-09
2.577945E+00	4.419174E+01	5.022237E-09
2.611691E+00	4.429878E+01	5.023886E-09
2.720742E+00	4.474714E+01	5.019960E-09
2.807241E+00	4.484452E+01	5.022916E-09
2.910158E+00	4.494404E+01	5.017270E-09
2.994560E+00	4.523767E+01	5.025540E-09
3.090319E+00	4.541066E+01	5.023062E-09
3.192011E+00	4.568328E+01	5.272576E-09
3.299681E+00	4.616101E+01	5.957118E-09
3.393607E+00	4.646917E+01	7.385827E-09
3.499137E+00	4.638663E+01	1.568911E-08
3.608901E+00	4.626759E+01	3.604886E-08
3.741173E+00	4.476144E+01	1.425331E-07
3.827426E+00	4.615197E+01	1.578508E-07
3.963973E+00	4.452985E+01	1.000003E-06
File Name:	DUT_12_05-22-19_05'10'55_PM.txt	05/22/2019	05:10:55 PM
Operator:	M.Seva2
Device ID/Name:	DUT_13
Wafer Manufacturer Lot:	Manufacturer Lot
Macro ID: HV_NFET_2	
Wafer ID:	
Device Type:	Device Type
Design Technology:	Design Technology
Pulse Pin:	PulsePin
Ground Pin(s):	GroundPin
Leakage Test Voltage:	3.00E+01
Leakage Current Limit:	9.00E-07
Start Pulse Voltage:	 .1
Stop Pulse Voltage:	 230
Pulse Step Voltage:	 10
Pulse Current Limit:	 12
Pulse Voltage Limit:	No Limit
Pulse Width:	 100
File location:	V:\SHARE\Data\130nm\130BCDLite-Gen2\MPW1399\7XYT35603 W#01\TLP\Selected DUT\TYPE_F_HV_NFET_1\Site_1\
Software Version:	1.28.0
TLP I(AMPS)	TLP V(VOLTS)	I(LEAKAGE)
6.239807E-08	3.814697E-06	5.031684E-09
5.863665E-04	1.103846E+00	5.024262E-09
8.960332E-04	2.125752E+00	5.028087E-09
1.158754E-03	3.142988E+00	5.026689E-09
2.077270E-03	4.214194E+00	5.024051E-09
2.440571E-03	5.172394E+00	5.026277E-09
2.450079E-03	6.233009E+00	5.025292E-09
3.000960E-03	7.309345E+00	5.024874E-09
3.598375E-03	8.414818E+00	5.027082E-09
3.869933E-03	9.484002E+00	5.026222E-09
4.422583E-03	1.042092E+01	5.024921E-09
5.100840E-03	1.141954E+01	5.028387E-09
5.527094E-03	1.246498E+01	5.029340E-09
5.925164E-03	1.355835E+01	5.028017E-09
6.511196E-03	1.465404E+01	5.028439E-09
6.988368E-03	1.577041E+01	5.030630E-09
7.009336E-03	1.683455E+01	5.032785E-09
7.643472E-03	1.798853E+01	5.036283E-09
8.337267E-03	1.853063E+01	5.030301E-09
8.781826E-03	1.956639E+01	5.030897E-09
8.997823E-03	2.053162E+01	5.031330E-09
9.099531E-03	2.150464E+01	5.033534E-09
1.025762E-02	2.263739E+01	5.032131E-09
1.048102E-02	2.362283E+01	5.032460E-09
1.117063E-02	2.463645E+01	5.030236E-09
1.143505E-02	2.571084E+01	5.029513E-09
1.140511E-02	2.676439E+01	5.032406E-09
1.219862E-02	2.793970E+01	5.034049E-09
1.253032E-02	2.893677E+01	5.034369E-09
1.330105E-02	2.999629E+01	5.035118E-09
1.364693E-02	3.118472E+01	5.031430E-09
1.426878E-02	3.209792E+01	5.030610E-09
1.468201E-02	3.334975E+01	5.027839E-09
1.477108E-02	3.432727E+01	5.025968E-09
1.564755E-02	3.540960E+01	5.031115E-09
1.647853E-02	3.659948E+01	5.036907E-09
1.651090E-02	3.767636E+01	5.031228E-09
1.704582E-02	3.862834E+01	5.022089E-09
1.750865E-02	3.980640E+01	5.019765E-09
1.790756E-02	4.081136E+01	5.018582E-09
1.875544E-02	4.269915E+01	5.010022E-09
2.007528E-02	4.364330E+01	5.015846E-09
1.284799E-01	3.892088E+01	5.011870E-09
1.517454E-01	3.885571E+01	5.017070E-09
1.748289E-01	3.865034E+01	5.025512E-09
1.980964E-01	3.845067E+01	5.030766E-09
2.206585E-01	3.858709E+01	5.036871E-09
2.410004E-01	3.842691E+01	5.031055E-09
2.612080E-01	3.846095E+01	5.030979E-09
2.809383E-01	3.850418E+01	5.029324E-09
3.015532E-01	3.830061E+01	5.027242E-09
3.412229E-01	3.865723E+01	5.028767E-09
3.841884E-01	3.848333E+01	5.021398E-09
4.266047E-01	3.856112E+01	5.025145E-09
4.664215E-01	3.877881E+01	5.029294E-09
5.109774E-01	3.877785E+01	5.025337E-09
5.505747E-01	3.892723E+01	5.029884E-09
5.926577E-01	3.895586E+01	5.026501E-09
6.319336E-01	3.908075E+01	5.024218E-09
6.777087E-01	3.919463E+01	5.032057E-09
7.140396E-01	3.933329E+01	5.032570E-09
7.554069E-01	3.949151E+01	5.030326E-09
7.886468E-01	3.957840E+01	5.024515E-09
8.272396E-01	3.978258E+01	5.020425E-09
8.690757E-01	3.976747E+01	5.024988E-09
9.102669E-01	3.996528E+01	5.021268E-09
9.499123E-01	4.015997E+01	5.028120E-09
9.892700E-01	4.024074E+01	5.029864E-09
1.026853E+00	4.042958E+01	5.028690E-09
1.069117E+00	4.047610E+01	5.028426E-09
1.113146E+00	4.062540E+01	5.029539E-09
1.151732E+00	4.075476E+01	5.022329E-09
1.195145E+00	4.082866E+01	5.031044E-09
1.236654E+00	4.107898E+01	5.028508E-09
1.279677E+00	4.131062E+01	5.022544E-09
1.315303E+00	4.123980E+01	5.024188E-09
1.416728E+00	4.162891E+01	5.025754E-09
1.523320E+00	4.197533E+01	5.025324E-09
1.631011E+00	4.210937E+01	5.022613E-09
1.726954E+00	4.233191E+01	5.027485E-09
1.834727E+00	4.255820E+01	5.034194E-09
1.942229E+00	4.286988E+01	5.025687E-09
2.047906E+00	4.301897E+01	5.024139E-09
2.151548E+00	4.335761E+01	5.022932E-09
2.257638E+00	4.367443E+01	5.022672E-09
2.367121E+00	4.380559E+01	5.025385E-09
2.474151E+00	4.410883E+01	5.017970E-09
2.577945E+00	4.419174E+01	5.022237E-09
2.611691E+00	4.429878E+01	5.023886E-09
2.720742E+00	4.474714E+01	5.019960E-09
2.807241E+00	4.484452E+01	5.022916E-09
2.910158E+00	4.494404E+01	5.017270E-09
2.994560E+00	4.523767E+01	5.025540E-09
3.090319E+00	4.541066E+01	5.023062E-09
3.192011E+00	4.568328E+01	5.272576E-09
3.299681E+00	4.616101E+01	5.957118E-09
3.393607E+00	4.646917E+01	7.385827E-09
3.499137E+00	4.638663E+01	1.568911E-08
3.608901E+00	4.626759E+01	3.604886E-08
3.741173E+00	4.476144E+01	1.425331E-07
3.827426E+00	4.615197E+01	1.578508E-07
3.963973E+00	4.452985E+01	1.000003E-06

If I run without modules, I'm able to generate the dataframe and use it. I'm getting this error only when I try to convert it to modules.

This topic was automatically closed 21 days after the last reply. New replies are no longer allowed.