diff --git a/doc/manual/noteworthy-differences.rst b/doc/manual/noteworthy-differences.rst index 3816b926f975f..6986462530bee 100644 --- a/doc/manual/noteworthy-differences.rst +++ b/doc/manual/noteworthy-differences.rst @@ -104,6 +104,8 @@ One of Julia's goals is to provide an effective language for data analysis and s - In Julia, values are passed and assigned by reference. If a function modifies an array, the changes will be visible in the caller. This is very different from R and allows new functions to operate on large data structures much more efficiently. - Concatenation of vectors and matrices is done using ``hcat`` and ``vcat``, not ``c``, ``rbind`` and ``cbind``. - A Julia range object like ``a:b`` is not shorthand for a vector like in R, but is a specialized type of object that is used for iteration without high memory overhead. To convert a range into a vector, you need to wrap the range with brackets ``[a:b]``. +- ``max``, ``min`` are the equivalent of ``pmax`` and ``pmin`` in R, but both arguments need to have the same dimensions. While ``maximum``, ``minimum`` replace ``max`` and ``min`` in R, there are important differences. +- The functions ``sum``, ``prod``, ``maximum``, ``minimum`` are different from their counterparts in R. They all accept one or two arguments. The first argument is an iterable collection such as an array. If there is a second argument, then this argument indicates the dimensions, over which the operation is carried out. For instance, let ``A=[[1 2],[3,4]]`` in Julia and ``B=rbind(c(1,2),c(3,4))`` be the same matrix in R. Then ``sum(A)`` gives the same result as ``sum(B)``, but ``sum(A,1)`` is a row vector containing the sum over each column and ``sum(A,2)`` is a column vector containing the sum over each row. This contrasts to the behavior of R, where ``sum(B,1)=11`` and ``sum(B,2)=12``. If the second argument is a vector, then it specifies all the dimensions over which the sum is performed, e.g., ``sum(A,[1,2])=10``. It should be noted that there is no error checking regarding the second argument. - Julia has several functions that can mutate their arguments. For example, it has ``sort(v)`` and ``sort!(v)``. - ``colMeans()`` and ``rowMeans()``, ``size(m, 1)`` and ``size(m, 2)`` - In R, performance requires vectorization. In Julia, almost the opposite is true: the best performing code is often achieved by using devectorized loops.