We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
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
I want to add a new public element with a value NULL in an R6Class using obj$set.
NULL
obj$set
Intuitively I would do
obj$set('public','foo',NULL)
But the way obj$set is written if I want to add a new element with NULL value it is removed from the group list
R6/R/generator_funs.R
Line 70 in bb56213
Simple <- R6::R6Class("Simple", public = list( x = 1, getx = function() self$x ) ) Simple$set('public','foo',NULL) Simple$public_fields #> $x #> [1] 1
Created on 2018-09-24 by the reprex package (v0.2.1)
It would need to be
value <- list(NULL) self[[group]][name] <- value
If I put in obj$set('public','foo',list(NULL)) then I get back a list object which is not what I intended.
obj$set('public','foo',list(NULL))
Simple <- R6::R6Class("Simple", public = list( x = 1, getx = function() self$x ) ) Simple$set('public','foo',list(NULL)) Simple$public_fields #> $x #> [1] 1 #> #> $foo #> $foo[[1]] #> NULL
Is there a way to do this now that I can't see?
The text was updated successfully, but these errors were encountered:
I agree that would make more sense for Simple$set('public', 'foo', NULL) to set foo to NULL than it would to remove foo. I'll make that change.
Simple$set('public', 'foo', NULL)
foo
Sorry, something went wrong.
1c1f425
No branches or pull requests
I want to add a new public element with a value
NULL
in an R6Class usingobj$set
.Intuitively I would do
But the way
obj$set
is written if I want to add a new element with NULL value it is removed from the group listR6/R/generator_funs.R
Line 70 in bb56213
Created on 2018-09-24 by the reprex package (v0.2.1)
It would need to be
If I put in
obj$set('public','foo',list(NULL))
then I get back a list object which is not what I intended.Created on 2018-09-24 by the reprex package (v0.2.1)
Is there a way to do this now that I can't see?
The text was updated successfully, but these errors were encountered: