kleiweg@let.rug.nl
2001-Oct-12 21:36 UTC
[Rd] Unable to use names() to set names on a 'dist' object (PR#1129)
I am unable to set the names on a 'dist' object using the function names()> require(mva)Loading required package: mva [1] TRUE> a <- matrix(nrow=3, ncol=3) > a[row(a) > col(a)] <- 1:3 > b <- as.dist(a) > names(b) <- c("X", "Y", "Z")Error in "names<-.dist"(*tmp*, value = c("X", "Y", "Z")) : unused argument(s) (value ...)> attr(b, "Labels") <- c("X", "Y", "Z") > names(b)[1] "X" "Y" "Z"> bX Y Y 1 Z 2 3 --please do not edit the information below-- Version: platform = i586-pc-linux-gnu arch = i586 os = linux-gnu system = i586, linux-gnu status major = 1 minor = 3.1 year = 2001 month = 08 day = 31 language = R Search Path: .GlobalEnv, package:mva, package:ctest, Autoloads, package:base -.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.- r-devel mailing list -- Read http://www.ci.tuwien.ac.at/~hornik/R/R-FAQ.html Send "info", "help", or "[un]subscribe" (in the "body", not the subject !) To: r-devel-request@stat.math.ethz.ch _._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._
Peter Dalgaard BSA
2001-Oct-12 21:55 UTC
[Rd] Unable to use names() to set names on a 'dist' object (PR#1129)
kleiweg@let.rug.nl writes:> I am unable to set the names on a 'dist' object using the > function names()Yup, that's a bug. I wonder how long it has been around. The function definition is> get("names<-.dist")function (d, n) { if (length(n) != attr(d, "Size")) stop("invalid names for dist object") attr(d, "Labels") <- n d } but the value is passed as a named argument called "value", and it has been like that for ages. The fix is obvious: replace "n" with "value" (3 times). -- O__ ---- Peter Dalgaard Blegdamsvej 3 c/ /'_ --- Dept. of Biostatistics 2200 Cph. N (*) \(*) -- University of Copenhagen Denmark Ph: (+45) 35327918 ~~~~~~~~~~ - (p.dalgaard@biostat.ku.dk) FAX: (+45) 35327907 -.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.- r-devel mailing list -- Read http://www.ci.tuwien.ac.at/~hornik/R/R-FAQ.html Send "info", "help", or "[un]subscribe" (in the "body", not the subject !) To: r-devel-request@stat.math.ethz.ch _._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._