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

Warning – Element-wise operations in R

Оглавление

While the result of the sum will not surprise anyone, the result of the multiplicationmight come as a surprise for users of matrix oriented software such as Mathlab or Octave for example. In R an operations is always element per element – unless explicitly requested. For example, the dot-product can be obtained as follows.

v1 %*% v2 ## [,1] ## [1,] ss 68

The Big R-Book

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