Skip to content

Commit b39e4ab

Browse files
Merge branch 'master' into seq-along
2 parents 9e9b57a + d82e1d8 commit b39e4ab

5 files changed

Lines changed: 9 additions & 9 deletions

File tree

R/FDboost.R

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -582,7 +582,7 @@ FDboost <- function(formula, ### response ~ xvars
582582
allCovs <- unique(c(nameid, all.vars(formula)))
583583
if(length(allCovs) > 1){
584584
data <- data[allCovs[!allCovs %in% c(yname, nameyind)] ]
585-
if( any(is.na(names(data))) ) data <- data[ !is.na(names(data)) ]
585+
if( anyNA(names(data)) ) data <- data[ !is.na(names(data)) ]
586586
}else{
587587
data <- list(NULL) # <SB> intercept-model without covariates
588588
}
@@ -636,7 +636,7 @@ FDboost <- function(formula, ### response ~ xvars
636636
stopifnot(all(length(response) == sapply(time, length)) & length(response) == length(id)) else
637637
stopifnot(length(response) == length(time) & length(response) == length(id))
638638

639-
if(any(is.na(response))) warning("For non-grid observations the response should not contain missing values.")
639+
if(anyNA(response)) warning("For non-grid observations the response should not contain missing values.")
640640
if( !all(sort(unique(id)) == seq_along(unique(id))) ) stop("id has to be integers 1, 2, 3,..., N.")
641641

642642
nr <- length(response) # total number of observations
@@ -1045,7 +1045,7 @@ FDboost <- function(formula, ### response ~ xvars
10451045
}
10461046
# meanY <- sapply(1:nc, function(i) offsetFun(responseInter[,i], 1*!is.na(responseInter[,i])))
10471047

1048-
if( is.null(meanY) || any(is.na(meanY)) ){
1048+
if( is.null(meanY) || anyNA(meanY) ){
10491049
warning("Mean offset cannot be computed by family@offset(). Use a weighted mean instead.")
10501050
meanY <- c()
10511051
for(i in 1:nc){

R/baselearners.R

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -124,11 +124,11 @@ integrationWeights <- function(X1, xind, id = NULL){
124124
}
125125

126126
# taking into account missing values
127-
if(any(is.na(X1))){
127+
if(anyNA(X1)){
128128
Lneu <- sapply(1:nrow(X1), function(i){
129129
x <- X1[i,]
130130

131-
if(!any(is.na(x))){
131+
if(!anyNA(x)){
132132
l <- L[i, ] # no missing values in curve i
133133
}else{
134134
xindL <- xind # lower

R/factorize.R

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -335,7 +335,7 @@ NULL
335335
#'
336336
predict.FDboost_fac <- function(object, newdata = NULL, which = NULL, ...) {
337337
w <- object$which(which)
338-
if(any(is.na(w)))
338+
if(anyNA(w))
339339
stop("Don't know 'which' base-learner is meant.")
340340
names(w) <- names(object$baselearner)[w]
341341
drop(sapply(w,
@@ -349,7 +349,7 @@ predict.FDboost_fac <- function(object, newdata = NULL, which = NULL, ...) {
349349
#' @rdname predict.FDboost_fac
350350
plot.FDboost_fac <- function(x, which = NULL, main = NULL, ...) {
351351
w <- x$which(which, usedonly = TRUE)
352-
if(any(is.na(w)))
352+
if(anyNA(w))
353353
stop(paste("Don't know which base-learner is meant by:",
354354
which[which.min(is.na(w))]))
355355
if(is.null(main))

R/hmatrix.R

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -82,7 +82,7 @@ hmatrix <- function(time, id, x, argvals=1:ncol(x),
8282
x <- matrix(x, ncol=ncol(x), nrow=nrow(x))
8383

8484
#### check argvals and x
85-
if( any(duplicated(argvals)) ){
85+
if(anyDuplicated(argvals) > 0){
8686
stop("argvals contains duplicates.")
8787
}
8888
if( is.unsorted(argvals) ){

R/utilityFunctions.R

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1178,7 +1178,7 @@ reweightData <- function(data, argvals, vars,
11781178
my_temp_idvars <- temp_idvars
11791179
i <- 1
11801180
## add 0.1^1 to duplicates, 0.1^1 + 0.1^2 = 0.11 to triplicates, ...
1181-
while(any(duplicated(my_index_long))){ # loop until no more duplicates in the data
1181+
while(anyDuplicated(my_index_long) > 0){ # loop until no more duplicates in the data
11821182
my_temp_idvars[duplicated(my_index_long)] <- my_temp_idvars[duplicated(my_index_long)] + 0.1^i
11831183
my_index_long[duplicated(my_index_long)] <- my_index_long[duplicated(my_index_long)] + 0.1^i
11841184
i <- i + 1

0 commit comments

Comments
 (0)