简体   繁体   中英

R Shiny - Warning: Error in if: missing value where TRUE/FALSE needed

I have the following code executing in my server function:

``

# Integral of xf(x)
Sxfx <- 0

for(i in 1:501)
{
  
  sumxfx <- 0
  
  for(j in 1:i)
  {
    sumxfx <- sumxfx + xfx[j]
  }
  
  Sxfx[i] <- sumxfx
  
}

``

When I execute it, I get the following error message:

Warning: Error in if: missing value where TRUE/FALSE needed [No stack trace available]

Any tips on how to fix this? The vector it relates to lengthwise is c(0:500).

I previously got an error about the differing number of rows, when my loop was going 1:500. With that error, my file wouldn't execute at all. So I changed it to the current loop going 1:501, and the error message changed to this.

Any help will be greatly appreciated!

I have found this to be a problem in checkboxes where instead of having the input$function==1 I typed {r} input$function ==TRUE

the input$function==1 is the better choice.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM