MultiK
MultiK copied to clipboard
Function findOptK cannot find optimal K if there are slope = 0 in tog
Error in if (lineseg.df.sub[lineseg.df.sub$p1 == which.k2 | lineseg.df.sub$p2 == :
argument is of length zero
I was running DiagMultiKPlot and ran into the error as described in the title.
Please change the following code in MultiK_Helper.R, line 223 from
# step 2: see if a line segment with negative slope coming out
if ( all(lineseg.df[lineseg.df$p1==which.k | lineseg.df$p2==which.k, ]$slope > 0) ) {
optK <- which.k
}
else {
to
# step 2: see if a line segment with negative slope coming out
if ( all(lineseg.df[lineseg.df$p1==which.k | lineseg.df$p2==which.k, ]$slope >= 0) ) {
optK <- which.k
}
else {
I think this will fix the issue. But without detailed annotation of the script, it's hard to understand what is the correct way to actually solve the issue.
Best, Feiyang.