Re: [R] How to create a dissimilarity object

2010-10-18 Thread Paul Rigor (ucla)
Thank you, but what about dissimilarity matrix objects?

Paul

On Thu, Oct 14, 2010 at 5:30 PM, Peter Langfelder 
peter.langfel...@gmail.com wrote:

 On Thu, Oct 14, 2010 at 5:21 PM, Paul Rigor (ucla) pr...@ucla.edu wrote:
  Hi all,
 
  I would like to use the fpc and cluster packages for clustering. However,
 I
  would like to create a custom dissimilarity object using a library in
  python.  Has anyone attempted or know of a work-around for creating a
  dissimilarity object from a csv file containing pair-wise distance
 measures?

 It is simple. Put the distance matrix into a csv file, read it in as

 tab = read.csv(...)

 convert to a distance as

 dst = as.dist(as.matrix(tab))

 then call your favorite clustering method.

 Here's what as.dist does on a matrix:

 mat = matrix(c(1:9), 3, 3)
 mat
 as.dist(mat)

 HTH,

 Peter




-- 
Paul Rigor
http://www.ics.uci.edu/~prigor

[[alternative HTML version deleted]]

__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


[R] How to create a dissimilarity object

2010-10-14 Thread Paul Rigor (ucla)
Hi all,

I would like to use the fpc and cluster packages for clustering. However, I
would like to create a custom dissimilarity object using a library in
python.  Has anyone attempted or know of a work-around for creating a
dissimilarity object from a csv file containing pair-wise distance measures?

Thanks in advance!
Paul

[[alternative HTML version deleted]]

__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


Re: [R] How to create a dissimilarity object

2010-10-14 Thread Peter Langfelder
On Thu, Oct 14, 2010 at 5:21 PM, Paul Rigor (ucla) pr...@ucla.edu wrote:
 Hi all,

 I would like to use the fpc and cluster packages for clustering. However, I
 would like to create a custom dissimilarity object using a library in
 python.  Has anyone attempted or know of a work-around for creating a
 dissimilarity object from a csv file containing pair-wise distance measures?

It is simple. Put the distance matrix into a csv file, read it in as

tab = read.csv(...)

convert to a distance as

dst = as.dist(as.matrix(tab))

then call your favorite clustering method.

Here's what as.dist does on a matrix:

mat = matrix(c(1:9), 3, 3)
mat
as.dist(mat)

HTH,

Peter

__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.