[R] summarize rows in a matrix differing only in one value

Rainer Tischler rainer_t62 at yahoo.de
Thu Oct 30 17:04:36 CET 2008


MIME-Version: 1.0
Content-Type: text/plain; charset=utf-8
Content-Transfer-Encoding: quoted-printable

Hi,=0A=0AI'd like to replace rows in a matrix which differ only in their va=
lues for one numerical column ("Vx") by a single row in which the value for=
 Vx is replaced by the median of Vx in the original rows. Vx is always the =
same column.=0ASo far, I got the reduced matrix without the Vx-column using=
:=0A=0Areduced_mat <- unique(original_mat[,-indVx])=0A=0Awhere "indVx" stan=
ds for the number of the Vx-column. Now I still need to get the column with=
 the corresponding medians for the unified entries. How can I do this effic=
iently (i.e. without for-loops, etc.)?=0A=0AMany thanks in advance,=0ARaine=
r=0A=0AWikipediaWictionaryChambers (UK)Google imagesGoogle defineThe Free D=
ictionaryJoin exampleWordNetGoogleUrban DictionaryAnswers.comrhymezone.comM=
erriam-Webster<>0=0Awvcidfjoguarm=0A=0A=0A



More information about the R-help mailing list