EMCluster icon indicating copy to clipboard operation
EMCluster copied to clipboard

Inst_workflow error: Error in if (class(tmp) == "try-error") { : the condition has length > 1

Open HeesooSong opened this issue 2 years ago • 3 comments

Hi, I am new to EMCluster so first trying out the example workflow. I tried all workflows, and found out that the code below cause error.

for(k.var in 1:dim(var)[3]){
      # Check degenerate.
      tmp <- try(solve(var[,, k.var]), silent = TRUE)
      if(class(tmp) == "try-error"){
        flag <- 1
        break
      }
    }

Error in if (class(tmp) == "try-error") { : the condition has length > 1

I figured out that the classes of the object tmp are "matrix" and "array", which generates the error above. For now, I avoided the error by choosing the first class (class(tmp)[1] ) to infer "try-error" but I do think this needs improvement.

HeesooSong avatar Nov 14 '22 08:11 HeesooSong

Thanks, please provide a minimum working example (MWE) so that we may find our what the source of the error is.

maitra avatar Nov 14 '22 14:11 maitra

Thanks for the reply.

I was exactly following the inst > workflow > crabs https://github.com/snoweye/EMCluster/blob/5b8526937fcf5dd9465331d9be8734d06afc43d4/inst/workflow/crabs/2-em.Rnd.r#L37

I have done nothing extra.

HeesooSong avatar Nov 18 '22 08:11 HeesooSong

Works fine for me, can not reproduce the eror.

maitra avatar Nov 18 '22 17:11 maitra