[Zooimage-commits] r65 - pkg/zooimage/R
noreply at r-forge.r-project.org
noreply at r-forge.r-project.org
Wed Apr 15 12:08:42 CEST 2009
Author: romain
Date: 2009-04-15 12:08:42 +0200 (Wed, 15 Apr 2009)
New Revision: 65
Modified:
pkg/zooimage/R/ZITrain.r
pkg/zooimage/R/utilities.r
Log:
added handling of recursive argument in list.files.ext
Modified: pkg/zooimage/R/ZITrain.r
===================================================================
--- pkg/zooimage/R/ZITrain.r 2009-04-15 09:32:43 UTC (rev 64)
+++ pkg/zooimage/R/ZITrain.r 2009-04-15 10:08:42 UTC (rev 65)
@@ -116,8 +116,8 @@
# }}}
# {{{ get.ZITrain
+#' Retrieve information from a manual training set and store it in a 'ZITrain' object
"get.ZITrain" <- function(dir, creator = NULL, desc = NULL, keep_ = FALSE, na.rm = TRUE) {
- # Retrieve information from a manual training set and store it in a 'ZITrain' object
# 'dir' must be the base directory of the manual classification
if (!file.exists(dir) || !file.info(dir)$isdir)
stop("'dir' is not a valid directory!")
Modified: pkg/zooimage/R/utilities.r
===================================================================
--- pkg/zooimage/R/utilities.r 2009-04-15 09:32:43 UTC (rev 64)
+++ pkg/zooimage/R/utilities.r 2009-04-15 10:08:42 UTC (rev 65)
@@ -506,9 +506,15 @@
#' @param dir directory to list files
#' @param extension file extension to accept. This will be
#' modified by extensionPattern so that the test is case independent
-list.files.ext <- function( dir, extension = "zip", ... ){
+list.files.ext <- function( dir, extension = "zip", keep.dir = FALSE, ... ){
checkDirExists( dir )
- list.files( dir, pattern = extensionPattern( extension ) , ... )
+ out <- list.files( dir, pattern = extensionPattern( extension ) , ... )
+ if( !keep.dir ){
+ dots <- list(...)
+ recursive <- "recursive" %in% names(dots) && dots$recursive
+ out <- out[ !file.info( file.path( dir, if( recursive ) out else basename(out) ) )$isdir ]
+ }
+ out
}
#' transforms a file extension to a pattern for ignore.case matching of the
@@ -593,7 +599,12 @@
invisible( res )
}
+list.dir <- function( dir, ... ){
+ out <- list.files( dir )
+ out[ file.info( file.path( dir, basename(out) ) )$isdir ]
+}
+
# }}}
# {{{ binary operators
More information about the Zooimage-commits
mailing list