Title: | 'RStudio' Addin for Teaching and Learning 'ggplot2' |
---|---|
Description: | An 'RStudio' addin for teaching and learning making plot using the 'ggplot2' package. You can learn each steps of making plot by clicking your mouse without coding. You can get resultant code for the plot. |
Authors: | Keon-Woong Moon [aut, cre] |
Maintainer: | Keon-Woong Moon <[email protected]> |
License: | GPL-3 |
Version: | 0.1.4 |
Built: | 2025-02-16 04:47:19 UTC |
Source: | https://github.com/cardiomoon/ggplotassist |
A shiny app for learn ggplot2
ggplotAssist(df = NULL, viewer = "browser")
ggplotAssist(df = NULL, viewer = "browser")
df |
A tibble or a tbl_df or a data.frame to manipulate |
viewer |
Specify where the gadget should be displayed. Possible choices are c("dialog","browser","pane") |
An R code for ggplot
library(tidyverse) library(rstudioapi) library(miniUI) library(moonBook) library(shinyAce) library(ggthemes) library(shiny) library(stringr) library(editData) library(shinyWidgets) library(gcookbook) library(shiny) # Only run examples in interactive R sessions if (interactive()) { result<-ggplotAssist(mtcars) result }
library(tidyverse) library(rstudioapi) library(miniUI) library(moonBook) library(shinyAce) library(ggthemes) library(shiny) library(stringr) library(editData) library(shinyWidgets) library(gcookbook) library(shiny) # Only run examples in interactive R sessions if (interactive()) { result<-ggplotAssist(mtcars) result }
side-by-side selectizeInput
selectizeInput3(..., width = 100)
selectizeInput3(..., width = 100)
... |
Further arguments to be passed to selectizeInput |
width |
Input width in pixel |
library(shiny) # Only run examples in interactive R sessions if (interactive()) { ui <- fluidPage( selectizeInput3("color", "color", choices=colors()) ) server <- function(input, output) { } shinyApp(ui, server) }
library(shiny) # Only run examples in interactive R sessions if (interactive()) { ui <- fluidPage( selectizeInput3("color", "color", choices=colors()) ) server <- function(input, output) { } shinyApp(ui, server) }
Elongate data.frame with column split by comma
splitData(df, colname)
splitData(df, colname)
df |
a data.frame |
colname |
column name |
An elongated data.frame
Create side-by side textAreaInput with disabled spell check
textAreaInput4(inputId, label, value = "", bg = NULL, width = "100%", ...)
textAreaInput4(inputId, label, value = "", bg = NULL, width = "100%", ...)
inputId |
The input slot that will be used to access the value. |
label |
Display label for the control, or NULL for no label. |
value |
Initial value. |
bg |
backgroung color |
width |
The width of the input in pixel |
... |
arguments to be passed to textInput |
library(shiny) # Only run examples in interactive R sessions if (interactive()) { ui <- fluidPage( textAreaInput4("Code","Code","") ) server <- function(input, output) { } shinyApp(ui, server) }
library(shiny) # Only run examples in interactive R sessions if (interactive()) { ui <- fluidPage( textAreaInput4("Code","Code","") ) server <- function(input, output) { } shinyApp(ui, server) }
Server function of textFunction shiny module
textFunction(input, output, session, argList = reactive(argList), editCode = reactive(TRUE), settingData = reactive(NULL))
textFunction(input, output, session, argList = reactive(argList), editCode = reactive(TRUE), settingData = reactive(NULL))
input |
input |
output |
output |
session |
session |
argList |
A list containing options |
editCode |
Logical. Wheter or not edit initial R code |
settingData |
A data.frame contains information about functions |
UI of textFunction shiny module
textFunctionInput(id)
textFunctionInput(id)
id |
A string |
library(ggplotAssist) library(shiny) # Only run examples in interactive R sessions if(interactive()){ ui=fluidPage( textFunctionInput("text"), textOutput("text") ) server=function(input,output,session){ rv=reactiveValues() rawData=read.csv("data-raw/setting.csv",stringsAsFactors = FALSE) settingData=splitData(rawData,"setting") rv$argList<-list(label="text",mode="text",value="element_text()",choices=NULL,width=200, bg="lightcyan",placeholder="") result=callModule(textFunction,"text",argList=reactive(rv$argList), editCode=reactive(TRUE),settingData=reactive(settingData)) output$text=renderText({ result() }) } shinyApp(ui,server) }
library(ggplotAssist) library(shiny) # Only run examples in interactive R sessions if(interactive()){ ui=fluidPage( textFunctionInput("text"), textOutput("text") ) server=function(input,output,session){ rv=reactiveValues() rawData=read.csv("data-raw/setting.csv",stringsAsFactors = FALSE) settingData=splitData(rawData,"setting") rv$argList<-list(label="text",mode="text",value="element_text()",choices=NULL,width=200, bg="lightcyan",placeholder="") result=callModule(textFunction,"text",argList=reactive(rv$argList), editCode=reactive(TRUE),settingData=reactive(settingData)) output$text=renderText({ result() }) } shinyApp(ui,server) }
Create side-by side textInput with disabled spell check
textInput4(inputId, label, value = "", width = 100, bg = NULL, ...)
textInput4(inputId, label, value = "", width = 100, bg = NULL, ...)
inputId |
The input slot that will be used to access the value. |
label |
Display label for the control, or NULL for no label. |
value |
Initial value. |
width |
The width of the input in pixel |
bg |
backgroung color |
... |
arguments to be passed to textInput |
library(shiny) # Only run examples in interactive R sessions if (interactive()) { ui <- fluidPage( textInput4("id", "id", ""), textInput4("name","name","") ) server <- function(input, output) { } shinyApp(ui, server) }
library(shiny) # Only run examples in interactive R sessions if (interactive()) { ui <- fluidPage( textInput4("id", "id", ""), textInput4("name","name","") ) server <- function(input, output) { } shinyApp(ui, server) }
Create side-by side uiOutput
uiOutput3(...)
uiOutput3(...)
... |
arguments to be passed to uiOutput |
library(shiny) # Only run examples in interactive R sessions if (interactive()) { ui <- fluidPage( textInput4("name","name",""), uiOutput3("test") ) server <- function(input, output) { } shinyApp(ui, server) }
library(shiny) # Only run examples in interactive R sessions if (interactive()) { ui <- fluidPage( textInput4("name","name",""), uiOutput3("test") ) server <- function(input, output) { } shinyApp(ui, server) }