Title: | 'RStudio' Addin for Editing a 'data.frame' |
---|---|
Description: | An 'RStudio' addin for editing a 'data.frame' or a 'tibble'. You can delete, add or update a 'data.frame' without coding. You can get resultant data as a 'data.frame'. In the package, modularized 'shiny' app codes are provided. These modules are intended for reuse across applications. |
Authors: | Keon-Woong Moon [aut, cre] |
Maintainer: | Keon-Woong Moon <[email protected]> |
License: | GPL-3 |
Version: | 0.2.1 |
Built: | 2024-11-23 06:19:31 UTC |
Source: | https://github.com/cardiomoon/editdata |
Create a side-by-side checkboxInput
checkboxInput3(inputId, label, value = FALSE, width = 100)
checkboxInput3(inputId, label, value = FALSE, 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. |
width |
The width of the input in pixel |
library(shiny) # Only run examples in interactive R sessions if (interactive()) { ui <- fluidPage( label3("Welcome"), checkboxInput3("somevalue", "Some value", FALSE), verbatimTextOutput("value") ) server <- function(input, output) { output$value <- renderText({ input$somevalue }) } shinyApp(ui, server) }
library(shiny) # Only run examples in interactive R sessions if (interactive()) { ui <- fluidPage( label3("Welcome"), checkboxInput3("somevalue", "Some value", FALSE), verbatimTextOutput("value") ) server <- function(input, output) { output$value <- renderText({ input$somevalue }) } shinyApp(ui, server) }
Create a side-by-side dateInput
dateInput3(inputId, label, width = 100, ...)
dateInput3(inputId, label, 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. |
width |
The width of the input in pixel |
... |
arguments to be passed to dateInput |
library(shiny) # Only run examples in interactive R sessions if (interactive()) { ui <- fluidPage( label3("Welcome"), dateInput3("date", "date"), verbatimTextOutput("value") ) server <- function(input, output) { output$value <- renderText({ input$date }) } shinyApp(ui, server) }
library(shiny) # Only run examples in interactive R sessions if (interactive()) { ui <- fluidPage( label3("Welcome"), dateInput3("date", "date"), verbatimTextOutput("value") ) server <- function(input, output) { output$value <- renderText({ input$date }) } shinyApp(ui, server) }
Server function of editableDT Shiny module
editableDT( input, output, session, data, length = 50, cols = 1:7, status = "default", showButtons = TRUE, enableSave = TRUE, editable = NULL, formatList = NULL, ... )
editableDT( input, output, session, data, length = 50, cols = 1:7, status = "default", showButtons = TRUE, enableSave = TRUE, editable = NULL, formatList = NULL, ... )
input |
input |
output |
output |
session |
session |
data |
A reactive data object |
length |
numeric desired length of string |
cols |
numeric Initial columns to display |
status |
character. dropdownButton status. One of c("default","info","primary","danger","warning","success") |
showButtons |
logical |
enableSave |
logical |
editable |
logical |
formatList |
Null or list. Format list to be passed to formatStyle |
... |
Further arguments to be passed to datatable() |
UI of editableDT Shiny module
editableDTUI(id)
editableDTUI(id)
id |
A string |
# Only run examples in interactive R sessions if (interactive()) { library(shiny) ui=fluidPage( selectInput("select","select",choices=c("mtcars","iris","sampleData")), textInput("mydata","mydata",value="mtcars"), hr(), editableDTUI("editableDT"), hr(), verbatimTextOutput("test") ) server=function(input,output,session){ data=reactive({ myget(input$mydata) }) observeEvent(input$select,{ updateTextInput(session,"mydata",value=input$select) }) result=callModule(editableDT,"editableDT",data=data) output$test=renderPrint({ str(result()) }) } shinyApp(ui=ui,server=server) }
# Only run examples in interactive R sessions if (interactive()) { library(shiny) ui=fluidPage( selectInput("select","select",choices=c("mtcars","iris","sampleData")), textInput("mydata","mydata",value="mtcars"), hr(), editableDTUI("editableDT"), hr(), verbatimTextOutput("test") ) server=function(input,output,session){ data=reactive({ myget(input$mydata) }) observeEvent(input$select,{ updateTextInput(session,"mydata",value=input$select) }) result=callModule(editableDT,"editableDT",data=data) output$test=renderPrint({ str(result()) }) } shinyApp(ui=ui,server=server) }
A shiny app for editing a 'data.frame'
editData( data = NULL, viewer = "dialog", length = 50, cols = 1:7, status = "default", showButtons = TRUE, enableSave = TRUE, editable = NULL, formatList = NULL, ... )
editData( data = NULL, viewer = "dialog", length = 50, cols = 1:7, status = "default", showButtons = TRUE, enableSave = TRUE, editable = NULL, formatList = NULL, ... )
data |
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") |
length |
Numeric desired maximum length of string |
cols |
numeric |
status |
character. dropdownButton status. One of c("default","info","primary","danger","warning","success") |
showButtons |
logical |
enableSave |
logical |
editable |
logical |
formatList |
Null or list. Format list to be passed to formatStyle |
... |
Further arguments to be passed to datatable() |
A manipulated 'data.frame' or NULL
library(shiny) library(editData) # Only run examples in interactive R sessions if (interactive()) { result<-editData(mtcars) result }
library(shiny) library(editData) # Only run examples in interactive R sessions if (interactive()) { result<-editData(mtcars) result }
Edit multiple files side by side
editFiles()
editFiles()
Extract extension from a file name
file2ext(filename)
file2ext(filename)
filename |
A character string naming a file |
Create a side-by-side label
label3(label, width = 100, bg = NULL, ...)
label3(label, width = 100, bg = NULL, ...)
label |
A text to display |
width |
The width of the input in pixel |
bg |
The color of text |
... |
arguments to be passed to label |
library(shiny) # Only run examples in interactive R sessions if (interactive()) { ui <- fluidPage( label3("Welcome"), checkboxInput3("somevalue", "Some value", FALSE), verbatimTextOutput("value") ) server <- function(input, output) { output$value <- renderText({ input$somevalue }) } shinyApp(ui, server) }
library(shiny) # Only run examples in interactive R sessions if (interactive()) { ui <- fluidPage( label3("Welcome"), checkboxInput3("somevalue", "Some value", FALSE), verbatimTextOutput("value") ) server <- function(input, output) { output$value <- renderText({ input$somevalue }) } shinyApp(ui, server) }
Truncate string to desired length
makeShort(x, length = 50)
makeShort(x, length = 50)
x |
A vector |
length |
numeric desired string length |
Calculate maximal length
maxLength(x)
maxLength(x)
x |
A vector |
maxLength(month.name)
maxLength(month.name)
Return the Value of a Named data.frame
myget(x)
myget(x)
x |
Name of data.frame |
myget("iris") myget("mtcars")
myget("iris") myget("mtcars")
Read in a data.frame from a file
myimport(file, ...)
myimport(file, ...)
file |
A character string naming a file |
... |
Further arguments to be passed to rio::import |
read csv file
myimport_csv(file, ...)
myimport_csv(file, ...)
file |
A character string naming a file |
... |
Further arguments to be passed to read.csv |
Create a side-by-side numericInput
numericInput3( inputId, label, value, min = NA, max = NA, step = NA, width = 100, ... )
numericInput3( inputId, label, value, min = NA, max = NA, step = NA, 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. |
min |
Minimum allowed value |
max |
Maximum allowed value |
step |
Interval to use when stepping between min and max |
width |
The width of the input in pixel |
... |
arguments to be passed to numericInput |
library(shiny) # Only run examples in interactive R sessions if (interactive()) { ui <- fluidPage( textInput3("id", "id", ""), numericInput3("score","score",value=1) ) server <- function(input, output) { } shinyApp(ui, server) }
library(shiny) # Only run examples in interactive R sessions if (interactive()) { ui <- fluidPage( textInput3("id", "id", ""), numericInput3("score","score",value=1) ) server <- function(input, output) { } shinyApp(ui, server) }
Side by side pickerInput
pickerInput3(...)
pickerInput3(...)
... |
Further arguments to be passed to pickerInput |
Create a side-by-side radioButtons
radioButtons3( inputId, label, choices, bg = NULL, labelwidth = 100, inline = FALSE, align = "right", ... )
radioButtons3( inputId, label, choices, bg = NULL, labelwidth = 100, inline = FALSE, align = "right", ... )
inputId |
The input slot that will be used to access the value. |
label |
Display label for the control, or NULL for no label. |
choices |
List of values to select from |
bg |
The color of text |
labelwidth |
The width of the label in pixel |
inline |
If TRUE, render the choices inline (i.e. horizontally) |
align |
text align of label |
... |
arguments to be passed to radioButtons |
library(shiny) # Only run examples in interactive R sessions if (interactive()) { ui <- fluidPage( label3("Welcome"), radioButtons3("mydata", "mydata", choices=c("mtcars","iris")), verbatimTextOutput("value") ) server <- function(input, output) { output$value <- renderText({ input$mydata }) } shinyApp(ui, server) }
library(shiny) # Only run examples in interactive R sessions if (interactive()) { ui <- fluidPage( label3("Welcome"), radioButtons3("mydata", "mydata", choices=c("mtcars","iris")), verbatimTextOutput("value") ) server <- function(input, output) { output$value <- renderText({ input$mydata }) } shinyApp(ui, server) }
A sample dataset containing data for 4 people
sampleData
sampleData
A data.frame with 4 rows and 6 variables:
Last name
age in years
Country Name
sex, A factor with two levels.
Blood Type. A factor with four levels
Date
Create a side-by-side selectInput
selectInput3(..., width = 100)
selectInput3(..., width = 100)
... |
arguments to be passed to selectInput |
width |
The width of the input in pixel |
library(shiny) # Only run examples in interactive R sessions if (interactive()) { ui <- fluidPage( selectInput3("sex", "sex", choices=c("Male","Female")), selectInput3("smoking", "smokingStatus", choices=c("Never","Ex-smoker","Smoker")) ) server <- function(input, output) { } shinyApp(ui, server) }
library(shiny) # Only run examples in interactive R sessions if (interactive()) { ui <- fluidPage( selectInput3("sex", "sex", choices=c("Male","Female")), selectInput3("smoking", "smokingStatus", choices=c("Never","Ex-smoker","Smoker")) ) server <- function(input, output) { } shinyApp(ui, server) }
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) }
Create a side-by-side textInput control for entry of unstructured text values
textInput3(inputId, label, value = "", width = 100, bg = NULL, ...)
textInput3(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 |
The color of text |
... |
arguments to be passed to textInput |
library(shiny) # Only run examples in interactive R sessions if (interactive()) { ui <- fluidPage( textInput3("id", "id", ""), textInput3("name","name","") ) server <- function(input, output) { } shinyApp(ui, server) }
library(shiny) # Only run examples in interactive R sessions if (interactive()) { ui <- fluidPage( textInput3("id", "id", ""), textInput3("name","name","") ) server <- function(input, output) { } shinyApp(ui, server) }