Skip to content

Commit 14cbe56

Browse files
committed
.
1 parent d1d975f commit 14cbe56

2 files changed

Lines changed: 5 additions & 2 deletions

File tree

R/transpose.R

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,8 @@
11
transpose = function(l, fill=NA, ignore.empty=FALSE, keep.names=NULL, make.names=NULL, list.cols=FALSE, keep=NULL) {
2-
if (!is.null(keep)) keep = as.integer(keep)
2+
if (!is.null(keep)) {
3+
if (!is.numeric(keep)) stopf("'keep' must be an integer vector.")
4+
keep = as.integer(keep)
5+
}
36
if (!is.null(make.names)) {
47
stopifnot(length(make.names)==1L)
58
if (is.character(make.names)) {

inst/tests/tests.Rraw

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21988,7 +21988,7 @@ test(2387.06, setnafill(copy(DT3), type="locf", cols=c(TRUE,FALSE)), error="'col
2198821988

2198921989
# transpose() supports keep argument, #5250
2199021990
x = list(1:5, 6:10, 11:15)
21991-
test(2388.01, transpose(x, keep=1:2), transpose(x)[1:2])
21991+
test(2388.01, transpose(list(1:5), keep="a"), error="'keep' must be an integer vector.")
2199221992
test(2388.02, transpose(x, keep=c(5L,3L,1L)), transpose(x)[c(5,3,1)])
2199321993
test(2388.03, transpose(x, keep=c(1L,1L,3L)), transpose(x)[c(1,1,3)])
2199421994
test(2388.04, transpose(x, keep=NULL), transpose(x))

0 commit comments

Comments
 (0)