Читать книгу The Big R-Book - Philippe J. S. De Brouwer - Страница 126

4.4.5 Other Operators

Оглавление

There are of course more operators, that allow to execute common commands more efficiently or apply to certain specific objects such asmatrices. For example, we already have seen the operator : that creates a sequence. In R it is possible to define your own operators.

# +-+ # This function is a new operator # arguments: # x -- numeric # y -- numeric # returns: # x- y `+-+` <- function(x, y) x - y 5 +-+ 5 ## [1] 0 5 +-+ 1 ## [1] 4 # Remove the new operator: rm(`+-+`)

The Big R-Book

Подняться наверх