view app.R @ 2:720ed4f3405a

変数名とチェックボタンのラベルを変更
author uncorrelated zombie <uncorrelated@yahoo.co.jp>
date Thu, 27 Oct 2022 08:39:50 +0900
parents d52c39e8228a
children ab1d3ad46a22
line wrap: on
line source

library(shiny)
source("common.R")
source("EdgeworthBox.R")

loadLib("nleqslv", "shiny")

ui <- fluidPage(
    titlePanel("Edgeworth Box"),

    sidebarLayout(
        sidebarPanel(
            sliderInput("A",
                "initial amount of goods A of person 1",
                min = 0.01,
                max = 0.99,
                value = 0.8), 
            sliderInput("B",
                "initial amount of goods B of person 1",
                min = 0.01,
                max = 0.99,
                value = 0.3),
            checkboxInput("isIC_I", "Indiffrent Curves pass through the Initial Point", TRUE),
            checkboxInput("isCore", "Core", TRUE),
            checkboxInput("isIC_E", "Indiffrent Curves pass through the Equilibrium", TRUE),
            checkboxInput("isSHP", "Separating Hyperplane", TRUE),
            checkboxInput("isCC", "Contract Curve", TRUE)
        ), 

        mainPanel(
            plotOutput("distPlot")
        )
    )
)

server <- function(input, output) {
    output$distPlot <- renderPlot({
        drawEdgeworthBox(input$A, input$B, CC=input$isCC, SHP=input$isSHP, IC_I=input$isIC_I, IC_E=input$isIC_E, CORE=input$isCore)
    }, width=400, height=400)
}

app <- shinyApp(ui = ui, server = server)
runApp(app)