From hb at stat.berkeley.edu  Tue Aug 28 22:24:48 2007
From: hb at stat.berkeley.edu (Henrik Bengtsson)
Date: Tue, 28 Aug 2007 13:24:48 -0700
Subject: [Rd] R CMD check: Error in function (env) : could not find function
	"finalize"
Message-ID: <59d7961d0708281324q11f966d2y724c0bdb0a98e036@mail.gmail.com>

Hi,

does someone else get this error message:

Error in function (env)  : could not find function "finalize"?

I get an error when running examples in R CMD check (v2.6.0; session
info below):

> ### * invertMap
>
> flush(stderr()); flush(stdout())
> ### Name: invertMap
> ### Title: Inverts a read or a write map
> ### Aliases: invertMap
> ### Keywords: file IO internal
>
> ### ** Examples
>
> # .... [TRUNCATED]
> nbrOfCells <- 2600000
> readMap <- sample(nbrOfCells)
Error in function (env)  : could not find function "finalize"
Error in function (env)  : could not find function "finalize"
Error in function (env)  : could not find function "finalize"
Error in function (env)  : could not find function "finalize"
Error in function (env)  : could not find function "finalize"
Error in function (env)  : could not find function "finalize"

The error occurs in R CMD check but also when start a fresh R session
and run, in this case, affxparser.Rcheck/affxparser-Ex.R.  It always
occur on the same line.

When I debug(sample), all values passed to the internal function looks
fine.  I've replaced it with runif() and vector("double", nbrOfCells)
and manged to get the error there too.  So, it seems like there are
some memory issues.  I've called gc() just before without success.
There are a lot of other example code processed before this one and
many of them rely on native code, so it could be a memory leak or
something.  However, before troubleshooting more, I wanted to hear if
someone else got the same problem.  Searching google, gives me one hit
in a recent Bioconductor build/check.  From Google cache
http://tinyurl.com/25hkld

> ## Perform svdImpute using the 3 largest components
> result <- pca(metaboliteData, method="svdImpute", nPcs=3, center = TRUE)
Error in function (env)  : could not find function "finalize"
...

Now, the error is not there.

Any ideas?

/Henrik

> sessionInfo()
R version 2.6.0 Under development (unstable) (2007-08-23 r42614)
i386-pc-mingw32

locale:
LC_COLLATE=English_United States.1252;LC_CTYPE=English_United States.1252;LC_MON
ETARY=English_United States.1252;LC_NUMERIC=C;LC_TIME=English_United States.1252


attached base packages:
[1] stats     graphics  grDevices utils     datasets  methods   base

other attached packages:
[1] affxparser_1.9.5

loaded via a namespace (and not attached):
[1] AffymetrixDataTestFiles_0.1.0



[Rd] R CMD check: Error in function (env) : could not find function "finalize"
Henrik Bengtsson