Warning is splitLayout() function

There is an error n the code of splitLayout() function (shiny 1.7.1) that produce warnings:
if (length(cellWidths) == 0 || is.na(cellWidths)) {
cellWidths can be of length > 1 and it produced a warning.

Replace by :
if (length(cellWidths) == 0 || any(is.na(cellWidths))) {
Solve this problem.

Corrected code:
splitLayout <- function (..., cellWidths = NULL, cellArgs = list())
{
children <- list2(...)
childIdx <- !nzchar(names(children) %||% character(length(children)))
attribs <- children[!childIdx]
children <- children[childIdx]
count <- length(children)
if (length(cellWidths) == 0 || any(is.na(cellWidths))) {
cellWidths <- sprintf("%.3f%%", 100/count)
}
cellWidths <- rep(cellWidths, length.out = count)
cellWidths <- sapply(cellWidths, validateCssUnit)
do.call(tags$div, c(list(class = "shiny-split-layout"), attribs,
mapply(children, cellWidths, FUN = function(x, w) {
do.call(tags$div, c(list(style = sprintf("width: %s;",
w)), cellArgs, list(x)))
}, SIMPLIFY = FALSE)))
}

This topic was automatically closed 54 days after the last reply. New replies are no longer allowed.

If you have a query related to it or one of the replies, start a new topic and refer back with a link.