How would you create a new r6 class?



How would you create a new r6 class?..

Answer / Pushpendra Chaturvedi

"Creating an R6 class involves using the R6 package. Here is a simple example of creating and using a new R6 class:
library(R6)
MyClass <- R6Class("my_class",
initialize = function(name) {n self$name <- namen },
print_name = function() {n print(paste("Name:", self$name))n })
my_obj <- MyClass$new(name = "John Doe")
my_obj$print_name()

Is This Answer Correct ?    0 Yes 0 No

Post New Answer

More R Programming Interview Questions

What are r matrices and r matrices functions?

1 Answers  


What is the rattle package in r?

1 Answers  


What is the function definition?

1 Answers  


Enlist the advantages of using r languages?

1 Answers  


Explain what is pdv?

1 Answers  


What is white noise model in r?

1 Answers  


What data Visualizations in R you should learn?

1 Answers  


What is the use of abline() function?

1 Answers  


How data is aggregated in r?

1 Answers  


Explain What is R?

1 Answers  


What is the of use Matrix package?

1 Answers  


How to compile and run code in R?

1 Answers  


Categories