gt; >>> #4 12 10 6 0
> >>> which(dist(x)==min(dist(x)))
> >>> #[1] 1
> >>> A.K.
> >>
> >>Yes, but you need to set the diagonal to NA, or something -- the
> >OP
> >> doesn't want to include self-comparison. It also
On 13-09-11 07:06 PM, Ben Harrison wrote:
> If I were Michael (OP) right now, I think my head would be spinning.
>
> As a newbie myself, I know how hard it is to read R code for the first
> time, so could it also be part of the newsgroup etiquette to at least
> partially explain provided code to n
to use
>> arr.ind=TRUE in which(). You're right that dist() would be a hair
>more
>> efficient that outer(...), though
>>
>>>
>>>
>>>
>>> - Original Message -
>>> From: Ben Bolker
>>> To: r-h...@stat.math.
Michael Budnick snet.net>
To: r-help r-project.org
Cc:
Sent: Tuesday, September 10, 2013 4:06 PM
Subject: [R] Subtracting elements of a vector from each other stepwise
I am trying to figure out how to create a loop that will take the
difference of each member of a vector from each other and also
r-help@r-project.org
Cc:
Sent: Tuesday, September 10, 2013 4:06 PM
Subject: [R] Subtracting elements of a vector from each other stepwise
I am trying to figure out how to create a loop that will take the
difference of each member of a vector from each other and also spit out
which one has the least diffe
I am trying to figure out how to create a loop that will take the
difference of each member of a vector from each other and also spit out
which one has the least difference.
I do not want the vector member to subtract from itself or it must be able
to disregard the 0 obtained from subtracting from
gt; From: Michael Budnick snet.net>
> To: r-help r-project.org
> Cc:
> Sent: Tuesday, September 10, 2013 4:06 PM
> Subject: [R] Subtracting elements of a vector from each other stepwise
>
> I am trying to figure out how to create a loop that will take the
> difference of e
>
>
> - Original Message -
> From: Ben Bolker
> To: r-h...@stat.math.ethz.ch
> Cc:
> Sent: Tuesday, September 10, 2013 5:39 PM
> Subject: Re: [R] Subtracting elements of a vector from each other stepwise
>
> arun yahoo.com> writes:
>
>>
>>
:
Sent: Tuesday, September 10, 2013 5:39 PM
Subject: Re: [R] Subtracting elements of a vector from each other stepwise
arun yahoo.com> writes:
>
> Hi,
> Not sure this is what you wanted:
>
> sapply(seq_along(x), function(i) {x1<- x[i]; x2<- x[-i];
x3<-x2[whi
9 matches
Mail list logo