%-=%.bandicoot_oop {bandicoot}R Documentation

S3 method of in-place subtraction operator of a bandicoot_oop object

Description

This function performs the in-place subtraction operator using the ..iadd..() method. If it is not applicable, error will be raised.

Usage

## S3 method for class 'bandicoot_oop'
x %-=% y

Arguments

x

bandicoot_oop object.

y

Another object.

Value

Depends on the method.

Examples

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,
                ..isub.. = function(y) {
                  self$age <- self$age[self$name != y]
                  self$name <- self$name[self$name != y]
                })

good_company <- company(c("patrick", "james"),
                        c(33, 34))
good_company %-=% "patrick"
good_company$name


[Package bandicoot version 1.0.0 Index]