Line 201 has a bug:
f.idx <- f.idx[-which(f.idx %in% which(unm.idx))]
If no element from f.idx is in unm.idx, an empty set is returned from the which statement. And f.idx[- empty set] returns an empty set. But you would want to get f.idx instead.
This happens whenever unm.idx contains only elements that are lower than the cutoff.
Line 201 has a bug: f.idx <- f.idx[-which(f.idx %in% which(unm.idx))] If no element from f.idx is in unm.idx, an empty set is returned from the which statement. And f.idx[- empty set] returns an empty set. But you would want to get f.idx instead. This happens whenever unm.idx contains only elements that are lower than the cutoff.