bw.SJ calls C code from the file /usr/local/bin/R-2.6.0/src/library/stats/src/bandwidths.c You have to make this code available.
You can do the following: 1. copy bandwidths.c and the definition of bw.SJ (the latter renamed) to a directory 2. compile bandwidths.c into a shared library with the command R CMD SHLIB bandwidths.c (see the manual writing R extensions for details) 3. in your definition of bw.SJ, in the 3 places .C is called, remove "R_" from the first argument and quote it; e.g., C(R_band_phi4_bin, ..." becomes "C("band_phi4_bin"," 4. in R, load the shared library you built with the dyn.load function; now your definition of the (renamed) function bw.SJ can be modified as you like. On Tue, 6 Nov 2007, Jason Liao wrote: > > I tried to modify the R function bw.SJ (from the stats package) for my > own use. But if I just get the source code and run directly (without any > modification), it can no longer find some key functions called within > it. I understand this has something to do with searching path which I do > not understand well. Can anyone tell me how to modify the source code of > an R function and still make it part of an existing package? > > Thanks. > > > Jason Liao, http://www.geocities.com/jg_liao > Associate Professor of Biostatistics > Drexel University School of Public Health > 245 N. 15th Street, Mail Stop 660 > Philadelphia, PA 19102-1192 > phone 215-762-3934 > > ______________________________________________ > R-help@r-project.org mailing list > https://stat.ethz.ch/mailman/listinfo/r-help > PLEASE do read the posting guide http://www.R-project.org/posting-guide.html > and provide commented, minimal, self-contained, reproducible code. > ______________________________________________ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.