diff --git a/R/pkg/NAMESPACE b/R/pkg/NAMESPACE index 673a44183d683..709057675e578 100644 --- a/R/pkg/NAMESPACE +++ b/R/pkg/NAMESPACE @@ -1,7 +1,8 @@ # Imports from base R +# Do not include stats:: "rpois", "runif" - causes error at runtime importFrom("methods", "setGeneric", "setMethod", "setOldClass") importFrom("methods", "is", "new", "signature", "show") -importFrom("stats", "gaussian", "rpois", "runif", "setNames") +importFrom("stats", "gaussian", "setNames") importFrom("utils", "download.file", "packageVersion", "untar") # Disable native libraries till we figure out how to package it diff --git a/R/pkg/R/RDD.R b/R/pkg/R/RDD.R index 6b254bb0d302c..6cd0704003f1a 100644 --- a/R/pkg/R/RDD.R +++ b/R/pkg/R/RDD.R @@ -887,17 +887,17 @@ setMethod("sampleRDD", # Discards some random values to ensure each partition has a # different random seed. - runif(partIndex) + stats::runif(partIndex) for (elem in part) { if (withReplacement) { - count <- rpois(1, fraction) + count <- stats::rpois(1, fraction) if (count > 0) { res[ (len + 1) : (len + count) ] <- rep(list(elem), count) len <- len + count } } else { - if (runif(1) < fraction) { + if (stats::runif(1) < fraction) { len <- len + 1 res[[len]] <- elem } @@ -965,7 +965,7 @@ setMethod("takeSample", signature(x = "RDD", withReplacement = "logical", set.seed(seed) samples <- collectRDD(sampleRDD(x, withReplacement, fraction, - as.integer(ceiling(runif(1, + as.integer(ceiling(stats::runif(1, -MAXINT, MAXINT))))) # If the first sample didn't turn out large enough, keep trying to @@ -973,7 +973,7 @@ setMethod("takeSample", signature(x = "RDD", withReplacement = "logical", # multiplier for thei initial size while (length(samples) < total) samples <- collectRDD(sampleRDD(x, withReplacement, fraction, - as.integer(ceiling(runif(1, + as.integer(ceiling(stats::runif(1, -MAXINT, MAXINT))))) diff --git a/R/pkg/R/pairRDD.R b/R/pkg/R/pairRDD.R index f0605db1e9e83..4dee3245f9b75 100644 --- a/R/pkg/R/pairRDD.R +++ b/R/pkg/R/pairRDD.R @@ -917,19 +917,19 @@ setMethod("sampleByKey", len <- 0 # mixing because the initial seeds are close to each other - runif(10) + stats::runif(10) for (elem in part) { if (elem[[1]] %in% names(fractions)) { frac <- as.numeric(fractions[which(elem[[1]] == names(fractions))]) if (withReplacement) { - count <- rpois(1, frac) + count <- stats::rpois(1, frac) if (count > 0) { res[ (len + 1) : (len + count) ] <- rep(list(elem), count) len <- len + count } } else { - if (runif(1) < frac) { + if (stats::runif(1) < frac) { len <- len + 1 res[[len]] <- elem }