inst/shiny/v1.3/gene_expression/out_number_of_selected_cells.R

##----------------------------------------------------------------------------##
## Text showing the number of selected cells.
##----------------------------------------------------------------------------##
output[["expression_number_of_selected_cells"]] <- renderText({
  ## check selection
  ## ... selection has not been made or there is no cell in it
  if ( is.null(expression_projection_selected_cells()) ) {
    ## manually set counter to 0
    number_of_selected_cells <- 0
  ## ... selection has been made and at least 1 cell is in it
  } else {
    ## get number of selected cells
    number_of_selected_cells <- expression_projection_selected_cells() %>%
      nrow() %>%
      formatC(format = "f", big.mark = ",", digits = 0)
  }
  ## prepare string to show
  paste0("<b>Number of selected cells</b>: ", number_of_selected_cells)
})
romanhaa/cerebroApp documentation built on Nov. 25, 2021, 5:29 p.m.