MyNixOS website logo
Description

Create a Matrix with Radio Buttons.

An input controller for R Shiny: a matrix with radio buttons, where only one option per row can be selected.

shinyRadioMatrix

Introduction

This package provides one new R Shiny component: radioMatrixInput. It allows to create an assignment matrix which serves to encode relationships between entities of two classes.

There is often a need to encode relationships between entities in two different classes. A certain case of this is when a particular entity of one class can be also belong to multiple entities from another class at the same time, but reversing the assignment is not necessarily true. This tool is dedicated to these cases.

This is a taxon-PFT matrix that is required for performing a PFT-based climate reconstruction (see Peyron et al. 1998):

           bs bs/aa bec bec/ctc ctc ec ts/bs/aa ts/bs ts ts1 ts2 wte
   *Abies*  o   o    o     o     o   o     o      o    o  o   o   o
   *Alnus*  o   o    o     o     o   o     o      o    o  o   o   o
  *Betula*  o   o    o     o     o   o     o      o    o  o   o   o
*Castanea*  o   o    o     o     o   o     o      o    o  o   o   o
   *Fagus*  o   o    o     o     o   o     o      o    o  o   o   o
   *Larix*  o   o    o     o     o   o     o      o    o  o   o   o
   *Picea*  o   o    o     o     o   o     o      o    o  o   o   o
  

Reference

Peyron O, Guiot J, Cheddadi R, Tarasov P, Reille M, de Beaulieu J-L, Bottema S, Andrieu V (1998) Climatic Reconstruction in Europe for 18,000 YR B.P. from Pollen Data. Quat Res 49(2):183–196. DOI: 10.1006/qres.1997.1961

Installation

radioMatrixInput can be used from your browser with your current R installation. The package can be installed in the following way:

if (!require(devtools)) install.packages("devtools")
devtools::install_github("szelepke/shinyRadioMatrix")

Example

This is a basic example which shows you how to solve a common problem:

library(shiny)
library(shinyRadioMatrix)

## Only run examples in interactive R sessions
if (interactive()) {

  data(exTaxonList)
  data(exPftList)

  ui <- fluidPage(
        
    radioMatrixInput(inputId = "rmi01", rowIDs = head(exTaxonList$Var), 
                     rowLLabels = head(
                     as.matrix(subset(exTaxonList, select = "VarName"))
                     ), 
                     choices = exPftList$ID, 
                     selected = head(exTaxonList$DefPFT)), 
    verbatimTextOutput('debug01')
  )
    
  server <- function(input, output, session) { 
    output$debug01 <- renderPrint({input$rmi01})
  }
    
  shinyApp(ui, server)
    
}

if (interactive()) {

  ui <- fluidPage(

    radioMatrixInput(inputId = "rmi02", rowIDs = c("Performance", "Statement A"),
                    rowLLabels = c("Poor", "Agree"), 
                    rowRLabels = c("Excellent", "Disagree"),
                    choices = 1:5,
                    selected = rep(3, 2),
                    labelsWidth = list("100px", "100px")),
    verbatimTextOutput('debug02')
    )

  server <- function(input, output, session) {
    output$debug02 <- renderPrint({input$rmi02})
  }

  shinyApp(ui, server)
}
Metadata

Version

0.2.1

License

Unknown

Platforms (75)

    Darwin
    FreeBSD
    Genode
    GHCJS
    Linux
    MMIXware
    NetBSD
    none
    OpenBSD
    Redox
    Solaris
    WASI
    Windows
Show all
  • aarch64-darwin
  • aarch64-genode
  • aarch64-linux
  • aarch64-netbsd
  • aarch64-none
  • aarch64_be-none
  • arm-none
  • armv5tel-linux
  • armv6l-linux
  • armv6l-netbsd
  • armv6l-none
  • armv7a-darwin
  • armv7a-linux
  • armv7a-netbsd
  • armv7l-linux
  • armv7l-netbsd
  • avr-none
  • i686-cygwin
  • i686-darwin
  • i686-freebsd
  • i686-genode
  • i686-linux
  • i686-netbsd
  • i686-none
  • i686-openbsd
  • i686-windows
  • javascript-ghcjs
  • loongarch64-linux
  • m68k-linux
  • m68k-netbsd
  • m68k-none
  • microblaze-linux
  • microblaze-none
  • microblazeel-linux
  • microblazeel-none
  • mips-linux
  • mips-none
  • mips64-linux
  • mips64-none
  • mips64el-linux
  • mipsel-linux
  • mipsel-netbsd
  • mmix-mmixware
  • msp430-none
  • or1k-none
  • powerpc-netbsd
  • powerpc-none
  • powerpc64-linux
  • powerpc64le-linux
  • powerpcle-none
  • riscv32-linux
  • riscv32-netbsd
  • riscv32-none
  • riscv64-linux
  • riscv64-netbsd
  • riscv64-none
  • rx-none
  • s390-linux
  • s390-none
  • s390x-linux
  • s390x-none
  • vc4-none
  • wasm32-wasi
  • wasm64-wasi
  • x86_64-cygwin
  • x86_64-darwin
  • x86_64-freebsd
  • x86_64-genode
  • x86_64-linux
  • x86_64-netbsd
  • x86_64-none
  • x86_64-openbsd
  • x86_64-redox
  • x86_64-solaris
  • x86_64-windows