Title: | Shiny Matrix Input Field |
---|---|
Description: | Implements a custom matrix input field. |
Authors: | Andreas Neudecker |
Maintainer: | Andreas Neudecker <[email protected]> |
License: | MIT + file LICENSE |
Version: | 0.8.0 |
Built: | 2024-11-06 06:13:23 UTC |
Source: | https://github.com/inwtlab/shinymatrix |
Use this function to create a matrix input field. Typically this would be in the 'ui.R' file of your shiny application. You can access the input via the 'input$inputId' in the server function of the shiny application. The value will always be a matrix and contain values of class 'class'.
matrixInput( inputId, label = NULL, value = matrix("", 1, 1), inputClass = "", rows = list(), cols = list(), cells = list(), class = "character", paste = FALSE, copy = FALSE, copyDoubleClick = FALSE, pagination = FALSE, lazy = FALSE, formatCell = NULL )
matrixInput( inputId, label = NULL, value = matrix("", 1, 1), inputClass = "", rows = list(), cols = list(), cells = list(), class = "character", paste = FALSE, copy = FALSE, copyDoubleClick = FALSE, pagination = FALSE, lazy = FALSE, formatCell = NULL )
inputId |
The input slot that will be used to access the value |
label |
label for input field |
value |
Initial value. Should be a matrix |
inputClass |
class of the matrix input html element |
rows |
list of options to configure rows |
cols |
list of options to configure cols |
cells |
list of options to configure cells |
class |
Matrix will be coerced to a matrix of this class. 'character' and 'numeric' are supported |
paste |
old argument |
copy |
old argument |
copyDoubleClick |
old argument |
pagination |
Use pagination to display matrix |
lazy |
lazy updating of server values. The new values are only sent to the server when no input field is visible |
formatCell |
format to be used for formatting cell values, i.e. ".2f" . This uses d3-format (https://d3js.org/d3-format) |
The parameters 'rows' and 'cols' take a list of arguments. Currently, the following arguments are supported:
number of rows (is calculated from value as default)
should row/colnames be displayed? The names are taken from value
should row/colnames be editable
Should the matrix be extended if data is entered in the last row/column?
how many blank rows/cols should be added?
name of javascript function to override default function to create/update table header. The function needs to have the table element and the data object as argument
same as createHeader but with table element as only argument
Similarly, the parameter 'cells' takes a list of arguments:
logical, should cells be editable (default 'TRUE')
matrixInput( "myMatrix", value = diag(3), rows = list(names = FALSE), cols = list(names = FALSE), cells = list(editableCells = FALSE) )
matrixInput( "myMatrix", value = diag(3), rows = list(names = FALSE), cols = list(names = FALSE), cells = list(editableCells = FALSE) )
This function starts an example app from the folder 'inst'.
startApplication(app = "app", port = 4242)
startApplication(app = "app", port = 4242)
app |
name of the folder in 'inst' |
port |
port of web application |
## Not run: startApplication("appCopy") ## End(Not run)
## Not run: startApplication("appCopy") ## End(Not run)
This function updates the matrix input from R created with 'matrixInput'. It works like the other updateXXXInput functions in shiny.
updateMatrixInput(session, inputId, value)
updateMatrixInput(session, inputId, value)
session |
shiny session |
inputId |
id of matrix input |
value |
new value for matrix |
## Not run: updateMatrixInput(session, "myMatrix", diag(4)) ## End(Not run)
## Not run: updateMatrixInput(session, "myMatrix", diag(4)) ## End(Not run)