Bert, Jim, Dimitris and Joris,
Thank you all very much for your prompt help and suggestions.
After trying the ideas out, I have decided to go with Bert's approach
since it is by far the fastest of the lot.
Thanks again!
Rama Ramakrishnan
On Oct 8, 2009, at 12:49 PM, Bert Gunter
e a for loop stepping through each
row in d, and within the loop have another loop going through all the
rows again, checking for equality. This is quadratic in the number of
rows and takes way too long. Is there a better, "vectorized" way to do
this?
Thanks in advance!
Rama
n Thu, Jun 25, 2009 at 10:24 AM, Rama Ramakrishnan
> wrote:
> > Follow-on question: is there a way to do this for higher-dimensional
> (i.e.
> > more than 2 dimensions) arrays?
> >
> >
> > On Thu, Jun 25, 2009 at 10:17 AM, Rama Ramakrishnan >wrote:
> >
>
Thanks, David, that works too!
On Thu, Jun 25, 2009 at 10:30 AM, David Winsemius wrote:
>
> On Jun 25, 2009, at 10:24 AM, Rama Ramakrishnan wrote:
>
> Follow-on question: is there a way to do this for higher-dimensional (i.e.
>> more than 2 dimensions) arrays?
>>
>
Follow-on question: is there a way to do this for higher-dimensional (i.e.
more than 2 dimensions) arrays?
On Thu, Jun 25, 2009 at 10:17 AM, Rama Ramakrishnan wrote:
> That works!! Very nice way to do it! Thank you, Henrique!
> Rama Ramakrishnan
>
>
> On Thu, Jun 25, 2009 at 10:
That works!! Very nice way to do it! Thank you, Henrique!
Rama Ramakrishnan
On Thu, Jun 25, 2009 at 10:11 AM, Henrique Dallazuanna wrote:
> Try this:
>
> y$values <- diag(x[y$ltrs, y$mnths])
>
> On Thu, Jun 25, 2009 at 11:02 AM, Rama Ramakrishnan wrote:
>
>> Dear R
re a more efficient way (e.g., one without using an
explicit loop) to do this?
Thanks in advance!
-Rama Ramakrishnan
[[alternative HTML version deleted]]
__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEAS
s
as keys to look up
# the associated value from x
#One way to do this is with a FOR loop
for (i in 1:nrow(y)) {y$val[i] <- x[y$ltrs[i],y$mnths[i]]}
My question: Is there a more efficient way (e.g., one without using an
explicit loop) to do this?
Thanks in advance!
-R
8 matches
Mail list logo