【发布时间】:2021-12-30 08:13:23
【问题描述】:
这是code
我也是 R 编程或闪亮应用程序的新手,希望任何人都可以帮助或指导我。
【问题讨论】:
-
欢迎来到 SO,请通过 this 指南并重新格式化您的问题。
-
不要添加图像,而是添加代码 sn-p、输出和所需的输出。
-
请提供足够的代码,以便其他人更好地理解或重现问题。
这是code
我也是 R 编程或闪亮应用程序的新手,希望任何人都可以帮助或指导我。
【问题讨论】:
您没有调用 UI 和服务器的来龙去脉。看看这个。一般而言,一个中的内容需要另一个中的内容。
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)
【讨论】: