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

Syntactic error in if(...) {...} else {...} code in bruSDM_predict #13

Closed
RRTogunov opened this issue Apr 23, 2024 · 2 comments
Closed

Comments

@RRTogunov
Copy link

Line comment: 23d5067#r141274248

I think all the "else" statements in bruSDM_predict.R should all be on the previous line. At least on my system/R version, I cannot have a line of code start with an else. For example, the theoretical code

if(FALSE) {"Yes"}
else {"No"}

returns Error: unexpected 'else' in " else". instead, it would have to be

if(FALSE) {
   "Yes"
} else {
    "No"
}

I get that error on Line 118, which should be } else {. similarly, line 126 should be

if (is.null(species)) {
    speciesin <- unique(unlist(object[['species']][['speciesIn']]))
} else {
    speciesin <- species`
}

This seems to be an issue with every instance of else in this file.

@RRTogunov
Copy link
Author

RRTogunov commented Apr 25, 2024

Update:
Turns out, when its only an issue (i.e., returns unexpected 'else' in " else" error) when executing the code in debugging/browser mode, but it's fine when run as a function, so feel free to delete this since it's a stylistic choice.

@PhilipMostert
Copy link
Owner

PhilipMostert commented Apr 29, 2024

Thanks for checking this. Maybe not the best coding practices, but maybe I'll keep it as is if it works.

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