# R ENVIRONMENT
library(shiny)
# UI, this is a function call, so contents are elements = need commas between
ui <- fluidPage()
# SERVER, this is a function definition, so contents are objects
server <- function(input, output){}
shinyApp(ui = ui, server = server)
We want to load our packages, maybe set up some data, e.g.:
library(shiny)
library(leaflet)
We want to include:
selectInput()numericInput()numericInput()actionButton()plotOutput()tableOutput() or dataTableOutput()downloadButton()We want to include:
list()?renderPlot()renderTable() or DT::renderDataTable()downloadHandler()This will get you started on data storage
In a new R file, try this:
source("global.R")
current_time <- as.character(Sys.time())
test_data <- data.frame(addtime=c(current_time,current_time),
site=c("Site1","Site2"),
weather=c(2,3),
nwidgets=c(10,12.3))
save_db(test_data)
xx <- load_db()
print(xx)
Does it work?
library(leaflet)
m <- leaflet() %>%
addTiles() %>% # Add default OpenStreetMap map tiles
addMarkers(lng=174.768, lat=-36.852, popup="The birthplace of R")
m # Print the map
(from RStudio)