[R] Extracting metadata information to corresponding dissimilarity matrix

Jeff Newmiller jdnewmil at dcn.davis.ca.us
Tue May 16 15:47:51 CEST 2017

Hello R Beginner...

It is good that you are articulate, but R code has subtleties that words miss, so you really need to provide sample code and sample data to convey where you are.  This is not necessarily easy, but it avoids a lot of us fixing the wrong problem and you might even solve your own problem in the course of making a simple example. Help with doing this is available on the Web [1] [2].

I suspect that the reshape function or one of the many alternative packages like reshape2 or tidyr are what you are looking for. 

You also need to read the Posting Guide, which among other things mentions that this is a plain text mailing list. It is up to you to figure out how to adjust your email program to send only plain text, but if you don't we may not be able to read your garbled code and may ignore you.

[1] http://stackoverflow.com/questions/5963269/how-to-make-a-great-r-reproducible-example

[2] http://adv-r.had.co.nz/Reproducibility.html

Sent from my phone. Please excuse my brevity.

On May 16, 2017 2:30:30 AM PDT, "Rune Grønseth" <nielsenrune at me.com> wrote:
>I am R beginner. I've tried googling and reading, but this might be too
>simple to be found in the documentation. 
>I have a dissimilarity index (symmetric matrix) from which I have
>extracted the unique values using the exodist package command "lower".
>There are 14 observations, so there are 91 unique comparisons.
>After this I'd like to extract corresponding metadata from a separate
>data frame (the 14 observations organized in rows identified by a
>samplenumber-vector, and other variables as gender, age, et cetera).
>The aim is to have a new data frame with 91 rows and metadata vectors
>giving me the value of the dissimilarity index,  gender each of the two
>observations that are compared by the dissimilarity metric. So if I'm
>looking for gender differences, I need 5 vectors in the data frame:
>samplenumber1, samplenumber2, gender1, gender2 and dissimilarity
>Does anyone have suggestions or experiences in reformatting data in
>this manner? This is just a test-dataset. My full data-set is for more
>than 100 observations, so I need a more general code, if that is
>With great appreciation of any help.
>Rune Grønseth 
>Rune Grønseth, MD, PhD, postdoctoral fellow
>Department of Thoracic Medicine
>Haukeland University Hospital
>N-5021 Bergen
>	[[alternative HTML version deleted]]
>R-help at r-project.org mailing list -- To UNSUBSCRIBE and more, see
>PLEASE do read the posting guide
>and provide commented, minimal, self-contained, reproducible code.

More information about the R-help mailing list