From p.dalgaard@biostat.ku.dk  Fri Oct 12 23:03:46 2001
From: p.dalgaard@biostat.ku.dk (Peter Dalgaard BSA)
Date: 13 Oct 2001 00:03:46 +0200
Subject: [Rd] MASS: isoMDS and sammon
In-Reply-To: <Pine.LNX.4.33.0110122336360.560-100000@kleigh.nl>
References: <Pine.LNX.4.33.0110122336360.560-100000@kleigh.nl>
Message-ID: <x2ofnc7by5.fsf@blueberry.kubism.ku.dk>

Peter Kleiweg <kleiweg@let.rug.nl> writes:

> If tbl is an object of class 'dist', you can do this:
> 
>     a <- sammon(tbl, k=3)
> 
> 
> But you can't do this:
> 
>     b <- isoMDS(tbl, k=3)
> 
> 
> Wouldn't it be sensible to have identical interfaces to sammon()
> and isoMDS() ?
> 
> I think all that would be needed is to change this:
> 
>   isoMDS <- function(d, y=cmdscale(d, 2), maxit=50, trace=TRUE)
>   {
> 
> ...into this:
> 
>   isoMDS <- function(d, y, k=2, maxit=50, trace=TRUE)
>   {
>     if(missing(y)) y <- cmdscale(d, k=k)

Actually, it should work if you simply define the arguments as 

isoMDS <- function(d, y=cmdscale(d, k), k=2, maxit=50, trace=TRUE)

Default arguments can refer to each other and even to items calculated
inside the function.

-- 
   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
_._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._


[Rd] MASS: isoMDS and sammon
Peter Dalgaard BSA