我有6个参数,用户可以更改其值。这是我们的6个输入。 我想创建一个输出值,它接受这6个输入,并根据函数中的许多相关方程计算我们的感兴趣值。以下是我在我的UI ......R和Shiny:将滑块输入传递到反应函数以计算输出
library(shiny)
# Define UI for slider demo application
shinyUI(pageWithSidebar(
# Application title
headerPanel("# Header Title Goes Here"),
# Sidebar with sliders that demonstrate various available options
sidebarPanel(
# Simple integer interval
sliderInput("u1", "Name:",
min=0, max=10000, value=10000),
#There are 6 slider inputs...
),
# Show a table summarizing the values entered
mainPanel(
tableOutput("values"),
uiOutput("focal"))
)
)
以下是我在我的server.R ...
library(shiny)
shinyServer(function(input, output) {
# Reactive expression to compose a data frame containing all of the values
sliderValues <- reactive({
# Compose data frame
data.frame(
Name = # Names of my 6 parameters,
Value = # inputs based on my 6 values by `input$value`,
stringsAsFactors=FALSE)
})
f <- renderText({function(r1, r2, r3, d1, d2, u1) #these are my 6 values
{ #List of equations that compute f based on the 6 values
}
})
# Show the values using an HTML table
output$values <- renderTable({
sliderValues()
})
# Show the final calculated value
output$focal <- renderText({
f
})
})
我不断收到...错误:参数1(类型'封')不能由'猫' 和许多其他错误处理。我只是不知道如何将6个参数的更新用户输入传输到我的函数中,并将该函数吐出到Shiny html页面的输出区域。
任何帮助将不胜感激!
谢谢!
ReactiveUI是另一回事™ –
为什么是一个注册商标的短语? – hedgedandlevered