Created
November 26, 2022 01:27
-
-
Save djnavarro/b312b6c11ca62d0b14881a459d0c66a3 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# simple R6 class | |
Random <- R6::R6Class("Random", | |
active = list(draw = function() runif(1)) | |
) | |
# instantiate the class | |
rnd <- Random$new() | |
# this calls the function | |
val <- rnd$draw | |
# this returns the function | |
fun <- activeBindingFunction("draw", rnd) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment