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

Warnings introduced by R 4.0 update #12

Closed
bstaton1 opened this issue Jul 14, 2020 · 1 comment
Closed

Warnings introduced by R 4.0 update #12

bstaton1 opened this issue Jul 14, 2020 · 1 comment
Labels
invalid This doesn't seem right

Comments

@bstaton1
Copy link
Owner

After updating to R 4.0, post_summ() (and other functions) return a warning about condition having length > 1 and only the first element will be used. This issue occurs on postpack version 0.2.3 (at least).

data(cjs, package = "postpack")
post_summ(cjs, "b")

Returns the output as expected, but also throws these warnings:

Warning messages:
1: In if (class(post_mat) == "numeric") { :
  the condition has length > 1 and only the first element will be used
2: In if (class(post_mat_sub) == "numeric") { :
  the condition has length > 1 and only the first element will be used
3: In if (class(post_mat_sub) == "numeric") { :
  the condition has length > 1 and only the first element will be used
@bstaton1 bstaton1 added the invalid This doesn't seem right label Jul 14, 2020
@bstaton1
Copy link
Owner Author

After further digging, I've discovered that this is a result of the class() function call, which originates in matrix2mcmclist(). Evidently, now when you run:

m = matrix(c(1,1,1,1), 2, 2)
class(m)

You will get "matrix" "array". When this result is passed to if(), it will produce the warnings above. This behavior is documented in the R 4.0.0 release notes under "Significant User-Visible Changes" (bullet 2).

This will take a little bit of fixing to make sure the if() statements only respond to one logical element throughout all functions.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
invalid This doesn't seem right
Projects
None yet
Development

No branches or pull requests

1 participant