Variables follow snake case naming style (unless they overlap with Shiny syntax).
Try to give meaningful and self explanatory names.
my_variable <- 33
function(input, another_argument){}
Constants are defined with capital letter snake case and kept in the
constants.R script (unless they're internal).
COLORS <- c("red", "green", "blue")Function are called with snake_case.
-
Functions that define UI should contain name of the element, eg.
box,horizontal_menu -
Functions that define active elements should contain
inputin their name, eg.checkbox_input.
When overriding shiny functions we usually follow shiny styling. Usually it requires
creating a function with shiny.semantic syntax and then implementing a wrapper that
follows shiny syntax.
!! Here argument names can actually follow camelCase syntax.
Example:
# semantic styling
action_button <- function(input_id, label, icon = NULL, width = NULL, ...) {
...
}
# shiny styling
actionButton <- function(inputId, label, icon = NULL, width = NULL, ...) {
...
}