PyClass | R Documentation |
Create a python class
PyClass(classname, defs = list(), inherit = NULL)
classname |
Name of the class. The class name is useful for S3 method dispatch. |
defs |
A named list of class definitions - functions, attributes, etc. |
inherit |
A list of Python class objects. Usually these objects have
the |
## Not run:
Hi <- PyClass("Hi", list(
name = NULL,
`__init__` = function(self, name) {
self$name <- name
NULL
},
say_hi = function(self) {
paste0("Hi ", self$name)
}
))
a <- Hi("World")
## End(Not run)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.