Hi,
modify_depth fails when higher levels have a mix of NULLs and non-NULLs e.g.
> aa <- list(a = NULL, b = list(b1 = NULL, b2 = "hello"))
> aa
$a
NULL
$b
$b$b1
NULL
$b$b2
[1] "hello"
> modify_depth(aa,
+ .depth = 2,
+ is.character,
+ .ragged = TRUE
+ )
Error in .x[[i]] : subscript out of bounds
I would expect
$a
NULL
$b
$b$b1
NULL
$b$b2
[1] "TRUE"
Works when the first level has no NULLs
> aa <- list(a = "hi", b = list(b1 = NULL, b2 = "hello"))
> aa
$a
[1] "hi"
$b
$b$b1
NULL
$b$b2
[1] "hello"
> modify_depth(aa,
+ .depth = 2,
+ is.character,
+ .ragged = TRUE
+ )
$a
[1] "TRUE"
$b
$b$b1
[1] FALSE
$b$b2
[1] TRUE
And btw why is the upper level type-stable, and not the lower level ?
And why is it the same when .ragged = FALSE ?
> modify_depth(aa,
+ .depth = 2,
+ is.character
+ )
$a
[1] "TRUE"
$b
$b$b1
[1] FALSE
$b$b2
[1] TRUE
Thanks!
Hi,
modify_depthfails when higher levels have a mix of NULLs and non-NULLs e.g.I would expect
Works when the first level has no NULLs
And btw why is the upper level type-stable, and not the lower level ?
And why is it the same when
.ragged = FALSE?Thanks!