-
Notifications
You must be signed in to change notification settings - Fork 42
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
asJSON() fails on "vctrs_vctr" objects when posterior
package is loaded
#408
Comments
Very weird. It seems to run in an infinite where The problem is probably that the posterior package redefines vctrs_vec to be a list? But I don't understand why this happens. |
Yeah I think so too. When something is declared to be a list, but acts as an atomic vector, jsonlite has problems with it. Rightfully so I guess. Although maybe there is a good way to check for this? Here Hadley writes that Because clearly here |
I took a look and I agree with your diagnostics. Vectors of class
@mjskay I saw that you added the |
Looks like you've solved this issue but I thought I'd check on this -
@lionel- do you think posterior should be using something like |
@mjskay I'm not sure this is better because then
Would the following work for you? This way you're not declaring anything about our vctrs classes: setOldClass("rvar") Just guessing as I don't know much about S4 either. |
@lionel- moving the rvar / vctrs_vctr conversation to {posterior} so the jsonlite folks don't have to listen: stan-dev/posterior#267 |
Code to reproduce
As a consequence (and a real reason I'm reporting this), this makes
googledrive::drive_upload()
fail whenposterior
is loaded.The above will fail because
gd_id
is an object with classes:c("drive_id", "vctrs_vctr", "character")
and at some point along the waydrive_upload()
needs to write this object as a json.I'm not sure whether it's a purely
jsonlite
bug or is itposterior
doing something wrong and unconventional so please let me know if I should create an issue in theposterior
repo. But I suppose either way this can be handled injsonlite
?The text was updated successfully, but these errors were encountered: