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

Bug in check_pic_stat caused by R 4.2-3 handling of || #29

Open
rhiannon-schembri opened this issue Aug 20, 2024 · 0 comments
Open

Bug in check_pic_stat caused by R 4.2-3 handling of || #29

rhiannon-schembri opened this issue Aug 20, 2024 · 0 comments

Comments

@rhiannon-schembri
Copy link

Hi,
Just found a bug in check_pic_stat due to recent R version updates - new way of handling || boolean.
If "stats" is not NULL and length>1 (which happens any time there is a list of unit trees used in caluclate_pic_stat ), it throws this error:

Error in names(stats) == "" || length(stats) == 0 :
'length = 6' in coercion to 'logical(1)'

Think I have fixed it by adding an additional any() to the first else if() statement, ie:

check_pic_stat <- function (stats)
{
if (is.null(stats))
stats <- default_pic_stat()
else if (!is.list(stats) || is.null(names(stats)) || any(any(names(stats) ==
"" )|| length(stats) == 0))
stop("'stats' must be a named list with at least one element")
else if (!all(sapply(stats, is.function)))
stop("All elements of stats must be functions")
stats
}

But please fix in any future releases.

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

1 participant