Skip to content

Commit 248778d

Browse files
committed
changed class(object)[1] == "..." to inherits(...) and similar
1 parent e26903f commit 248778d

1 file changed

Lines changed: 4 additions & 4 deletions

File tree

R/methods.R

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -573,7 +573,7 @@ coef.FDboost <- function(object, raw = FALSE, which = NULL,
573573
if(is.null(which)) which <- 1:length(object$baselearner)
574574

575575
## special case of ~1 intercept specification with scalar response
576-
if( class(object)[1] == "FDboostScalar" &&
576+
if( inherits(object, "FDboostScalar") &&
577577
any(which == 1) &&
578578
length(object$coef(which = 1)[[1]]) == 1 ){
579579
ret$intercept <- object$coef(which = 1)[[1]]
@@ -801,7 +801,7 @@ coef.FDboost <- function(object, raw = FALSE, which = NULL,
801801

802802
if(trm$dim == 2){
803803

804-
if("FDboostScalar" %in% class(object)){ ### scalar response
804+
if(inherits(object, "FDboostScalar")){ ### scalar response
805805
position_time <- 2
806806
y <- yg <- 1
807807
varnms <- c(varnms[1], "ONEtime", varnms[2])
@@ -973,7 +973,7 @@ coef.FDboost <- function(object, raw = FALSE, which = NULL,
973973

974974

975975
# if %X% was used in combination with factor variables make a list of data-frames
976-
if(!any(class(object) == "FDboostLong") && grepl("%X", trm$get_call())){
976+
if(!inherits(object, "FDboostLong") && grepl("%X", trm$get_call())){
977977
dlist <- NULL
978978

979979
## if %X% was used in combination with factor variables make a list of data-frames
@@ -1183,7 +1183,7 @@ coef.FDboost <- function(object, raw = FALSE, which = NULL,
11831183

11841184
## it is necessary to expand the dataframe!
11851185
if(!grepl("bhistx(", trm$get_call(), fixed=TRUE) &&
1186-
class(object)[1] == "FDboostLong" && !grepl("bconcurrent", trm$get_call())){
1186+
inherits(object, "FDboostLong") && !grepl("bconcurrent", trm$get_call())){
11871187
#print(attr(d, "varnms"))
11881188
vari <- names(d)[1]
11891189
if(is.factor(d[[vari]])){

0 commit comments

Comments
 (0)