Wolski
2004-May-25 15:38 UTC
[R] Object "silhouette.default" not found. But I knew that it is there.
Hi!>library(cluster)In this lib a function called silhoutte.default is defined than on the R prompt it type>silhouette.defaultError: Object "silhouette.default" not found R1.9.0 The same error are at R1.8.1 And I knew that a function silhoutte.default are present. But the same piece of code works in R1.6.2 ??? Eryk Dipl. bio-chem. Eryk Witold Wolski @ MPI-Moleculare Genetic Ihnestrasse 63-73 14195 Berlin 'v' tel: 0049-30-83875219 / \ mail: wolski at molgen.mpg.de ---W-W---- http://www.molgen.mpg.de/~wolski
Uwe Ligges
2004-May-25 16:17 UTC
[R] Object "silhouette.default" not found. But I knew that it is there.
Wolski wrote:> Hi! > > > >>library(cluster) > > In this lib a function called silhoutte.default is defined > than on the R prompt it type > >>silhouette.default > > Error: Object "silhouette.default" not found > R1.9.0 > The same error are at R1.8.1 > And I knew that a function silhoutte.default are present. > > But the same piece of code works in R1.6.2 > > ???Well, namespaces have been introduced in the meantime, and you have learned at the useR to call the generic silhouette() directly or to use cluster:::silhouette.default to get the code. Uwe Ligges> Eryk > > Dipl. bio-chem. Eryk Witold Wolski @ MPI-Moleculare Genetic > Ihnestrasse 63-73 14195 Berlin 'v' > tel: 0049-30-83875219 / \ > mail: wolski at molgen.mpg.de ---W-W---- http://www.molgen.mpg.de/~wolski > > ______________________________________________ > R-help at stat.math.ethz.ch mailing list > https://www.stat.math.ethz.ch/mailman/listinfo/r-help > PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
>>>>> "Eryk" == Eryk Wolski <wolski at molgen.mpg.de> >>>>> on Tue, 25 May 2004 17:38:10 +0200 writes:Eryk> Hi! >> library(cluster) Eryk> In this lib a function called silhoutte.default is defined Eryk> than on the R prompt it type >> silhouette.default Eryk> Error: Object "silhouette.default" not found Eryk> R1.9.0 Eryk> The same error are at R1.8.1 Eryk> And I knew that a function silhoutte.default are present. Hi Eryk, please do learn about namespaces; many good R packages (incl. all standard and recommended packages) nowadays make use of namespaces, and we expect even more in the future. One big advantage of 'namespacing a package' is that you can make sure that your functions call your other functions even if they have the same name as someone's functions in another package. Another big "pro" is that you can use as many ``package-internal'' objects {"helper-functions" in my useR talk} as you want: They won't be visible to the user and not clutter the global namespace. One side effect of namespaces: We usually do not export (S3) methods such as silhouette.default() : A user should call silhouette(...) and the method dispatching chooses the corresponding method. Now, to see "hidden" objects, you can 1) use getAnywhere() { getAnywhere("silhouette.default") } 2) use <namespace>:::<object> { cluster:::silhouette.default } and for S3 methods, 3) getS3method("<generic>", "<class>") i.e., in this case getS3method("silhouette", "default") ---------- BUT: You won't see the source code of silhouette.default ! Instead: 1) Learn how to get and unpack the package source and then see cluster/R/silhouette.R 2) if "1)" is too difficult, open the filename you get from system.file("../cluster/R/cluster") in a text editor -- preferably an R-aware one ... which gives you a large file with all R source from the cluster package. Now look for what you want. Regards, Martin Maechler <maechler at stat.math.ethz.ch> http://stat.ethz.ch/~maechler/ Seminar fuer Statistik, ETH-Zentrum LEO C16 Leonhardstr. 27 ETH (Federal Inst. Technology) 8092 Zurich SWITZERLAND phone: x-41-1-632-3408 fax: ...-1228 <><
On Tue, May 25, 2004 at 06:39:13PM +0200, Martin Maechler wrote:> please do learn about namespaces; many good R packages (incl. > all standard and recommended packages) nowadays make use of > namespaces, and we expect even more in the future.I also want to learn about namespaces. I have looked at ?":::", but I think that a tutorial-like document would help me apply and understand namespaces better. So where should I look for "a gentle introduction to namespaces", with examples, if there is such a thing? Tamas -- Tam??s K. Papp E-mail: tpapp at axelero.hu Please try to send only (latin-2) plain text, not HTML or other garbage.
Tamas Papp wrote:> On Tue, May 25, 2004 at 06:39:13PM +0200, Martin Maechler wrote: > > >>please do learn about namespaces; many good R packages (incl. >>all standard and recommended packages) nowadays make use of >>namespaces, and we expect even more in the future. >For example in R News: @Article{Rnews:Tierney:2003, author = {Luke Tierney}, title = {Name Space Management for {R}}, journal = {R News}, year = 2003, volume = 3, number = 1, pages = {2--6}, month = {June}, url = {http://CRAN.R-project.org/doc/Rnews/} } and in "Writing R Extensions". Uwe Ligges> I also want to learn about namespaces. I have looked at ?":::", but I > think that a tutorial-like document would help me apply and understand > namespaces better. So where should I look for "a gentle introduction > to namespaces", with examples, if there is such a thing? > > Tamas >