r-lib/rray

set_row_names(Titanic, NULL) should set the slot to NULL, not remove it

Closed this issue · 1 comments

library(rray); set_row_names(Titanic, NULL)
#> Error in dimnames(x) <- value: length of 'dimnames' [1] not equal to array extent

Created on 2019-06-03 by the reprex package (v0.2.1.9000)

With all the validations you already have in place, perhaps it is safe to do this:
set_dim_names <-function (x, n, nms)
{
dim <- rray_dim(x)
n <- vec_cast(n, integer())
validate_scalar_n(n)
validate_requested_dims(x, n)
nms <- vec_cast(nms, character())
validate_equal_size_or_no_names(dim[n], vec_size(nms))
rray_dim_names(x)[n] <- list(nms) ############ change just here, to admit NULL
x
}