R Under development (unstable) (2025-07-11 r88405 ucrt) -- "Unsuffered Consequences" Copyright (C) 2025 The R Foundation for Statistical Computing Platform: x86_64-w64-mingw32/x64 R is free software and comes with ABSOLUTELY NO WARRANTY. You are welcome to redistribute it under certain conditions. Type 'license()' or 'licence()' for distribution details. R is a collaborative project with many contributors. Type 'contributors()' for more information and 'citation()' on how to cite R or R packages in publications. Type 'demo()' for some demos, 'help()' for on-line help, or 'help.start()' for an HTML browser interface to help. Type 'q()' to quit R. > library(dclone) Loading required package: coda Loading required package: parallel Loading required package: Matrix dclone 2.3-3 2025-07-12 > > x <- 1 > x1 <- dclone(x, 1) > x2 <- dclone(x, 2) > stopifnot(length(x1) == length(x)) > stopifnot(length(x2) == length(x)*2) > > x <- 1:2 > x1 <- dclone(x, 1) > x2 <- dclone(x, 2) > stopifnot(length(x1) == length(x)) > stopifnot(length(x2) == length(x)*2) > > x <- matrix(1:6, 2, 3) > x1 <- dclone(x, 1) > x2 <- dclone(x, 2) > stopifnot(all(dim(x1) == dim(x))) > stopifnot(all(dim(x2) == dim(x)*c(2,1))) > > x <- dctr(matrix(1:6, 2, 3)) > x1 <- dclone(x, 1) > x2 <- dclone(x, 2) > stopifnot(all(dim(x1) == dim(x))) > stopifnot(all(dim(x2) == dim(x)*c(1,2))) > > x <- dciid(data.frame(a=1:3, b=4:6)) > x1 <- dclone(x, 1) > x2 <- dclone(x, 2) > stopifnot(all(dim(x1) == dim(x))) > stopifnot(all(dim(x2) == dim(x)*c(2,1))) > > ## array > x <- dcdim(array(1:6, c(2, 3, 1))) > x1 <- dclone(x, 1) > x2 <- dclone(x, 2) > x , , 1 [,1] [,2] [,3] [1,] 1 3 5 [2,] 2 4 6 attr(,"drop") [1] TRUE attr(,"class") [1] "dcdim" "array" > x1 , , 1 [,1] [,2] [,3] [1,] 1 3 5 [2,] 2 4 6 attr(,"drop") [1] TRUE attr(,"class") [1] "dcdim" "array" > x2 , , clone.1 [,1] [,2] [,3] [1,] 1 3 5 [2,] 2 4 6 , , clone.2 [,1] [,2] [,3] [1,] 1 3 5 [2,] 2 4 6 attr(,"n.clones") [1] 2 attr(,"n.clones")attr(,"method") [1] "dim" attr(,"n.clones")attr(,"method")attr(,"drop") [1] TRUE > stopifnot(all(dim(x1) == dim(x))) > stopifnot(all(dim(x2) == dim(x)*c(1,1,2))) > > x <- dcdim(array(1:6, c(1, 2, 3)), perm = 1) > x1 <- dclone(x, 1) > x2 <- dclone(x, 2) > x , , 1 [,1] [,2] [1,] 1 2 , , 2 [,1] [,2] [1,] 3 4 , , 3 [,1] [,2] [1,] 5 6 attr(,"perm") [1] 1 attr(,"drop") [1] TRUE attr(,"class") [1] "dcdim" "array" > x1 , , 1 [,1] [,2] [1,] 1 2 , , 2 [,1] [,2] [1,] 3 4 , , 3 [,1] [,2] [1,] 5 6 attr(,"perm") [1] 1 attr(,"drop") [1] TRUE attr(,"class") [1] "dcdim" "array" > x2 , , 1 [,1] [,2] clone.1 1 2 clone.2 1 2 , , 2 [,1] [,2] clone.1 3 4 clone.2 3 4 , , 3 [,1] [,2] clone.1 5 6 clone.2 5 6 attr(,"n.clones") [1] 2 attr(,"n.clones")attr(,"method") [1] "dim" attr(,"n.clones")attr(,"method")attr(,"drop") [1] TRUE attr(,"n.clones")attr(,"method")attr(,"perm") [1] 1 > stopifnot(all(dim(x1) == dim(x))) > stopifnot(all(dim(x2) == dim(x)*c(2,1,1))) > > > x <- dcdim(array(1:6, c(2, 1, 3)), perm = 2) > x1 <- dclone(x, 1) > x2 <- dclone(x, 2) > x , , 1 [,1] [1,] 1 [2,] 2 , , 2 [,1] [1,] 3 [2,] 4 , , 3 [,1] [1,] 5 [2,] 6 attr(,"perm") [1] 2 attr(,"drop") [1] TRUE attr(,"class") [1] "dcdim" "array" > x1 , , 1 [,1] [1,] 1 [2,] 2 , , 2 [,1] [1,] 3 [2,] 4 , , 3 [,1] [1,] 5 [2,] 6 attr(,"perm") [1] 2 attr(,"drop") [1] TRUE attr(,"class") [1] "dcdim" "array" > x2 , , 1 clone.1 clone.2 [1,] 1 1 [2,] 2 2 , , 2 clone.1 clone.2 [1,] 3 3 [2,] 4 4 , , 3 clone.1 clone.2 [1,] 5 5 [2,] 6 6 attr(,"n.clones") [1] 2 attr(,"n.clones")attr(,"method") [1] "dim" attr(,"n.clones")attr(,"method")attr(,"drop") [1] TRUE attr(,"n.clones")attr(,"method")attr(,"perm") [1] 2 > stopifnot(all(dim(x1) == dim(x))) > stopifnot(all(dim(x2) == dim(x)*c(1,2,1))) > > ## matrix > x <- dcdim(matrix(1:6, 2, 3)) > x1 <- dclone(x, 1) > x2 <- dclone(x, 2) > x [,1] [,2] [,3] [1,] 1 3 5 [2,] 2 4 6 attr(,"drop") [1] TRUE attr(,"class") [1] "dcdim" "matrix" "array" > x1 [,1] [,2] [,3] [1,] 1 3 5 [2,] 2 4 6 attr(,"drop") [1] TRUE attr(,"class") [1] "dcdim" "matrix" "array" > x2 , , clone.1 [,1] [,2] [,3] [1,] 1 3 5 [2,] 2 4 6 , , clone.2 [,1] [,2] [,3] [1,] 1 3 5 [2,] 2 4 6 attr(,"n.clones") [1] 2 attr(,"n.clones")attr(,"method") [1] "dim" attr(,"n.clones")attr(,"method")attr(,"drop") [1] TRUE > # stopifnot(all(dim(x1) == dim(x))) > # stopifnot(all(dim(x2) == dim(x)*c(1,2))) > > > proc.time() user system elapsed 5.26 0.25 5.50