"Seth Falcon" <[EMAIL PROTECTED]> wrote in message
news:[EMAIL PROTECTED]
> Are you sure you need to? I just tried your code above with:
>
> pkgs <- c("Biobase", "GOstats", "flrblr", "bazbaz")
>
> And while I see warning messages about the flrblr and bazbaz packages,
> the function completed and I get the expected results in z.
>
> Oh, perhaps you have some broken installs? Broken in the sense that
> you have a package installed but not its dependencies?
I installed all known CRAN packages after installing R 2.4.1 last week on a
PC. Perhaps some new consistency checks checks could be be made to catch
such dependency problems?
>
> How about this:
>
> safeRequire <- function(x) {
> tryCatch(require(x, character.only=TRUE),
> error=function(e) FALSE)
> }
Thanks. That's a much better function.
But if your process a lot of packages, even with just safeRequire (or
findfuns), the search() path grows quite long, and things break, so it's not
really possible to get a list of all functions in R if you have all packages
installed.
Consider:
pkgs <- dir(.Library)
length(pkgs) #957
length( search() ) # 9
# First 100 Packages
set1 <- lapply(pkgs[1:100], safeRequire)
pkgs[which(!unlist(set1))]
#[1] "bcp" "cairoDevice" "caMassClass"
length( search() ) # 135
safeRequire("bcp")
####################################
Loading required package: bcp
Loading required package: DNAcopy
Warning in library(pkg, character.only = TRUE, logical = TRUE, lib.loc =
lib.loc) :
there is no package called 'DNAcopy'
[1] FALSE
####################################
In the 2nd 100 many packages seem to be affected by the "Maximal number of
DLLs reached..."
I didn't bother trying to process packages 201 through 957.
efg
Earl F. Glynn
Scientific Programmer
Bioinformatics
Stowers Institute for Medical Research
______________________________________________
[email protected] 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.