s-news
[Top] [All Lists]

simple arithmetic?

To: <s-news@lists.biostat.wustl.edu>
Subject: simple arithmetic?
From: "Manoel Pacheco" <mpacheco@glec.com>
Date: Wed, 19 Apr 2006 15:07:04 -0400
Organization: GLEC
My question follows a recent thread on code to compute pairwise differences
between elements of a group. The final code, suggested by Dimitris
Rizoupolos building on the script proposed by Marcus Hudec was:

unlist(tapply(A$Values, A$Group, function(x) { out <- outer(x, x,
"-"); - out[lower.tri(out)] }))

where A was a sample data frame

A <- data.frame(Group = rep(1:2,c(3,5)), Values = sample(1:8))

My goal is very similar, I wish to develop code to compute pairwise ratios
between elements of DISTINCT groups, yet I am struggling to adapt the code
for my needs. In particular, I have not been able to implement the
appropriate index to promote ratios among elements of different groups.

I would appreciate help on this subject.

Thanks,
                Manolo



<Prev in Thread] Current Thread [Next in Thread>
  • simple arithmetic?, Manoel Pacheco <=