[R] How this addition works?
Sarah Goslee
sarah.goslee at gmail.com
Thu May 28 21:59:31 CEST 2009
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.christofer at 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
More information about the R-help
mailing list