search for: lstargs

Displaying 9 results from an estimated 9 matches for "lstargs".

Did you mean: astargs
2019 Jul 13
2
head.matrix can return 1000s of columns -- limit to n or add new argument?
...ndvecs = lapply(seq_along(dim(x)), function(i) { if(length(n) >= i) { ni = n[i] } else { ni = dim(x)[i] } if(ni < 0L) ni = max(nrow(x) + ni, 0L) else ni = min(ni, dim(x)[i]) seq_len(ni) }) lstargs = c(list(x),indvecs, drop = FALSE) do.call("[", lstargs) } > mat = matrix(1:100, 10, 10) > *head(mat)* [,1] [,2] [,3] [,4] [,5] [,6] [,7] [,8] [,9] [,10] [1,] 1 11 21 31 41 51 61 71 81 91 [2,] 2 12 22 32 42 52 62 72 82 92 [...
2019 Sep 16
5
head.matrix can return 1000s of columns -- limit to n or add new argument?
...t; >> head2 = function(x, n = 6L, ...) { indvecs = >> lapply(seq_along(dim(x)), function(i) { if(length(n) >= >> i) { ni = n[i] } else { ni = dim(x)[i] } if(ni < 0L) ni = >> max(nrow(x) + ni, 0L) else ni = min(ni, dim(x)[i]) >> seq_len(ni) }) lstargs = c(list(x),indvecs, drop = FALSE) >> do.call("[", lstargs) } >> >> >> > mat = matrix(1:100, 10, 10) >> >> > *head(mat)* >> >> [,1] [,2] [,3] [,4] [,5] [,6] [,7] [,8] [,9] [,10] >> &gt...
2019 Sep 15
0
head.matrix can return 1000s of columns -- limit to n or add new argument?
...if(length(n) >= i) { > ni = n[i] > } else { > ni = dim(x)[i] > } > if(ni < 0L) > ni = max(nrow(x) + ni, 0L) > else > ni = min(ni, dim(x)[i]) > seq_len(ni) > }) > lstargs = c(list(x),indvecs, drop = FALSE) > do.call("[", lstargs) > } > > > > mat = matrix(1:100, 10, 10) > > > *head(mat)* > > [,1] [,2] [,3] [,4] [,5] [,6] [,7] [,8] [,9] [,10] > > [1,] 1 11 21 31 41 51 61 71 81 91 > >...
2019 Sep 16
0
head.matrix can return 1000s of columns -- limit to n or add new argument?
...d2 = function(x, n = 6L, ...) { indvecs = > >> lapply(seq_along(dim(x)), function(i) { if(length(n) >= > >> i) { ni = n[i] } else { ni = dim(x)[i] } if(ni < 0L) ni = > >> max(nrow(x) + ni, 0L) else ni = min(ni, dim(x)[i]) > >> seq_len(ni) }) lstargs = c(list(x),indvecs, drop = FALSE) > >> do.call("[", lstargs) } > >> > >> > >> > mat = matrix(1:100, 10, 10) > >> > >> > *head(mat)* > >> > >> [,1] [,2] [,3] [,4] [,5] [,6] [,7] [...
2019 Jul 08
2
head.matrix can return 1000s of columns -- limit to n or add new argument?
I think of head() as a standard helper for "glancing" at objects, so I'm sometimes surprised that head() produces massive output: M = matrix(nrow = 10L, ncol = 100000L) print(head(M)) # <- beware, could be a huge print I assume there are lots of backwards-compatibility issues as well as valid use cases for this behavior, so I guess defaulting to M[1:6, 1:6] is out of the
2019 Sep 17
0
head.matrix can return 1000s of columns -- limit to n or add new argument?
...n(x, n = 6L, ...) { indvecs = >>>>> lapply(seq_along(dim(x)), function(i) { if(length(n) >= >>>>> i) { ni = n[i] } else { ni = dim(x)[i] } if(ni < 0L) ni = >>>>> max(nrow(x) + ni, 0L) else ni = min(ni, dim(x)[i]) >>>>> seq_len(ni) }) lstargs = c(list(x),indvecs, drop = FALSE) >>>>> do.call("[", lstargs) } >>>>> >>>>> >>>>>> mat = matrix(1:100, 10, 10) >>>>> >>>>>> *head(mat)* >>>>> >>>>> [,1] [,2]...
2019 Sep 17
2
head.matrix can return 1000s of columns -- limit to n or add new argument?
...t;>>> lapply(seq_along(dim(x)), function(i) { if(length(n) >= >>>>>>> i) { ni = n[i] } else { ni = dim(x)[i] } if(ni < 0L) ni = >>>>>>> max(nrow(x) + ni, 0L) else ni = min(ni, dim(x)[i]) >>>>>>> seq_len(ni) }) lstargs = c(list(x),indvecs, drop = FALSE) >>>>>>> do.call("[", lstargs) } >>>>>>> >>>>>>> >>>>>>>> mat = matrix(1:100, 10, 10) >>>>>>> >>>>>>&g...
2019 Sep 17
0
head.matrix can return 1000s of columns -- limit to n or add new argument?
...) { indvecs = >>>>>> lapply(seq_along(dim(x)), function(i) { if(length(n) >= >>>>>> i) { ni = n[i] } else { ni = dim(x)[i] } if(ni < 0L) ni = >>>>>> max(nrow(x) + ni, 0L) else ni = min(ni, dim(x)[i]) >>>>>> seq_len(ni) }) lstargs = c(list(x),indvecs, drop = FALSE) >>>>>> do.call("[", lstargs) } >>>>>> >>>>>> >>>>>>> mat = matrix(1:100, 10, 10) >>>>>> >>>>>>> *head(mat)* >>>>>> &gt...
2019 Oct 18
0
head.matrix can return 1000s of columns -- limit to n or add new argument?
...lapply(seq_along(dim(x)), function(i) { if(length(n) >= > >>>>>>> i) { ni = n[i] } else { ni = dim(x)[i] } if(ni < 0L) ni = > >>>>>>> max(nrow(x) + ni, 0L) else ni = min(ni, dim(x)[i]) > >>>>>>> seq_len(ni) }) lstargs = c(list(x),indvecs, drop = FALSE) > >>>>>>> do.call("[", lstargs) } > >>>>>>> > >>>>>>> > >>>>>>>> mat = matrix(1:100, 10, 10) > >>>>>>> >...