Skip to content

Commit

Permalink
Changes for devools::check()
Browse files Browse the repository at this point in the history
* resolve mismatch in documentation (asfactor != as_factor)
* add reshape2 to the Depends field for the ipu_step example
* Avoid 'no visible binding for global variable ...' by initializing to NULL
     V1 <- baseweight <- NULL

The last error occures since the check does not deal properly with non-standard evaluation
(NSE). See here: Rdatatable/data.table#850
  • Loading branch information
GregorDeCillia committed Dec 20, 2017
1 parent adee489 commit 7e71e1a
Show file tree
Hide file tree
Showing 6 changed files with 19 additions and 9 deletions.
3 changes: 2 additions & 1 deletion DESCRIPTION
Expand Up @@ -30,7 +30,8 @@ Suggests:
haven,
microbenchmark,
stringr,
testthat
testthat,
reshape2
LinkingTo: Rcpp,RcppArmadillo
Description: Tools and methods to simulate populations for surveys based
on auxiliary data. The tools include model-based methods, calibration and
Expand Down
5 changes: 3 additions & 2 deletions R/RcppExports.R
Expand Up @@ -8,7 +8,7 @@
#' @param dat a data.frame containing the factor variables to be combined.
#' @param factor_columns a `character` vector containing the column names in `dat` to be combined. All columns must
#' be factors.
#' @param as_factor Wheter to return an integer or a factor variable.
#' @param asfactor Wheter to return an integer or a factor variable.
#'
#' @export
combine_factors <- function(dat, factor_columns, asfactor = TRUE) {
Expand Down Expand Up @@ -120,7 +120,8 @@ arithmetic_mean <- function(w, classes) {
#'
#' ## load data
#' factors <- c("time", "sex", "smoker", "day")
#' tips <- reshape2::tips[factors]
#' data(tips, package = "reshape2")
#' tips <- tips[factors]
#'
#' ## combine factors
#' cf <- combine_factors(tips, names(tips))
Expand Down
8 changes: 7 additions & 1 deletion R/ipu2.r
Expand Up @@ -52,7 +52,10 @@ boundsFakHH <- function(g1,g0,eps,orig,p,bound=4){ # Berechnet die neuen Gewicht
return(g1)
}

calibP <- function(i,conP, epsP, dat, error, valueP, pColNames, bound, verbose, calIter, numericalWeighting){
calibP <- function(i,conP, epsP, dat, error, valueP, pColNames, bound, verbose, calIter, numericalWeighting){
OriginalSortingVariable <- V1 <- baseWeight <- calibWeight <- epsvalue <- f <- NULL
temporary_hid <- temporary_hvar <- tmpVarForMultiplication <- value <- wValue <- wvst<- NULL

if(is.list(epsP)){
epsPcur <- epsP[[i]]
}else{
Expand Down Expand Up @@ -117,6 +120,9 @@ calibP <- function(i,conP, epsP, dat, error, valueP, pColNames, bound, verbose,
}

calibH <- function(i,conH, epsH, dat, error, valueH, hColNames, bound, verbose, calIter, looseH){
OriginalSortingVariable <- V1 <- baseWeight <- calibWeight <- epsvalue <- f <- NULL
temporary_hid <- temporary_hvar <- tmpVarForMultiplication <- value <- wValue <- wvst<- NULL

if(is.list(epsH)){
epsHcur <- epsH[[i]]
}else{
Expand Down
7 changes: 4 additions & 3 deletions man/ipu_step.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion src/combine_factors.cpp
Expand Up @@ -7,7 +7,7 @@ using namespace Rcpp;
//' @param dat a data.frame containing the factor variables to be combined.
//' @param factor_columns a `character` vector containing the column names in `dat` to be combined. All columns must
//' be factors.
//' @param as_factor Wheter to return an integer or a factor variable.
//' @param asfactor Wheter to return an integer or a factor variable.
//'
//' @export
// [[Rcpp::export]]
Expand Down
3 changes: 2 additions & 1 deletion src/ipu_step.cpp
Expand Up @@ -48,7 +48,8 @@ using namespace Rcpp;
//'
//' ## load data
//' factors <- c("time", "sex", "smoker", "day")
//' tips <- reshape2::tips[factors]
//' data(tips, package = "reshape2")
//' tips <- tips[factors]
//'
//' ## combine factors
//' cf <- combine_factors(tips, names(tips))
Expand Down

0 comments on commit 7e71e1a

Please sign in to comment.