I am new to R. Trying to find out how lda() {in MASS R1.8.0 Windows} was implemented in R. Does anyone know where to find out lda source code ? Thanks. Wei
Wei Geng wrote:> I am new to R. Trying to find out how lda() {in MASS R1.8.0 Windows} was > implemented in R. Does anyone know where to find out lda source code ? > Thanks.Here: http://cran.r-project.org Hint: MASS is a *package*. You want to view its *source*. Same with most other R packages. Or just about anything else you want to know about R. Cheers Jason -- Indigo Industrial Controls Ltd. http://www.indigoindustrial.co.nz 64-21-343-545 jasont at indigoindustrial.co.nz
Consider the following: > library(MASS) > lda function (x, ...) UseMethod("lda") <environment: namespace:MASS> > methods(lda) [1] "lda.data.frame" "lda.default" "lda.formula" "lda.matrix" Now type "lda.data.frame" or "lda.default", etc., at a command prompt to see the corresponding R code. Is this what you want? spencer graves Wei Geng wrote:>I am new to R. Trying to find out how lda() {in MASS R1.8.0 Windows} was >implemented in R. Does anyone know where to find out lda source code ? >Thanks. > >Wei > >______________________________________________ >R-help at stat.math.ethz.ch mailing list >https://www.stat.math.ethz.ch/mailman/listinfo/r-help > >
Wei Geng wrote:> Does anyone know where to find out lda source code ?Try typing lda.default at the prompt. That should get you started. Also see: > methods(lda) as lda.default isn't the only bit of code used in lda() Alternatively, grab the source from CRAN and read it at your leisure. HTH Gav -- %~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~% Gavin Simpson [T] +44 (0)20 7679 5522 ENSIS Research Fellow [F] +44 (0)20 7679 7565 ENSIS Ltd. & ECRC [E] gavin.simpson at ucl.ac.uk UCL Department of Geography [W] http://www.ucl.ac.uk/~ucfagls/cv/ 26 Bedford Way [W] http://www.ucl.ac.uk/~ucfagls/ London. WC1H 0AP. %~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%
Wei Geng, I asked the same question about six weeks ago, so let me try to answer it. The source for the entire package 'MASS' is in a single file, I believe (at least this is true on my Linux setup). The exact location of that file you'll have to determine by searching the directory/folder where you installed it. The function 'lda' is implemented entirely in R itself, like much of its functionality. Look at the functions 'lda' and 'predict.lda' in this file for details. Comments are sparse in most R code, from what I gather, but if you look in "Pattern Recognition and Neural Networks" by Brian Ripley (one of the authors of this package), you'll find a discussion in section 2.4 'Predictive classification' that covers much of what's going on, from what I've been able to glean. I hope that helps. There are certainly others out there who are more au fait with this than me. -Frank Gibbons At 05:47 PM 10/1/2003, you wrote:>Wei Geng wrote: > >>I am new to R. Trying to find out how lda() {in MASS R1.8.0 Windows} was >>implemented in R. Does anyone know where to find out lda source code ? >>Thanks. > >Here: > >http://cran.r-project.org > >Hint: MASS is a *package*. You want to view its *source*. > >Same with most other R packages. Or just about anything else you want to >know about R. > >Cheers > >Jason >-- >Indigo Industrial Controls Ltd. >http://www.indigoindustrial.co.nz >64-21-343-545 >jasont at indigoindustrial.co.nz > >______________________________________________ >R-help at stat.math.ethz.ch mailing list >https://www.stat.math.ethz.ch/mailman/listinfo/r-helpPhD, Computational Biologist, Harvard Medical School BCMP/SGM-322, 250 Longwood Ave, Boston MA 02115, USA. Tel: 617-432-3555 Fax: 617-432-3557 http://llama.med.harvard.edu/~fgibbons
You are using a *beta* version of R 1.8.0 and in that version lda.default is not visible to the user (hidden in a namespace). You can access it though by using the ::: (triple colon) operator, as in> library(MASS) > MASS:::lda.defaultActually, the first library() call is not necessary. -roger Wei Geng wrote:>I am new to R. Trying to find out how lda() {in MASS R1.8.0 Windows} was >implemented in R. Does anyone know where to find out lda source code ? >Thanks. > >Wei > >______________________________________________ >R-help at stat.math.ethz.ch mailing list >https://www.stat.math.ethz.ch/mailman/listinfo/r-help > > >