on the page.
C. Navigation: make everything doable with a keyboard
textInput() with a validation button and {nter} package
# Adapted from https://github.com/JohnCoene/nter
library(nter)
library(shiny)
fluidPage(
ui <-# Setting a text input and a button
textInput("text", ""),
# This button will be clicked when 'Enter' is pressed in
# the textInput text
actionButton("send", "Do not click hit enter"),
verbatimTextOutput("typed"),
# define the rule
nter("send", "text")
)
function(input, output) {
server <-
reactiveValues()
r <-
# Define the behavior on click
observeEvent( input$send , {
$printed <- input$text
r
})
# Render the text
$typed <- renderPrint({
output$printed
r
})
}
shinyApp(ui, server)
D. Color choices: recommended to use provided color composition such as viridis or other specific combinations.
Here as an example is the build of a function, but other packages can be used such as {dichromat} packages which simulates color blindness.
function(palette) {
with_palette <- y <- seq(-8 * pi, 8 * pi, len = 40)
x <- sqrt(outer(x^2, y^2, "+"))
r <- cos(r^2) * exp(-r / (2 * pi))
z <-filled.contour(
z,axes = FALSE,
color.palette = palette,
asp = 1
)
}
with_palette(matlab::jet.colors)