1
我是R新手,我被困在一個愚蠢的錯誤..儘管我發現了一些問題來解決我的問題,我無法解決它。錯誤while:缺少值,其中TRUE/FALSE需要
ww <- waveMC_list[[5]]
sampling=44100
thresh=10
timer.output <- timer(ww, f=sampling, threshold=thresh,envt="abs",ksmooth=kernel("daniell",100))
i=0
min.length=0.05 # minimum length of segment
segmts=length(timer.output[[4]]) # total amount of segments to evaluate
segments <- list() # output of valid segments
starts=timer.output[[4]] # starting times
ends=timer.output[[5]] # ending times
for(i in 1:segmts)
{
if(i <= segmts)
{
while(starts[i] <= ends[i]) #print(TRUE)
{
if((ends[i]-starts[i])>min.length)
{
segments[[i]] <- env(WaveMC(cutw(ww, f=44100, from= starts[i], to=ends[i],plot=F), bit= 16, samp.rate=44100)
, f=44100, ksmooth=kernel("daniell",90),plot=F)
print(paste('check', i, sep=' '))
print(segmts)
#env("ACAWAVEFILE", f=44100, ksmooth=kernel("daniell",90))
}
i=i+1
}
}
}
Error in while (starts[i] <= ends[i]) { :
缺失值,其中TRUE/FALSE所需
任何線索我怎麼能避免它? – marutonic
已經解決了!謝謝! – marutonic
不是空的,但是不適用。查看while(c())print(「hi」)和while(NA)print(「hi」)的錯誤信息是不同的。他的一個'開始[i]'或'結束[i]'必須是'NA'。 – flodel