Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

R: Unused argument "label" in hclust

I'm using the following code to build and hierarchical cluster:

dat <- read.table(textConnection("
pdb      PA      EHSS 
1avd_model.pdb  3028.0  3920.0
1ave_model.pdb  3083.0  4019.0
1ij8_model.pdb  2958.0  3830.0
1ldo_model.pdb  2889.0  3754.0
1ldq_model.pdb  2758.0  3590.0
1lel_model.pdb  2815.0  3650.0
1vyo_model.pdb  2877.0  3740.0
2a5b_model.pdb  3145.0  4103.0
2a5c_model.pdb  3072.0  3994.0
2a8g_model.pdb  3056.0  3978.0
2avi_model.pdb  2856.0  3700.0
2c4i_model.pdb  2934.0  3795.0
2cam_model.pdb  3112.0  4053.0
2jgs.pdb    2913.0  3739.0
3fdc_model.pdb  2837.0  3666.0"), header=TRUE)

d <- dist(dat$PA, method = "euclidean")
fit <- hclust(d, method="ward", labels=dat$pdb)
plot(fit) 

But when it build the cluster I get the following error message unused argument(s) (labels = dat$pdb).

Why isn't labels working?

like image 715
Harpal Avatar asked Dec 13 '11 17:12

Harpal


2 Answers

hclust doesn't take a labels argument ... but its plot method does. Try this to see:

fit <- hclust(d, method="ward")
plot(fit, labels=dat$pdb) 
like image 133
Josh O'Brien Avatar answered Nov 20 '22 16:11

Josh O'Brien


Probably because hclust doesn't have a labels argument...

> args(hclust)
function (d, method = "complete", members = NULL) 
NULL
<environment: R_GlobalEnv>
like image 40
Tommy Avatar answered Nov 20 '22 17:11

Tommy