This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
library(shiny) | |
shinyApp( | |
ui = fluidPage( | |
actionButton("show", "Show") | |
), | |
server = function(input, output) { | |
observeEvent(input$show, { | |
showNotification( | |
"Form Submitted", |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
library(httr) | |
library(jsonlite) | |
resp <- GET("https://api.morph.io/cecilialee/morph-scraper/data.json", | |
query = list("query" = "select * from 'data'", | |
"key" = "Kiu/NDU9OrgwJCJ1X/+2")) # fake API | |
dshk <- content(resp, as = "text") | |
dshk_df <- fromJSON(dshk) | |
# library(tidyverse) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
library(shiny) | |
shinyApp( | |
# ui ------------------------------------------------------------------------ | |
ui = basicPage( | |
actionButton("skip", "Skip"), | |
textOutput("status") | |
), |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Get a single gist | |
library(httr) | |
url <- "https://api.github.com" | |
user <- "cecilialee" | |
r <- GET(sprintf("%s/users/%s/gists", url, user)) | |
gists <- content(r) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
library(tidyverse) | |
my_list %>% | |
do.call(rbind, .) %>% | |
as.tibble() | |
# https://sebastiansauer.github.io/convert_list_to_dataframe/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
library(plyr) | |
nested_list <- list( | |
a = list( | |
x = 1, | |
y = 2 | |
), | |
b = list( | |
x = 3, | |
y = 4 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Using for loop | |
library(shiny) | |
ui = basicPage( | |
numericInput("n", "Number", 1, min = 1), | |
actionButton("add", "Add UI") | |
) | |
server = function(input, output, session) { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Using double brackets | |
## Understanding inputs and outputs as a list. Their values are accessable via double brackets. | |
library(shiny) | |
ui = basicPage( | |
textInput("txt", "Text"), | |
textOutput("ptxt") | |
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
library(shiny) | |
ui = basicPage( | |
# inputs | |
textInput("txt", "Text"), | |
numericInput("n", "Number", 1), | |
actionButton("submit", "Submit"), | |
# outputs | |
uiOutput("ui") | |
) |
OlderNewer