ABSTRACT

Both MATLAB and R can work directly with vectors and with m xn matrices. Both platforms support vectorized computations, i.e., expressions that implicitly operate on entire vectors or matrices. In R, a vector is an ordered sequence of values; it is neither a row vector nor a column vector. In MATLAB, a vector is simply a special case of a matrix which has either one row or one column. R's syntax is better, since in MATLAB, v(3) could represent either the third element of vector v, or a call to a function v. When translating code from MATLAB to R, it is easy to miss places where one have forgotten to make this change. If one have a function and a vector with the same name, the error may be difficult to track down. In both MATLAB and R platforms, trying to store a value beyond the end of a vector simply grows the vector.