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

Logical values not handled correctly #7

Open
tkstring opened this issue Sep 8, 2016 · 3 comments
Open

Logical values not handled correctly #7

tkstring opened this issue Sep 8, 2016 · 3 comments

Comments

@tkstring
Copy link

tkstring commented Sep 8, 2016

If a single logical value is stored without encryption, it isn't recovered correctly and throws an error in line 9 of encrypt.R. I discovered this while storing a binary checkbox input value in a Shiny app. The problem is actually a bigger one with RJSONIO (I think), but it would be easily worked around on your end. A simplified version of what's going on:

> fromJSON(toJSON(list(encV=FALSE,data=FALSE)))$data
Error in fromJSON(toJSON(list(encV = FALSE, data = FALSE)))$data : $ operator is invalid for atomic vectors

As opposed to this:

> fromJSON(toJSON(list(encV=FALSE,data=FALSE)))[["data"]]
[1] FALSE

RJSONIO seems to return lists of only logicals as a named logical vector. This could be fixed by changing return(js$data) in line 9 of encrypt.R to return(js[["data"]]). Or by switching to jsonlite.

@aquacalc
Copy link

aquacalc commented Dec 5, 2016

"If a single logical value is stored without encryption..."

Just came across this today. Very good explanation. Have you found a work-around with the package as it now stands?

@tkstring
Copy link
Author

tkstring commented Dec 5, 2016

Yes, I convert the logical values to numeric for storage and then back again when retrieved.

@aquacalc
Copy link

aquacalc commented Dec 5, 2016

Of course! Thanks. (Just trying to do that now using reactiveValues().)

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