Skip to content

Commit

Permalink
fixed CRAN checking issue, i hope...
Browse files Browse the repository at this point in the history
  • Loading branch information
edwindj committed May 11, 2015
1 parent 821a72b commit 7de1da7
Show file tree
Hide file tree
Showing 18 changed files with 82 additions and 47 deletions.
8 changes: 4 additions & 4 deletions examples/cumsum.R
@@ -1,14 +1,14 @@
x <- 1:10000
tmp <- cumsum.ff(ff(x), BATCHBYTES=10000)
tmp <- cumsum(ff(x))
class(tmp)
table(tmp[] == cumsum(x))

x <- rnorm(1000)
tmp <- cummax.ff(ff(x), BATCHBYTES=10000)
tmp <- cummax(ff(x))
table(tmp[] == cummax(x))
tmp <- cummin.ff(ff(x), BATCHBYTES=10000)
tmp <- cummin(ff(x))
table(tmp[] == cummin(x))
tmp <- cumprod.ff(ff(x), BATCHBYTES=10000)
tmp <- cumprod(ff(x))
table(tmp[] == cumprod(x))

## S3 type of calling
Expand Down
9 changes: 3 additions & 6 deletions examples/extract.R
@@ -1,12 +1,9 @@
x <- ff(1:10)
y <- ff(11:20)

