Revision: 1040
http://svn.sourceforge.net/r-gregmisc/?rev=1040&view=rev
Author: arnima
Date: 2007-01-27 03:35:12 -0800 (Sat, 27 Jan 2007)
Log Message:
-----------
is.* tests that return NA are not reported
is.what recursion is avoided
Modified Paths:
--------------
trunk/gdata/R/is.what.R
Modified: trunk/gdata/R/is.what.R
===================================================================
--- trunk/gdata/R/is.what.R 2006-12-06 19:20:46 UTC (rev 1039)
+++ trunk/gdata/R/is.what.R 2007-01-27 11:35:12 UTC (rev 1040)
@@ -3,7 +3,7 @@
do.test <- function(test, object)
{
result <- try(get(test)(object), silent=TRUE)
- if(!is.logical(result) || length(result)!=1)
+ if(!is.logical(result) || is.na(result) || length(result)!=1)
result <- NULL
return(result)
}
@@ -14,20 +14,13 @@
## Narrow to functions
is.functions <- is.names[sapply(is.names, function(x) is.function(get(x)))]
- tests <- sort(unique(is.functions))
+ tests <- sort(unique(is.functions[is.functions!="is.what"]))
results <- suppressWarnings(unlist(sapply(tests, do.test, object=object)))
if(verbose)
- {
- results <- as.character(results)
- results[results=="TRUE"] <- "T"
- results[results=="FALSE"] <- "."
- output <- data.frame(is=results)
- }
+ output <- data.frame(is=ifelse(results,"T","."))
else
- {
output <- names(results)[results]
- }
return(output)
}
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|