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
)The input slot that will be used to access the value
label for input field
Initial value. Should be a matrix
class of the matrix input html element
list of options to configure rows
list of options to configure cols
list of options to configure cells
Matrix will be coerced to a matrix of this class. `character` and `numeric` are supported
old argument
old argument
old argument
Use pagination to display matrix
lazy updating of server values. The new values are only sent to the server when no input field is visible
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)
)
Run the code above in your browser using DataLab