[R] Constructing Distance matrix for hclust

Alekseiy Beloshitskiy abeloshitskiy at velti.com
Wed Apr 4 13:23:16 CEST 2012


Hi, Vinod,

Hope this will help you:

library(RJDBC)
#specify your mysql driver
drv <- JDBC("com.vertica.Driver", "../vertica_3.5_jdk_5.jar")
# specify your connection string
conn <- dbConnect(drv, "jdbc:<postgres>://<IP>:<port>/dbname", "login", "password")
#list tables
dbListTables(conn)
#get your distances
dist<-dbGetQuery(conn, "select * from ...");


Good luck,
-Alex
________________________________________
From: r-help-bounces at r-project.org [r-help-bounces at r-project.org] on behalf of Vinod Hegde [vinod.hegde.c at gmail.com]
Sent: 27 March 2012 16:30
To: r-help at r-project.org
Subject: [R] Constructing Distance matrix for hclust

Hi,

I have similarity value between string pairs in a mysql database.
I need to construct the distance matrix which hclust can take and cluster
the strings. Most of the examples I came across show how to construct the
distance matrix using dist function.

How can I code to construct distance matrix using the data in mysql db.

Thanks a lot for any help.

        [[alternative HTML version deleted]]

______________________________________________
R-help at 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.



More information about the R-help mailing list