R recycles the shorter one to match the longer one:

1  2  3  4  5  6  7  8  9 10
+
1  2  1  2  1  2  1   2  1   2
=
2  4  4  6  6  8  8 10 10 12

R does this recycling in many cases, and it can sometimes trap the
unwary.

Sarah

On Thu, May 28, 2009 at 4:00 PM, bogaso.christofer
<bogaso.christo...@gmail.com> wrote:
> I have following addition :
>
>
>
>> 1:2 + 1:10
>
>  [1]  2  4  4  6  6  8  8 10 10 12
>
>
>
> I could not understand how R adding those two unequal vector? Any help?
>




-- 
Sarah Goslee
http://www.functionaldiversity.org

______________________________________________
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.

Reply via email to