From murdoch at stats.uwo.ca  Tue Dec 16 17:09:39 2008
From: murdoch at stats.uwo.ca (Duncan Murdoch)
Date: Tue, 16 Dec 2008 11:09:39 -0500
Subject: [Rd] "could not find function" error in "R CMD check"
In-Reply-To: <4947CF5C.7090702@pdf.com>
References: <4947CF5C.7090702@pdf.com>
Message-ID: <4947D2C3.7090305@stats.uwo.ca>

On 16/12/2008 10:55 AM, Spencer Graves wrote:
> Hi, All: 
> 
>       What might cause "R CMD check" to report, "could not find 
> function" for a function that has long been in the 'fda' package? 

I would guess that you are calling it from within your *.R files.  It's 
called from a lot of places, so I couldn't spot the one that's causing 
the trouble, but something like this could do it:

f <- function() { }  # Function is done, by mistake

   basisfd()          # This is a top level call, not within f

}                    # Not sure why the parser wouldn't see this
                      # so this guess may be wrong

In general, you can call functions from within the *.R files, but you 
have to be careful to make sure they are already defined (and you 
shouldn't count on any side effects from them.

Duncan Murdoch

> 
>       Both Jim Ramsay in Ottawa, Canada, and I in San Jose, CA, get this 
> same error.  I replicated it with a fresh, anonymous checkout from 
> R-Forge (svn checkout svn://svn.r-forge.r-project.org/svnroot/fda).  
> With this, I did "R CMD build pkg", then "R CMD check fda_2.1.0.tar.gz", 
> with the following result: 
> 
> 
> D:\spencerg\statmtds\splines\fda\tmp\fda>R CMD check fda_2.1.0.tar.gz
> * checking for working pdflatex ... OK
> * using log directory 'D:/spencerg/statmtds/splines/fda/tmp/fda/fda.Rcheck'
> * using R version 2.8.0 (2008-10-20)
> * using session charset: ISO8859-1
> * checking for file 'fda/DESCRIPTION' ... OK
> * this is package 'fda' version '2.1.0'
> * checking package name space information ... OK
> * checking package dependencies ... OK
> * checking if this is a source package ... OK
> * checking for .dll and .exe files ... OK
> * checking whether package 'fda' can be installed ... ERROR
> Installation failed.
> See 'D:/spencerg/statmtds/splines/fda/tmp/fda/fda.Rcheck/00install.out' 
> for deta
> ils.
> 
>      
> ####################################
>       "00install.out" is as follows: 
> 
> ####################################
> 
> installing R.css in D:/spencerg/statmtds/splines/fda/tmp/fda/fda.Rcheck
> 
> 
> ---------- Making package fda ------------
>   adding build stamp to DESCRIPTION
>   installing NAMESPACE file and metadata
>   installing R files
>   installing demos
>   installing inst files
>   installing data files
>   preparing package fda for lazy loading
> Loading required package: splines
> Loading required package: zoo
> 
> Attaching package: 'zoo'
> 
> 
>     The following object(s) are masked from package:base :
> 
>      as.Date.numeric
> 
> Error in basisfd(type = type, rangeval = rangeval, nbasis = nbasis, 
> params = params,  :
>   could not find function "use.proper.basis"
> Error: unable to load R code in package 'fda'
> Execution halted
> make[2]: *** [lazyload] Error 1
> make[1]: *** [all] Error 2
> make: *** [pkg-fda] Error 2
> *** Installation of fda failed ***
> 
> Removing 'D:/spencerg/statmtds/splines/fda/tmp/fda/fda.Rcheck/fda'
> 
> 
> ####################################
> 
>       Both "basisfd" and "use.proper.basis" have been in the "fda" 
> package for years and have passed "R CMD check" many times.  I'm running 
> Windows XP Pro and Jim is running Vista. 
> 
>       Any suggestions? 
>       Thanks,
>       Spencer Graves
>    
> 
>  sessionInfo()
> R version 2.8.0 (2008-10-20)
> i386-pc-mingw32
> 
> locale:
> LC_COLLATE=English_United States.1252;LC_CTYPE=English_United 
> States.1252;LC_MONETARY=English_United 
> States.1252;LC_NUMERIC=C;LC_TIME=English_United States.1252
> 
> attached base packages:
> [1] stats     graphics  grDevices utils     datasets  methods   base    
>  >
> 
> ______________________________________________
> R-devel at r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/r-devel



[Rd] "could not find function" error in "R CMD check"
Duncan Murdoch