Skip to content

[BUG] Error in if (final_annotations[[cluster_id]] != discussion_results_map[[cluster_id]]) { : 需要TRUE/FALSE值的地方不可以用缺少值 此外: There were 50 or more warnings (use warnings() to see the first 50) [BUG] Error in if (final_annotations[[cluster_id]] != discussion_results_map[[cluster_id]]) { : cannot use NA/NaN/Inf in 'if' comparisons Additionally: There were 50 or more warnings (use warnings() to see the first 50) #5

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
jiadalidu opened this issue Apr 24, 2025 · 5 comments
Labels
bug: fixed Bug fixed in latest update. 此错误已在最新更新中解决 bug: R Issues in the R package. R包中的错误或问题

Comments

@jiadalidu
Copy link

jiadalidu commented Apr 24, 2025

Bug Description

在计算consensus_results 到最后,会报以下错误:
Error in if (final_annotations[[cluster_id]] != discussion_results_map[[cluster_id]]) { :
需要TRUE/FALSE值的地方不可以用缺少值
此外: There were 50 or more warnings (use warnings() to see the first 50)

请问该如何解决呢?

Reproduction Steps

Expected Behavior

Actual Behavior

Environment Information

  • mLLMCelltype Version:
  • Language:
  • Language Version:
  • Operating System:
  • Used LLM Models:

Error Messages/Logs

<!-- Please paste any error messages or log output here -->

Additional Context

Possible Solution

Bug Description

At the end of calculating consensus_results, the following error is reported:

Error in if (final_annotations[[cluster_id]] != discussion_results_map[[cluster_id]]) { :

Missing values where TRUE/FALSE needed

Additionally: There were 50 or more warnings (use warnings() to see the first 50)

How can this be resolved?

Reproduction Steps

Expected Behavior

Actual Behavior

Environment Information

  • mLLMCelltype Version:

  • Language:

  • Language Version:

  • Operating System:

  • Used LLM Models:

Error Messages/Logs


<!-- Please paste any error messages or log output here -->

Additional Context

Possible Solution

@jiadalidu jiadalidu added the bug label Apr 24, 2025
@cafferychen777
Copy link
Owner

Hello @jiadalidu,

Thank you for reporting this issue. To help debug the problem, could you please share your complete code that's causing this error?

The error message indicates that there's a missing value (NA or NULL) being used in a conditional comparison:

Error in if (final_annotations[[cluster_id]] != discussion_results_map[[cluster_id]]) { : 需要TRUE/FALSE值的地方不可以用缺少值

This typically happens when one of the values being compared is NA or NULL. R requires explicit handling of missing values in conditional statements.

Without seeing your exact code and data, I can't pinpoint the exact issue, but I suspect either:

  1. Some values in final_annotations or discussion_results_map are NA/NULL
  2. The cluster_id might be missing from one of the data structures

Could you please provide:

  1. The complete code you're running
  2. A sample of the data structures involved (if possible)
  3. The full warning messages (using warnings())

This will help me identify and resolve the issue more effectively.

Best regards,
Chen

@cafferychen777
Copy link
Owner

Hellohello@jiadalidu,

我是这个包的开发者。请问您遇到的问题解决了吗?根据您描述的错误信息:

Error in if (final_annotations[[cluster_id]] != discussion_results_map[[cluster_id]]) { : 需要TRUE/FALSE值的地方不可以用缺少值

这通常是因为比较语句中出现了 NA 或 NULL 值导致的。在 R 中,条件语句需要确保返回明确的 TRUE/FALSE 值,而不能有缺失值。

如果您的问题还没有解决,为了更方便地帮助您,您可以直接加我微信 yycccc1217,这样我能更直接地了解您的具体情况并提供解决方案。

希望能尽快帮您解决这个问题!

@cafferychen777
Copy link
Owner

Hello 大家,

这个问题的根本原因是在使用LLM(大语言模型)返回回复时遇到网络不稳定或LLM没有按照规定格式输出时的rollback机制导致的。我在前几天已经修复了这个问题。如果您或其他用户仍然遇到此问题,请使用Github force更新R包到最新的1.1.5版本。

更新R包的方法是:

remotes::install_github("cafferychen777/mLLMCelltype", force = TRUE, subdir = "R")

这个新版本增强了对LLM返回结果的错误处理,即使在网络不稳定或格式不正确的情况下也能正常运行。

如果更新后仍有问题,请提供更多信息,包括:

  1. 您正在运行的完整代码
  2. 所使用的数据结构样本
  3. 完整的警告信息(使用warnings()获取)

这样我可以更好地帮助您定位和解决问题。

@cafferychen777
Copy link
Owner

Hello everyone,

The root cause of this issue is due to the rollback mechanism encountered when using LLM (Large Language Model) to return responses during network instability or when the LLM does not output in the specified format. I have fixed this issue a few days ago. If you or other users still encounter this problem, please use Github to force update the R package to the latest version 1.1.5.

The method to update the R package is:

remotes::install_github("cafferychen777/mLLMCelltype", force = TRUE, subdir = "R")

This new version enhances the error handling of LLM return results, allowing it to run normally even under unstable network conditions or incorrect formats.

If there are still issues after the update, please provide more information, including:

  1. The complete code you are running

  2. A sample of the data structure used

  3. Complete warning messages (obtained using warnings())

This will help me better assist you in locating and resolving the issue.

@cafferychen777 cafferychen777 changed the title [BUG] Error in if (final_annotations[[cluster_id]] != discussion_results_map[[cluster_id]]) { : 需要TRUE/FALSE值的地方不可以用缺少值 此外: There were 50 or more warnings (use warnings() to see the first 50) [BUG] Error in if (final_annotations[[cluster_id]] != discussion_results_map[[cluster_id]]) { : 需要TRUE/FALSE值的地方不可以用缺少值 此外: There were 50 or more warnings (use warnings() to see the first 50) [BUG] Error in if (final_annotations[[cluster_id]] != discussion_results_map[[cluster_id]]) { : cannot use NA/NaN/Inf in 'if' comparisons Additionally: There were 50 or more warnings (use warnings() to see the first 50) Apr 28, 2025
@cafferychen777 cafferychen777 added bug: R Issues in the R package. R包中的错误或问题 bug: fixed Bug fixed in latest update. 此错误已在最新更新中解决 and removed bug labels Apr 28, 2025
@jiadalidu
Copy link
Author

感谢,更新完,成功运行了
Thanks, updated and running successfully!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug: fixed Bug fixed in latest update. 此错误已在最新更新中解决 bug: R Issues in the R package. R包中的错误或问题
Projects
None yet
Development

No branches or pull requests

2 participants