%+=% | R Documentation |
In-place addition operator
x %+=% y
x |
Object. |
y |
Another object. |
Depends on the method.
COMPANY <- new_class(class_name = "COMPANY")
company <- COMPANY$instantiate
register_method(COMPANY,
..init.. = function(name, age) {
self$name <- name
self$age <- age
})
register_method(COMPANY,
..iadd.. = function(y) {
self$name <- c(self$name, y$name)
self$age <- c(self$age, y$age)
})
good_company <- company(c("patrick", "james"),
c(33, 34))
bad_company <- company(c("pat", "jam"),
c(3, 4))
good_company %+=% bad_company
good_company$name
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.