c: r-help@r-project.org
> Subject: Re: [R] functions applied to two vectors
>
>
> On 24/10/2007, at 4:15 PM, Anya Okhmatovskaia wrote:
>
> > Hi,
> >
> > I am very new to R, so I apologize if I have missed some
> trivial thing
> > in the manuals/archives.
> a <- c(2, 3, 7, 5)
> b <- c(4, 7, 8, 9)
> mapply(seq, a, b)
[[1]]
[1] 2 3 4
[[2]]
[1] 3 4 5 6 7
[[3]]
[1] 7 8
[[4]]
[1] 5 6 7 8 9
> mapply(sum, a, b)
[1] 6 10 15 14
>
hope this helps,
Tony Plate
Anya Okhmatovskaia wrote:
> Hi,
>
> I am very new to R, so I apologize if I have missed
On 24/10/2007, at 4:15 PM, Anya Okhmatovskaia wrote:
> Hi,
>
> I am very new to R, so I apologize if I have missed some trivial
> thing in
> the manuals/archives. I am trying to get rid of for loops in my
> code and
> replace them with R vector magic (with no success).
>
> Let's say I have 2
Hi,
I am very new to R, so I apologize if I have missed some trivial thing in
the manuals/archives. I am trying to get rid of for loops in my code and
replace them with R vector magic (with no success).
Let's say I have 2 vectors of the same length:
a <- c(2, 3, 7, 5)
b <- c(4, 7, 8, 9)
What I'd
4 matches
Mail list logo