我收到以下错误消息:
Error in if (condition) { : missing value where TRUE/FALSE needed
或
Error in while (condition) { : missing value where TRUE/FALSE needed
这意味着什么,我如何防止它?
我有一个非常大的数据集,有36个特征,其中包括6个输出列。我正在尝试在这个数据集中进行MLP反向传播神经网络学习(回归),并且我使用了神经网络和插入符号。我想要两个隐藏层,每层有6和5个节点。我还想在我的NN模型中添加k折交叉验证
control <- trainControl(method="repeatedcv", number=5, repeats=1)
# train the model
model <- train(X,Y, method="neuralnet",
algorithm
我的代码中有这一行,用来为点密度图创建点。我误用的函数是maptools包中的dotsInPolys。当我运行它时,我会得到这个错误,我不知道它意味着什么。有人能帮忙吗?
NSWdots <- dotsInPolys(NSW, as.integer(datajoin$pop.10))
新南威尔士州是一个shapefile,datajoin$pop.10是一个数字向量。
给定的错误是:
Error in if (x[i] > 0) { : missing value where TRUE/FALSE needed
我尝试在R上运行以下代码:
m <- gam(Flp_pop ~ s(Flp_CO, bs = "cr", k = 30), data = data, family = poisson, method = "REML")
我的数据集是这样的:
但是当我尝试执行的时候,我得到了这个错误信息:
"Error in if (abs(old.score - score) > score.scale * conv.tol) { :
missing value where TRUE/FALSE needed
In addition: There
我有一个写得很糟糕的函数。 例如: foo <- function (x) {
y = log(x)
if (y > 1) {
print("hello")
}
} 我使用负x参数调用函数。 foo (-1) 当调用负数时,由于log的行为,我得到了一个错误和一个警告。 Error in if (y > 1) { : missing value where TRUE/FALSE needed
In addition: Warning message:
In log(x) : NaNs produced 我想用"evaluate“函
我在一个大型数据库中找到了用于可视化的列表包。我使用下面的代码运行它,但是在不同的数据帧上得到了这个错误:
"Error in if (any(B < 1)) stop("B too small") :
missing value where TRUE/FALSE needed
In addition: Warning message:
In bbatch(n, as.integer(BATCHBYTES/theobytes)) : NAs introduced by coercion"
下面是一个示例:
dat <- read.table(t
我正在尝试在R中执行以下代码
comments = c("no","yes",NA)
for (l in 1:length(comments)) {
if (comments[l] != NA) print(comments[l]);
}
但是我得到了一个错误
Error in if (comments[l] != NA) print(comments[l]) : missing value where TRUE/FALSE needed
这里发生了什么事?
当我试图在R中的给定数据集中拟合泊松模型时,我会得到一个错误,因为我很难理解错误的原因。
library(COUNT) # Titanic dataset
data("titanic")
library(tidyverse)
# Number of missing values
titanic %>%
map_int(~sum(is.na(.)))
# Fit the Poisson regression model
poifit <- glm(survived ~ class, family = poisson, data = titanic)
我正在使用R中的snow包在具有多台机器(3)的SOCK集群上执行一个函数。我尝试用parLapply和clusterApply来运行代码。
在worker级别出现错误的情况下,worker节点的结果不会正确返回给master,这使得调试变得非常困难。我目前正在使用futile.logger独立地记录工作节点的每个心跳。看起来结果似乎是经过适当计算的。但是,当我试图在主节点上打印结果时(在收到工作节点的输出之后),我得到了一个错误,显示为Error in checkForRemoteErrors(val): 8 nodes produced errors; first error: missi
我正在尝试使用上的代码。我按照说明输入了2010年(因为没有找到2008年的链接)。但是,当我在R提示符下输入此命令时:
chartSeries3d0(TR)
我得到以下错误:
Error in if (on == "years") { : missing value where TRUE/FALSE needed
我对R比较陌生,所以有人能帮我解决这个问题吗?
下面是我的代码,下面是我得到的错误: t.test(replication$Expecatation_Factor, replication$Amused_After_centered)
#replication$Expecatation_Factor is a factor as verified by str() and class()
#replication$Amused_After_centered is an integer as verified by srt() and class() 报告的错误 Error in if (stderr < 10 * .Machine
在Dave的回答中,“为一条推特中的几条提到创建边(行)”运行了折叠脚本:
plyr::ddply(tweets, c("text"), function(x){
mention <- unlist(stringr::str_extract_all(x$text, "@\\w+"))
# some tweets do not contain mentions, making this necessary:
if (length(mention) > 0){
return(data.frame(mention = mention))
} els
当在R中执行下面的阶乘程序时,我得到了以下错误:"Error in if (num < 0) {:missing value where TRUE/FALSE needed“
fact_num = as.integer(readline("Enter the factorial number:"))
factorial = 1
if(fact_num < 0){
print("Input cannot be negative")
}else if(fact_num==0){
print("The factorial of 0
我最近更新了所有的包。现在RQuantLib加载失败。我能做什么?我已经尝试从CRAN和源文件中删除并重新安装0.3.12版本的包,但都没有帮助。
> library(RQuantLib)
Error : .onLoad failed in loadNamespace() for 'RQuantLib', details:
call: if (is.character(qc) && nchar(qc) > 1) {
error: missing value where TRUE/FALSE needed
In addition: Warning me
我试着用我的数据绘制一个树状图
dendogram <- hclust(distance)
但是遇到了这个错误代码;
Error in if (is.na(n) || n > 65536L) stop("size cannot be NA nor exceed 65536") :
missing value where TRUE/FALSE needed
我不太清楚如何解决这个问题,所以如果有人有什么想法的话,我会很感激的。请询问是否还有你需要的信息,感谢这个问题不包含太多额外的信息。以下使用的代码;
#euclidean distance matrix
dis
我刚刚开始使用R学习我正在学习的课程,它要求使用大于0的整数值(argument1),它会将值<25和>75乘以一个集合乘数(参数2),并将其他元素乘以不同的乘数(参数3)。
我已经有了之前的h和s值:
h=sample(1:100,40)
s=c()
for(i in 1:100){if(h[i]<25){s[i]<-h[i]*10}
else if(h[i]>75){s[i]<-h[i]*10}
else{s[i]<-h[i]*0.1}}
Error in if (h[i] < 25) { : missing value where TR
我为这个简单的问题提前道歉,但我已经有一段时间没有找到解决方案了。我正在尝试寻找f0和f1的最小公倍数。下面是我的代码:
f0 = 200
f1 = 300
a = f0
b = f1
r = 0
while (a!=b) {
r = a %% b
a = b
b = r
}
从这里,我得到了:
Error in while (a != b) { : missing value where TRUE/FALSE needed
我正在做一个地图项目,并在一个小叶地图(闪亮的应用程序)中绘制了两个标记的数据集。一个数据集比另一个数据集更大,我正在绘制连接多到少的大圆弧。一切都运行得很好。我将R从3.5更新到3.6,现在我得到"Error in if: missing value where TRUE/FALSE needed“,我已经将其隔离到运行大圆弧的for语句中。
硬编码值到gcIntermediate()中是可行的,但是我只能有一个固定的弧。使用值创建新的dataframe是可行的,但是从我导入的数据构建的data.frame不再有效。
# inside server.R
output$MapNet &