Skip to content
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

mcell_mc_hierarchy while condition #84

Open
baj12 opened this issue Mar 5, 2023 · 1 comment
Open

mcell_mc_hierarchy while condition #84

baj12 opened this issue Mar 5, 2023 · 1 comment

Comments

@baj12
Copy link

baj12 commented Mar 5, 2023

In the mcell_mc_hierachy function you are using (around line 108 of mc_hierarchy.r)

while (j != -1 & cells[j] < mincells) {

I got the following error message:

Error in while (j != -1 & cells[j] < mincells) { : 
  the condition has length > 1

changing the code to

while (j != -1 && cells[j] < mincells) {

resolved the issue.

This happens when j==-1 and cells is a vector of length >1. The "&" evaluates all conditions, while "&&" would break already if the first is not met and also compare only the first incident of cells.

It would be great if you could comment on why you chose the "&" instead of "&&"

Thanks for your great tool.

@pujaltes
Copy link
Contributor

pujaltes commented Apr 3, 2023

The issue is the new version of R (>4.2) now results in an error when passing multiple conditions. Previously you would only get a warning.

See: https://stackoverflow.com/questions/72090706/new-error-no-first-element-being-used-when-condition-has-length-1

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants