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

4.3.3.1 Vector Arithmetic

Оглавление

The standard behaviour for vector arithmetic in R is element per element. With “standard” we mean operators that do not appear between percentage signs (as in %.% for example).

v1 <- c(1,2,3) v2 <- c(4,5,6) # Standard arithmetic v1 + v2 ## [1] 5 7 9 v1 - v2 ## [1] -3 -3 -3 v1 * v2 ## [1] 4 10 18

The Big R-Book

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