Split the input to a list according to the stretching window size.

stretcher(.x, .step = 1, .init = 1, .bind = FALSE)

pstretcher(..., .step = 1, .init = 1, .bind = FALSE)

## Arguments

.x An objects to be split. A positive integer for incremental step. A positive integer for an initial window size. If .x is a list, should .x be combined before applying .f? If .x is a list of data frames, row binding is carried out. Multiple objects to be split in parallel.

## Examples

x <- 1:5
y <- 6:10
z <- 11:15
lst <- list(x = x, y = y, z = z)
df <- as.data.frame(lst)

stretcher(x, .step = 2)#> [[1]]
#> [1] 1
#>
#> [[2]]
#> [1] 1 2 3
#>
#> [[3]]
#> [1] 1 2 3 4 5
#> stretcher(lst, .step = 2)#> [[1]]
#> [[1]]$x #> [1] 1 2 3 4 5 #> #> #> [[2]] #> [[2]]$x
#> [1] 1 2 3 4 5
#>
#> [[2]]$y #> [1] 6 7 8 9 10 #> #> [[2]]$z
#> [1] 11 12 13 14 15
#>
#> stretcher(df, .step = 2)#> [[1]]
#> [[1]]$x #> [1] 1 2 3 4 5 #> #> #> [[2]] #> [[2]]$x
#> [1] 1 2 3 4 5
#>
#> [[2]]$y #> [1] 6 7 8 9 10 #> #> [[2]]$z
#> [1] 11 12 13 14 15
#>
#> pstretcher(df, df, .step = 2)#> [[1]]
#> [[1]][[1]]
#> [[1]][[1]]$x #> [1] 1 2 3 4 5 #> #> #> [[1]][[2]] #> [[1]][[2]]$x
#> [1] 1 2 3 4 5
#>
#> [[1]][[2]]$y #> [1] 6 7 8 9 10 #> #> [[1]][[2]]$z
#> [1] 11 12 13 14 15
#>
#>
#>
#> [[2]]
#> [[2]][[1]]
#> [[2]][[1]]$x #> [1] 1 2 3 4 5 #> #> #> [[2]][[2]] #> [[2]][[2]]$x
#> [1] 1 2 3 4 5
#>
#> [[2]][[2]]$y #> [1] 6 7 8 9 10 #> #> [[2]][[2]]$z
#> [1] 11 12 13 14 15
#>
#>
#>