[R] questions on some operators in R

David Winsemius dwinsemius at comcast.net
Thu Jun 17 00:55:12 CEST 2010


On Jun 16, 2010, at 6:33 PM, li li wrote:

> Hi all,
>   I have two questions. Can some one give some help?
>
>   The first question is regarding the pair of operators "&" and  
> "&&". What
> is the
> difference between the two?

& operates on vectors, returns a vector

&& operates on the first item in each argument. Retruns a value and a  
warning if either of the arguments of of length > 1.

>
>   The second question is regarding "<-" and "=".  Usually we use
> "<-" as the assignment operator. I saw some people use "=". Is there
> any difference between the two.
>
Yes. Many discussions in the archives. will be more erudite and  
accurate than mine.  "=" is preferred for assigning values in argument  
lists. "<-" is preferred for assignment to objects.  Generally the  
differences do not matter but there are exceptions.

-- 
David.



More information about the R-help mailing list