-1

Here's the code

I am also kind of new to R-programming or shiny app I hope anyone can help or guide me about this.

MLavoie
  • 9,671
  • 41
  • 36
  • 56
raeyu
  • 1
  • 1

1 Answers1

0

You didn't have calls to both the UI and Server for the ins and outs. Check it out. Generically speaking, what goes in one requires something in the other.

library(shiny)
library(shinythemes)
library(shinydashboard)
library(shinyMatrix)

ui <- fluidPage(
  
  navbarPage(
    title = "DETERMINANTS CALCULATOR",
    theme = shinytheme("sandstone"),
    tabPanel(value = "Home", 
             icon("home"),
             fluidRow(
               column(
                 width=12,
                 height=20,
                 tags$h1("Determinants", 
                         height = 4, 
                         style = "font-weight: bold; text-align; center;"),
                 mainPanel(
                   width = 3,
                   height = 8, 
                   style = "border-style: solid; border-color: black;",
                   br(),
                   selectInput("matrix", 
                               "Choose a matrix dimension:", 
                               c("2", "3"),
                               actionButton("set", 
                                            "Set as Matrix"),
                   ),
                 ),
               ),

               mainPanel(
                 uiOutput("matrixInput"),
                 br(),
                 actionButton("calculate", "Calculate"),
                 tags$h3("Result of the Matrix", 
                         style = "font-weight: bold; text-align;center;"),
                 textOutput("metdetanswer")
               )
             )               
    ),
    tabPanel(value = "About", icon("address-card"),
             sidebarPanel(
               h2("About the App", 
                  style = "font-weight: bold;"),
               p("This web application complies with the final project or learning evidence to CS111, Advance Algebra for the first semester. This application can solve a 2x2 and 3x3 determinant matrix and multiply to row from echelon form to its diagonal element.", 
                 style = "font-weight:bold; text-center;")
             )
    )
  )  
)

# BOANGMOMENTS
server <- function(input, output) {
  valuedet <- eventReactive(input$trigger, {
    matrix(
      nrow = input$matdimension,
      ncol = input$matdimension
    ) # end matrix
  }  # close eventReactive
  ) # end eventReactive
  
  observeEvent(valuedet(), {
    output$matrixInput <- renderUI({
      matrixInput(
        inputId = "matrixdet", 
        label = "Create your own Matrix",
        value = valuedet(), 
        rows = list(names = FALSE), 
        cols = list(names = FALSE)
      ) # end matrixInput
    }) # end renderUI
  }) # end observeEvent
  
  observeEvent(input$calculate, {
    output$matdetanswer <- renderText(
      det(input$matrixdet)
    )
  })
  } # end server

  # Run the application 
  shinyApp(ui = ui, server = server)
Kat
  • 15,669
  • 3
  • 18
  • 51