title: R reference (documentation, specification)
body: <p>Is there a specification of R language that covers it?</p>
  
  <p>For example I wanted to know what happens if you multiply a matrix and a vector (possibly transposed), the other way around. Using the standard <code>*</code> operator, not the <code>%*%</code> matrix multiplication. (Is it commutative?) I know I could find the specification of the behaviour for python or c++, but R?</p>
  
  <p>One thing I found:</p>
  
  <p><a href="https://cran.r-project.org/doc/manuals/r-release/R-lang.html#Operators" rel="nofollow noreferrer">https://cran.r-project.org/doc/manuals/r-release/R-lang.html#Operators</a></p>
  
  <blockquote>
    <p>[...] adding two vectors of the same length will create a vector containing the <strong>element-wise</strong> sums, implicitly looping over the vector index. This applies also to other operators like -, <strong>*</strong>, and / as well as to <strong>higher dimensional</strong> structures. Notice in particular that multiplying two matrices does not produce the usual matrix product.</p>
  </blockquote>
  
  <p>Then:</p>
  
  <blockquote>
    <p>[...] (matrix+matrix, dimensions must match. vector+matrix: first recycle, then check if dims fit, error if not)</p>
  </blockquote>
  
  <p>I'm trying to decode what <code>first recycle, then check if dims fit</code> means.
  Should the vector multiply rows of the matrix, or columns? Why should it check if some dims fit when it is recycled? </p>
  
  <p>Like <em>first</em> check if #rows of the matrix is a multiple of the length of the vector? Or #rows times #cols is a multiple of length(vector)?</p>
  
  <p>It does not seem as <em>the</em> specification though as it does not (?) answer such a basic question.</p>