简体   繁体   English

R Shiny - 警告:如果错误:缺少需要 TRUE/FALSE 的值

[英]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]警告:if 中的错误:缺少需要 TRUE/FALSE 的值 [没有可用的堆栈跟踪]

Any tips on how to fix this?有关如何解决此问题的任何提示? The vector it relates to lengthwise is c(0:500).它与纵向相关的向量是 c(0:500)。

I previously got an error about the differing number of rows, when my loop was going 1:500.当我的循环进行 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.所以我把它改成当前循环1:501,错误信息改成这样。

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我发现这是复选框中的一个问题,我没有input$function==1我输入了{r} input$function ==TRUE

the input$function==1 is the better choice. input$function==1是更好的选择。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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