Skip to content

Commit

Permalink
Fixed bugs introduced by solving issues #1,#2,#3
Browse files Browse the repository at this point in the history
  • Loading branch information
digEmAll committed Nov 7, 2016
1 parent 6888a44 commit 460487f
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 7 deletions.
12 changes: 6 additions & 6 deletions R/DFI.R
Expand Up @@ -53,7 +53,7 @@ DFI.indexes <- function(DFIobj){

DFI.subset <- function(DFIobj, filter=NULL, return.indexes=FALSE, sort.indexes=TRUE, colFilter=NULL, drop=NULL){
if(!is.DFI(DFIobj))
stop('DFIobj is not of class DFI')
stop('DFIobj is not of class DFI')
if(is.null(filter)){
idxs <- 1:nrow(DFIobj)
}else{
Expand All @@ -63,14 +63,14 @@ DFI.subset <- function(DFIobj, filter=NULL, return.indexes=FALSE, sort.indexes=T
}
if(return.indexes)
return(idxs)
if(is.null(drop)){
if(!is.null(drop)){
if(!is.null(colFilter))
return(DFIobj[idxs,colFilter,drop])
return(DFIobj[idxs,,drop])
return(DFIobj[idxs,colFilter,drop=drop])
return(DFIobj[idxs,,drop=drop])
}else{
if(!is.null(colFilter))
return(DFIobj[idxs,colFilter])
return(DFIobj[idxs])
return(DFIobj[idxs,colFilter])
return(DFIobj[idxs,])
}
}

Expand Down
4 changes: 3 additions & 1 deletion man/DFI.subset.Rd
Expand Up @@ -8,14 +8,16 @@ Function to subset a DFI object efficiently (using binary search) by creating co
For information about \code{NA} handling, please refer to \code{\link[bsearchtools]{rowfilters.DFI}}
}
\usage{
DFI.subset(DFIobj, filter=NULL, return.indexes=FALSE, sort.indexes=TRUE, colFilter=NULL)
DFI.subset(DFIobj, filter=NULL, return.indexes=FALSE,
sort.indexes=TRUE, colFilter=NULL, drop=NULL)
}
\arguments{
\item{DFIobj}{a DFI object.}
\item{filter}{a filter object created by functions \code{EQ,RG,IN,AND,OR,NOT}.}
\item{return.indexes}{if TRUE, the row indexes satisfying the filter are returned instead of the DFI subset.}
\item{sort.indexes}{if FALSE the order of the rows or row.index is not necessarily equal to the original order in the DFI object. If TRUE, subsetting will keep the original row/row.indexes order.}
\item{colFilter}{if \code{return.indexes==TRUE} is ignored; otherwise, if not NULL, it will be passed as second argument of data.frame/matrix subset operator i.e. \code{[,colFilter]} }
\item{drop}{if different from \code{NULL} and \code{return.indexes=FALSE} is passed as \code{drop} argument of data.frame and matrix subset.}
}
\value{
Returns a subset of the data.frame or matrix wrapped by the DFI object, unless \code{return.indexes==TRUE} in which case an integer vector with the row indexes will be returned.
Expand Down

0 comments on commit 460487f

Please sign in to comment.