@@ -273,7 +273,7 @@ X_bsignal <- function(mf, vary, args) {
273273 " linear" = matrix (c(rep(1 , length(xind )), xind ), ncol = 2 ),
274274 " constant" = matrix (c(rep(1 , length(xind ))), ncol = 1 ))
275275
276- colnames(Bs ) <- paste(xname , 1 : ncol(Bs ), sep = " " )
276+ colnames(Bs ) <- paste(xname , seq_len( ncol(Bs ) ), sep = " " )
277277
278278
279279 # use cyclic splines
@@ -288,7 +288,7 @@ X_bsignal <- function(mf, vary, args) {
288288 fun = " cbs" )
289289 }
290290
291- colnames(Bs ) <- paste(xname , 1 : ncol(Bs ), sep = " " )
291+ colnames(Bs ) <- paste(xname , seq_len( ncol(Bs ) ), sep = " " )
292292
293293 # ## Penalty matrix: product differences matrix
294294 if (args $ differences > 0 ){
@@ -343,7 +343,7 @@ X_bsignal <- function(mf, vary, args) {
343343 # Design matrix is product of weighted X1 and basis expansion over xind
344344 X <- (L * X1 ) %*% Bs
345345
346- colnames(X ) <- paste0(xname , 1 : ncol(X ))
346+ colnames(X ) <- paste0(xname , seq_len( ncol(X ) ))
347347
348348 # # see Scheipl and Greven (2016):
349349 # # Identifiability in penalized function-on-function regression models
@@ -680,14 +680,14 @@ bsignal <- function(x, s, index = NULL, inS = c("smooth", "linear", "constant"),
680680
681681 varnames <- all.vars(cll )
682682 # if(length(mfL)==1){
683- # mfL[[2]] <- 1: ncol(mfL[[1]]); cll[[3]] <- "xind"
683+ # mfL[[2]] <- seq_len( ncol(mfL[[1]]) ); cll[[3]] <- "xind"
684684 # varnames <- c(all.vars(cll), "xindDefault")
685685 # }
686686
687687 # Reshape mfL so that it is the dataframe of the signal with the index as attribute
688688 xname <- varnames [1 ]
689689 indname <- varnames [2 ]
690- if (is.null(colnames(x ))) colnames(x ) <- paste(xname , 1 : ncol(x ), sep = " _" )
690+ if (is.null(colnames(x ))) colnames(x ) <- paste(xname , seq_len( ncol(x ) ), sep = " _" )
691691 attr(x , " signalIndex" ) <- s
692692 attr(x , " xname" ) <- xname
693693 attr(x , " indname" ) <- indname
@@ -870,12 +870,12 @@ X_conc <- function(mf, vary, args) {
870870 fun = " cbs" )
871871 }
872872
873- colnames(Bs ) <- paste(xname , 1 : ncol(Bs ), sep = " " )
873+ colnames(Bs ) <- paste(xname , seq_len( ncol(Bs ) ), sep = " " )
874874
875875 # set up design matrix for concurrent model
876876 if (args $ format == " wide" ){
877877 listCol <- list ()
878- for (i in 1 : ncol(X1 )){
878+ for (i in seq_len( ncol(X1 ) )){
879879 listCol [[i ]] <- X1 [,i ]
880880 }
881881 X1des <- as.matrix(bdiag(listCol ))
@@ -958,7 +958,7 @@ bconcurrent <- function(x, s, time, index = NULL, #by = NULL,
958958 attr(x , " id" ) <- index
959959
960960 if (mboost_intern(x , fun = " isMATRIX" ) &&
961- is.null(colnames(x ))) colnames(x ) <- paste(xname , 1 : ncol(x ), sep = " _" )
961+ is.null(colnames(x ))) colnames(x ) <- paste(xname , seq_len( ncol(x ) ), sep = " _" )
962962 attr(x , " signalIndex" ) <- s
963963 attr(x , " xname" ) <- xname
964964 attr(x , " indname" ) <- indname
@@ -1176,7 +1176,7 @@ X_hist <- function(mf, vary, args) {
11761176 " linear" = matrix (c(rep(1 , length(xind )), xind ), ncol = 2 ),
11771177 " constant" = matrix (c(rep(1 , length(xind ))), ncol = 1 ))
11781178
1179- colnames(Bs ) <- paste(xname , 1 : ncol(Bs ), sep = " " )
1179+ colnames(Bs ) <- paste(xname , seq_len( ncol(Bs ) ), sep = " " )
11801180
11811181 # integration weights
11821182 L <- args $ intFun(X1 = X1 , xind = xind )
@@ -1188,7 +1188,7 @@ X_hist <- function(mf, vary, args) {
11881188 # # set up design matrix for historical model and s<=t with s and t equal to xind
11891189 # # expand matrix of original observations to lower triangular matrix
11901190 # X1des0 <- matrix(0, ncol=ncol(X1), nrow=ncol(X1)*nrow(X1))
1191- # for(i in 1: ncol(X1des0)){
1191+ # for(i in seq_len( ncol(X1des0) )){
11921192 # #print(nrow(X1)*(i-1)+1)
11931193 # X1des0[(nrow(X1)*(i-1)+1):nrow(X1des0) ,i] <- X1[,i] # use fun. variable * integration weights
11941194 # }
@@ -1368,11 +1368,11 @@ X_hist <- function(mf, vary, args) {
13681368 # calculate row-tensor
13691369 # X <- (X1 %x% t(rep(1, ncol(X2))) ) * ( t(rep(1, ncol(X1))) %x% X2 )
13701370 dimnames(Bt ) <- NULL # otherwise warning "dimnames [2] mismatch..."
1371- X <- X1des [,rep(1 : ncol(Bs ), each = ncol(Bt ))] * Bt [,rep(1 : ncol(Bt ), times = ncol(Bs ))]
1371+ X <- X1des [, rep(seq_len( ncol(Bs )) , each = ncol(Bt ))] * Bt [, rep(seq_len( ncol(Bt ) ), times = ncol(Bs ))]
13721372
13731373 if (! mboost_intern(X , fun = " isMATRIX" ) ) X <- matrix (X , ncol = 1 )
13741374
1375- colnames(X ) <- paste0(xname , 1 : ncol(X ))
1375+ colnames(X ) <- paste0(xname , seq_len( ncol(X ) ))
13761376
13771377 # ## Penalty matrix: product differences matrix for smooth effect
13781378 if (args $ inS == " smooth" ){
@@ -1483,7 +1483,7 @@ bhist <- function(x, s, time, index = NULL, #by = NULL,
14831483 indname <- varnames [2 ]
14841484 indnameY <- varnames [3 ]
14851485 if (length(varnames )== 2 ) indnameY <- varnames [2 ]
1486- if (is.null(colnames(x ))) colnames(x ) <- paste(xname , 1 : ncol(x ), sep = " _" )
1486+ if (is.null(colnames(x ))) colnames(x ) <- paste(xname , seq_len( ncol(x ) ), sep = " _" )
14871487 attr(x , " signalIndex" ) <- s
14881488 attr(x , " xname" ) <- xname
14891489 attr(x , " indname" ) <- indname
@@ -1689,7 +1689,7 @@ X_fpc <- function(mf, vary, args) {
16891689 # #stop("In bfpc the grid for the functional covariate has to be the same as in the model fit!")
16901690 # # linear interpolation of the basis functions
16911691 approxEfunctions <- matrix (NA , nrow = length(xind ), ncol = length(args $ subset ))
1692- for (i in 1 : ncol(klX $ efunctions [ , args $ subset , drop = FALSE ])){
1692+ for (i in seq_len( ncol(klX $ efunctions [, args $ subset , drop = FALSE ]) )){
16931693 approxEfunctions [,i ] <- approx(x = args $ klX $ xind , y = klX $ efunctions [,i ], xout = xind )$ y
16941694 }
16951695 approxMu <- approx(x = args $ klX $ xind , y = klX $ mu , xout = xind )$ y
@@ -1700,7 +1700,7 @@ X_fpc <- function(mf, vary, args) {
17001700
17011701 }
17021702
1703- colnames(X ) <- paste(xname , " .PC" , 1 : ncol(X ), sep = " " )
1703+ colnames(X ) <- paste(xname , " .PC" , seq_len( ncol(X ) ), sep = " " )
17041704
17051705 # # set up the penalty matrix
17061706 K <- switch (args $ penalty ,
@@ -1747,7 +1747,7 @@ bfpc <- function(x, s, index = NULL, df = 4,
17471747 # Reshape mfL so that it is the dataframe of the signal with the index as attribute
17481748 xname <- varnames [1 ]
17491749 indname <- varnames [2 ]
1750- if (is.null(colnames(x ))) colnames(x ) <- paste(xname , 1 : ncol(x ), sep = " _" )
1750+ if (is.null(colnames(x ))) colnames(x ) <- paste(xname , seq_len( ncol(x ) ), sep = " _" )
17511751 attr(x , " signalIndex" ) <- s
17521752 attr(x , " xname" ) <- xname
17531753 attr(x , " indname" ) <- indname
@@ -1879,7 +1879,7 @@ X_bbsc <- function(mf, vary, args) {
18791879 if (vary != " " ) {
18801880 by <- model.matrix(as.formula(paste(" ~" , vary , collapse = " " )),
18811881 data = mf )[ , - 1 , drop = FALSE ] # drop intercept
1882- DM <- lapply(1 : ncol(by ), function (i ) {
1882+ DM <- lapply(seq_len( ncol(by ) ), function (i ) {
18831883 ret <- X * by [, i ]
18841884 colnames(ret ) <- paste(colnames(ret ), colnames(by )[i ], sep = " :" )
18851885 ret
@@ -2386,7 +2386,7 @@ X_olsc <- function(mf, vary, args) {
23862386 if (vary != " " ) {
23872387 by <- model.matrix(as.formula(paste(" ~" , vary , collapse = " " )),
23882388 data = mf )[ , - 1 , drop = FALSE ] # drop intercept
2389- DM <- lapply(1 : ncol(by ), function (i ) {
2389+ DM <- lapply(seq_len( ncol(by ) ), function (i ) {
23902390 ret <- X * by [, i ]
23912391 colnames(ret ) <- paste(colnames(ret ), colnames(by )[i ], sep = " :" )
23922392 ret
0 commit comments