This file contains hidden or 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
#### Brief introduction to R Plotly package #### | |
# The plotly package in R is an interface to open source Javascript charting library plotly.js | |
# Plots can be created online in the plotly web GUI or offline using the plotly package | |
# Interactive plots that can be easily shared online using the plotly API/account | |
# Plotly plots can embed into R Markdown, R Shiny | |
# Tool tip feature and other controls | |
# ggplot2 graphs can be easily converted to interactive plotly objects using ggplotly() function | |
# Package documentation | |
# https://cran.r-project.org/web/packages/plotly/plotly.pdf |
This file contains hidden or 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) | |
library(plotly) | |
library(ggplot2) | |
shinyServer(function(input,output)({ | |
## Below plotting using plotly | |
output$plotlyplot <- renderPlotly({ | |
p = plot_ly(data = iris, y=~Sepal.Length, type = "scatter") | |
# Using the export function to save the plot after the click of action button |
This file contains hidden or 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) | |
shinyServer(function(input,output)({ | |
# x contains all the observations of the x variable selected by the user. X is a reactive function | |
x <- reactive({ | |
iris[,as.numeric(input$var1)] | |
}) | |
# x contains all the observations of the y variable selected by the user. Y is a reactive function | |
y <- reactive({ | |
iris[,as.numeric(input$var2)] | |
This file contains hidden or 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
Title: Experiment with plotly and dygraphs and save the output plot. Used export() function. | |
Description: Experiment with plotly and dygraphs and save the output plot. Used export() function to save the plot. | |
License: GPL-3 | |
Author: Abhinav Agrawal | |
DisplayMode: Showcase | |
Tags: R, R Shiny | |
Type: Shiny |
This file contains hidden or 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) # Load shiny package | |
data(iris) # Load the iris dataset | |
shinyServer( | |
function(input, output) { | |
output$text1 <- renderText({ |
This file contains hidden or 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
Title: reactiveValues() function | |
Description: With reactiveValues(), you can create your own reactive values. reactiveValues() Creates a list of objects that can be manipulated within a reactive context (within observer or observerEvent with dependency on changes in certain input or state of an object). reactiveValues() objects are not reactive themselves and do not re-execute themselves when input value changes unlike reactive objects. Powered by R, Shiny, and RStudio. | |
License: GPL-3 | |
Author: Abhinav Agrawal | |
DisplayMode: Showcase | |
Tags: R, R Shiny,reactiveValues(), observeEvent() | |
Type: Shiny |
This file contains hidden or 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) | |
shinyServer((function(input, output) { | |
values <- reactiveValues(df = NULL) | |
observeEvent(input$file, { | |
values$df <- read.csv(input$file$datapath) | |
}) | |
observeEvent(input$delete, { | |
values$df <- values$df[-input$rowno, ] |
This file contains hidden or 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
Title: reactiveValues() function | |
Description: With reactiveValues(), you can create your own reactive values. reactiveValues() Creates a list of objects that can be manipulated within a reactive context (within observer or observerEvent with dependency on changes in certain input or state of an object). reactiveValues() objects are not reactive themselves and do not re-execute themselves when input value changes unlike reactive objects. Powered by R, Shiny, and RStudio. | |
License: GPL-3 | |
Author: Abhinav Agrawal | |
DisplayMode: Showcase | |
Tags: R, R Shiny,reactiveValues(), observeEvent() | |
Type: Shiny |
This file contains hidden or 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) | |
library(ggplot2) | |
library(gridExtra) | |
shinyServer(function(input,output)({ | |
# downloadHandler contains 2 arguments as functions, namely filename, content | |
output$down <- downloadHandler( | |
filename = function() { | |
paste("multiplot.pdf") |
This file contains hidden or 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) | |
shinyServer(function(input, output,session){ | |
}) |