Skip to content

Commit

Permalink
Fix typo in "R differences" subsection
Browse files Browse the repository at this point in the history
Example Julia array has a typo and results in an error.
(cherry picked from commit 5c6fcdd)
  • Loading branch information
sbromberger authored and tkelman committed Dec 11, 2014
1 parent c92e8b5 commit 085b6b8
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion doc/manual/noteworthy-differences.rst
Original file line number Diff line number Diff line change
Expand Up @@ -117,7 +117,7 @@ One of Julia's goals is to provide an effective language for data analysis and s
- 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.
- 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.
Expand Down

0 comments on commit 085b6b8

Please sign in to comment.