| To: | <s-news@lists.biostat.wustl.edu> |
|---|---|
| Subject: | another counting question |
| From: | "Leeds, Mark" <mleeds@mlp.com> |
| Date: | Sun, 29 Aug 2004 23:57:29 -0400 |
| Thread-index: | AcSORXh0iqAB3PdGR1q9T1gZKaudGg== |
| Thread-topic: | another counting question |
|
thank you to all the
people who wrote
back to me about my
counting question.
basically, everyone
gave variants of a similar solution
which was to use the
function in Splus called table().
now, i have a
somewhat more difficult question.
i'm sorry to bother
everyone with so
many questions but i
think this will
be my last one for a
while.
i have one vector
that is a list of strings.
say
c("AAA","BBB","CCC","BBB","CCC")
and another vector
that is a list of numbers
that is the same
length as the vector above.
so it might
be
c(0.10,0.20,0.34,0.50,0.60)
so, given the string
vector above,i would want to return
0.1, 0.7, 0.94, 0.7,
0.94 as the resulting vector.
in other words,
whenever the strings are the same,
it should add those
numbers up and put them
in the corresponding
position. i don't think table can be used
here but maybe there
is some other function that does this ?
if making the string
vector the names of the columns of
the number vector
helps accomplish the task, that
is fine. i just
don't want to loop.
thanks
mark
|
| <Prev in Thread] | Current Thread | [Next in Thread> |
|---|---|---|
| ||
| Previous by Date: | cluster simulation, Gerald E Bove Jr |
|---|---|
| Next by Date: | Re: another counting question, Bill.Venables |
| Previous by Thread: | cluster simulation, Gerald E Bove Jr |
| Next by Thread: | Re: another counting question, Bill.Venables |
| Indexes: | [Date] [Thread] [Top] [All Lists] |