I encountered the following in R:
x=x+y%o%c(1.5,1.5)
I am wondering what is the meaning of %o%
here. I tried googling but didn't have much luck
I encountered the following in R:
x=x+y%o%c(1.5,1.5)
I am wondering what is the meaning of %o%
here. I tried googling but didn't have much luck
An intuition.
%o%
is outer product, look at the example, it returns a matrix.a[1] * b
is the first row of matrix,a[2] * b
is the second row of the matrix.There are a number of shortcuts in R that use the
%...%
notation.%o%
is the outer product of arraysThere are a number of others, my most used is
%in%
:There are a few others, I don't know them all off the top of my head. But when you encounter them, you can check for documentation by using backticks around the
%o%
like?`%o%`
, or quotes?'%o%'
(or?"%o%"
).They are obviously difficult to google because of the percent sign.