## extractors
x <- ff(1:10)
y <- ff(11:20)
idx <- ff(c(FALSE, TRUE, NA, TRUE))
x[idx]
idx <- ff(c(FALSE, FALSE, FALSE))
idx <- ff(c(FALSE, FALSE, TRUE))
x[idx]
idx <- ff(1:3)
x[idx]
Expand All @@ -15,8 +12,8 @@ x[idx]
idx <- ff(c(FALSE, TRUE, NA, TRUE))
x[idx] <- y[idx]
x
idx <- ff(c(FALSE, FALSE, FALSE))
try(x[idx] <- y[idx]) ## not allowed
idx <- ff(c(FALSE, FALSE, TRUE))
try(x[idx] <- y[idx], silent = T) ## not allowed
x
idx <- ff(1:3)
x[idx] <- y[idx]
Expand Down
2 changes: 1 addition & 1 deletion pkg/DESCRIPTION
Expand Up @@ -11,7 +11,7 @@ Version: 0.12.0.2000
URL: http://github.com/edwindj/ffbase
Date: 2015-05-05
Depends:
R (>= 2.12.0), ff (>= 2.2-11)
R (>= 2.12.0),ff(>= 2.2-11)
Imports:
fastmatch, bit
Suggests:
Expand Down
55 changes: 44 additions & 11 deletions pkg/NAMESPACE
Expand Up @@ -42,6 +42,10 @@ S3method(ceiling,ff_vector)
S3method(compact,ff)
S3method(cos,ff_vector)
S3method(cosh,ff_vector)
S3method(cummax,ff)
S3method(cummin,ff)
S3method(cumprod,ff)
S3method(cumsum,ff)
S3method(cut,ff)
S3method(diff,ff)
S3method(digamma,ff_vector)
Expand Down Expand Up @@ -74,15 +78,23 @@ S3method(signif,ff_vector)
S3method(sin,ff_vector)
S3method(sinh,ff_vector)
S3method(sqrt,ff_vector)
S3method(subset,ff)
S3method(subset,ffdf)
S3method(sum,ff)
S3method(table,default)
S3method(table,ff)
S3method(tan,ff_vector)
S3method(tanh,ff_vector)
S3method(transform,ffdf)
S3method(trigamma,ff_vector)
S3method(trunc,ff_vector)
S3method(unique,ff)
S3method(unique,ffdf)
S3method(with,ffdf)
S3method(within,ffdf)
export("%in%")
export("[.ff")
export("[<-.ff")
export(addfforder)
export(bigglm.ffdf)
export(binned_sum)
Expand All @@ -93,10 +105,6 @@ export(bySum)
export(chunkify)
export(condMean)
export(condSum)
export(cummax.ff)
export(cummin.ff)
export(cumprod.ff)
export(cumsum.ff)
export(expand.ffgrid)
export(ffappend)
export(ffdfappend)
Expand All @@ -115,29 +123,54 @@ export(ffseq_len)
export(ffsorted)
export(ffwhich)
export(ikey)
export(is.na.ff)
export(laf_to_ffdf)
export(load.ffdf)
export(log10.ff_vector)
export(log2.ff_vector)
export(move.ffdf)
export(pack.ffdf)
export(rbind.ffdf)
export(rle_ff)
export(save.ffdf)
export(set_ffbase_logging)
export(subset.ff)
export(subset.ffdf)
export(sum.ff)
export(table)
export(tabulate.ff)
export(transform.ffdf)
export(unique.ff)
export(unique.ffdf)
export(unpack.ffdf)
import(bit)
importFrom(fastmatch,fmatch)
importFrom(ff,"finalizer<-")
importFrom(ff,"nrow<-")
importFrom(ff,'filename<-')
importFrom(ff,.rambytes)
importFrom(ff,.vNA)
importFrom(ff,.vimplemented)
importFrom(ff,.vmax)
importFrom(ff,.vmin)
importFrom(ff,.vmode)
importFrom(ff,appendLevels)
importFrom(ff,arrayIndex2vectorIndex)
importFrom(ff,as.ff)
importFrom(ff,as.ffdf)
importFrom(ff,as.ram)
importFrom(ff,ff)
importFrom(ff,ffdf)
importFrom(ff,ffdforder)
importFrom(ff,ffindexget)
importFrom(ff,ffindexorder)
importFrom(ff,ffindexordersize)
importFrom(ff,fforder)
importFrom(ff,ffsort)
importFrom(ff,ffvecapply)
importFrom(ff,filename)
importFrom(ff,hi)
importFrom(ff,is.factor.ff)
importFrom(ff,is.ff)
importFrom(ff,is.ffdf)
importFrom(ff,is.open)
importFrom(ff,maxffmode)
importFrom(ff,recodeLevels)
importFrom(ff,set.ff)
importFrom(ff,vmode)
importFrom(stats,quantile)
importFrom(stats,weighted.mean)
importFrom(tools,file_ext)
Expand Down
2 changes: 1 addition & 1 deletion pkg/R/Summary_ff.R
Expand Up @@ -41,7 +41,7 @@ any.ff <- function(x, ..., na.rm=FALSE, range=NULL){
#'
#' @title Sum of \code{ff} vector Elements
#' @method sum ff
#' @export sum.ff
#' @export
#' @param x a \code{ff} object
#' @param ... optional other (\code{ff}) objects
#' @param na.rm should \code{NA} be removed?
Expand Down
4 changes: 2 additions & 2 deletions pkg/R/as.R
Expand Up @@ -21,7 +21,6 @@ as.character.ff <- function(x, ...){
res
}


as.ff_matrix <- function(x, ...){
UseMethod("as.ff_matrix")
}
Expand Down Expand Up @@ -75,13 +74,14 @@ as.ff_matrix.ffdf <- function(x, ...){
# return(y)
# }


#' Trivial implementation, but very handy
#'
#' Coerce a ffdf object to an ffdf object.
#' @param x ffdf object
#' @param ... not used.
#' @importFrom ff as.ffdf
#' @export
#' @importFrom ff as.ffdf
as.ffdf.ffdf <- function(x, ...){
x
}
Expand Down
6 changes: 3 additions & 3 deletions pkg/R/bigglm.R
Expand Up @@ -7,15 +7,15 @@
#' @param formula a model formula
#' @param data an object of class ffdf
#' @param family A glm family object
#' @param ... other parameters passed on to bigglm. See the bigglm package: \code{\link[biglm]{bigglm}}
#' @param ... other parameters passed on to bigglm. See the biglm package: \code{\link[biglm]{biglm}}
#' @param chunksize Size of chunks for processing the ffdf
#' @return An object of class bigglm. See the bigglm package for a description: \code{\link[biglm]{bigglm}}
#' @export
#' @seealso \code{\link[biglm]{bigglm}}
#' @example ../examples/bigglm.R
bigglm.ffdf<-function(formula, data, family = gaussian(), ..., chunksize=5000){

if (!requireNamespace("biglm")){
if (!requireNamespace("biglm", quietly = TRUE)){
stop("This function needs the package 'biglm', which can be installed from CRAN")
}

Expand Down Expand Up @@ -45,7 +45,7 @@ bigglm.ffdf<-function(formula, data, family = gaussian(), ..., chunksize=5000){
Log$chunk(got)
data[chunks[[got]], tablevars, drop=FALSE]
}
rval<-bigglm(formula, data=ffchunk, family=family, ...)
rval <- biglm::bigglm(formula, data=ffchunk, family=family, ...)
rval$call<-sys.call()
#rval$call[[1]]<-as.name(.Generic)
rval$call[[1]]<-as.name("bigglm")
Expand Down
8 changes: 4 additions & 4 deletions pkg/R/cumsum.R
Expand Up @@ -7,7 +7,7 @@
#' @return An \code{ff} vector of the same length and type as x (after coercion), except that cumprod returns a numeric vector for integer input.\cr
#' An NA value in x causes the corresponding and following elements of the return value to be NA, as does integer overflow in cumsum (with a warning).
#' @rdname cumsum.ff
#' @export cumsum.ff
#' @export
#' @seealso \code{\link{cumsum}}, \code{\link{cumprod}}, \code{\link{cummax}}, \code{\link{cummin}}
cumsum.ff <- function(x, ...){
result <- clone(x, vmode = "double")
Expand All @@ -24,7 +24,7 @@ cumsum.ff <- function(x, ...){

#' @rdname cumsum.ff
#' @method cumprod ff
#' @export cumprod.ff
#' @export
cumprod.ff <- function(x, ...){
result <- clone(x, vmode = "double")

Expand All @@ -40,7 +40,7 @@ cumprod.ff <- function(x, ...){

#' @rdname cumsum.ff
#' @method cummax ff
#' @export cummax.ff
#' @export
cummax.ff <- function(x, ...){
result <- clone(x, vmode = "double")

Expand All @@ -55,7 +55,7 @@ cummax.ff <- function(x, ...){

#' @rdname cumsum.ff
#' @method cummin ff
#' @export cummin.ff
#' @export
cummin.ff <- function(x, ...){
result <- clone(x, vmode = "double")

Expand Down
2 changes: 2 additions & 0 deletions pkg/R/extract.R
Expand Up @@ -9,6 +9,7 @@
#' to handle logical \code{ff} vectors as indexes.
#'
#' @export
#' @export [.ff
#' @rdname ffextract
#' @example ../examples/extract.R
#' @param x an \code{ff} object
Expand Down Expand Up @@ -38,6 +39,7 @@
#' @rdname ffextract
#' @usage \method{[}{ff} (x, i, add = FALSE, pack = FALSE) <- value
#' @export
#' @export [<-.ff
`[<-.ff` <- function(x, i, add = FALSE, pack = FALSE, value){
if(!missing(i) && is.ff(i) && length(i) > 0 && is.logical(i[1])){
idx <- ffwhich(i, i==TRUE)
Expand Down
1 change: 1 addition & 0 deletions pkg/R/isNA.R
Expand Up @@ -13,6 +13,7 @@
#' @param value a suitable ff index vector for use with x
#' @return A logical \code{ff} vector of the same length of x indicating if the ff vector contains missing values.
#' @export
#' @export is.na.ff
#' @seealso \code{\link[base]{is.na}, \link[ff]{ffvecapply}}
is.na.ff <- function(x, ...){
res <- ff(vmode="logical", length=length(x))
Expand Down
4 changes: 4 additions & 0 deletions pkg/R/pkg.R
Expand Up @@ -67,5 +67,9 @@
#' @name ffbase-package
#' @aliases ffbase ffbase-package
#' @import bit
#' @importFrom ff ffdf ff is.ff is.ffdf fforder filename as.ff is.factor.ff vmode recodeLevels
#' @importFrom ff is.open ffdforder appendLevels ffvecapply 'filename<-' maxffmode
#' @importFrom ff arrayIndex2vectorIndex nrow<- .rambytes set.ff hi ffindexordersize ffindexget
#' @importFrom ff ffsort .vNA .vmax .vmin .vmode finalizer<- ffindexorder .vimplemented
#' @docType package
{}
1 change: 0 additions & 1 deletion pkg/R/rbind_ffdf.R
@@ -1,4 +1,3 @@
#' @export
rbind.ffdf <- function(..., deparse.level=1){
a <- list(...)
x <- clone(a[[1]])
Expand Down
3 changes: 2 additions & 1 deletion pkg/R/subset.R
@@ -1,6 +1,6 @@
#' Subsetting a ff vector or ffdfdata frame
#'
#' @export subset.ff subset.ffdf
#' @export
#' @aliases subset.ff subset.ffdf
#' @method subset ff
#' @param x \code{ff} vector or \code{ffdf} data.frame to be subset
Expand All @@ -18,6 +18,7 @@ subset.ff <- function(x, subset, ...){
x[idx]
}

#' @export
subset.ffdf <- function(x, subset, select, drop = FALSE, ...){
# remove rownames otherwise we have errors...
rownames(x) <- NULL
Expand Down
2 changes: 1 addition & 1 deletion pkg/R/transform.R
Expand Up @@ -6,7 +6,7 @@
#' @usage
#' \method{transform}{ffdf}(`_data`, \dots)
#'
#' @export transform.ffdf
#' @export
#'
#' @example ../examples/transform.R
#' @param _data \code{\link{ffdf}} data object to be transformed.
Expand Down
3 changes: 2 additions & 1 deletion pkg/R/unique.R
@@ -1,7 +1,7 @@
#' Unique values for ff and ffdf objects
#'
#' @rdname unique.ff
#' @export unique.ff unique.ffdf
#' @export
#' @method unique ff
#' @example ../examples/unique.R
#' @param x \code{ff} object or \code{ffdf} object
Expand Down Expand Up @@ -57,6 +57,7 @@ unique.ff <- function(x, incomparables = FALSE, fromLast = FALSE, trace=FALSE, .

#' @rdname unique.ff
#' @method unique ffdf
#' @export
unique.ffdf <- function(x, incomparables = FALSE, fromLast=FALSE, trace=FALSE, ...){
if (!identical(incomparables, FALSE)){
.NotYetUsed("incomparables != FALSE")
Expand Down
2 changes: 1 addition & 1 deletion pkg/man/bigglm.ffdf.Rd
Expand Up @@ -13,7 +13,7 @@ bigglm.ffdf(formula, data, family = gaussian(), ..., chunksize = 5000)

\item{family}{A glm family object}

\item{...}{other parameters passed on to bigglm. See the bigglm package: \code{\link[biglm]{bigglm}}}
\item{...}{other parameters passed on to bigglm. See the biglm package: \code{\link[biglm]{biglm}}}

\item{chunksize}{Size of chunks for processing the ffdf}
}
Expand Down
8 changes: 4 additions & 4 deletions pkg/man/cumsum.ff.Rd
Expand Up @@ -29,16 +29,16 @@ Cumulative Sums, Products, and Extremes
}
\examples{
x <- 1:10000
tmp <- cumsum.ff(ff(x), BATCHBYTES=10000)
tmp <- cumsum(ff(x))
class(tmp)
table(tmp[] == cumsum(x))

x <- rnorm(1000)
tmp <- cummax.ff(ff(x), BATCHBYTES=10000)
tmp <- cummax(ff(x))
table(tmp[] == cummax(x))
tmp <- cummin.ff(ff(x), BATCHBYTES=10000)
tmp <- cummin(ff(x))
table(tmp[] == cummin(x))
tmp <- cumprod.ff(ff(x), BATCHBYTES=10000)
tmp <- cumprod(ff(x))
table(tmp[] == cumprod(x))

## S3 type of calling
Expand Down
9 changes: 3 additions & 6 deletions pkg/man/ffextract.Rd
Expand Up @@ -35,15 +35,12 @@ Mark that all other functionality from the extractor functions \code{[.ff} and \
to handle logical \code{ff} vectors as indexes.
}
\examples{
x <- ff(1:10)
y <- ff(11:20)

## extractors
x <- ff(1:10)
y <- ff(11:20)
idx <- ff(c(FALSE, TRUE, NA, TRUE))
x[idx]
idx <- ff(c(FALSE, FALSE, FALSE))
idx <- ff(c(FALSE, FALSE, TRUE))
x[idx]
idx <- ff(1:3)
x[idx]
Expand All @@ -52,8 +49,8 @@ x[idx]
idx <- ff(c(FALSE, TRUE, NA, TRUE))
x[idx] <- y[idx]
x
idx <- ff(c(FALSE, FALSE, FALSE))
try(x[idx] <- y[idx]) ## not allowed
idx <- ff(c(FALSE, FALSE, TRUE))
try(x[idx] <- y[idx], silent = T) ## not allowed
x
idx <- ff(1:3)
x[idx] <- y[idx]
Expand Down

0 comments on commit 7de1da7

Please sign in to comment.