[R] Var problem

Mark Marques mmarques at power.inescn.pt
Fri Feb 21 16:00:09 CET 2003


> Regarding a  new  problem:
> for  (i in 1:5) { z <- clara(adata, i) plot(z) }
> in the above code  in  the  plot  screen
> I get something like: clusplot(clara(x=adata,i)) as title;
>  in    the    2nd    type   of   plot   I   get
>   silhouete   plot   of clara(x=adata,k=i,samples=50)
>
>     How can I pass the real value to the i?
>     What kind of command "transform" a var into their own value ?
>     I tried using something like ~i , %i , but with no luck...
>     Comments ?
>     Any undocumented feature ?

Using eval() or quote() or substitute I get this as title in the plot:
      silhouete   plot   of clara(x=adata,k=eval(i),samples=50) or
      silhouete   plot   of clara(x=adata,k=substitute(i),samples=50)

      how can I pass the numeric value of "i" ? not i itself... ?




More information about the R-help mailing list