【发布时间】:2013-06-29 14:18:01
【问题描述】:
我想在反应式表达式中调用某个变量。像这样的:
server.R
library(raster)
shinyServer(function(input, output) {
data <- reactive({
inFile <- input$test #Some uploaded ASCII file
asc <- raster(inFile$datapath) #Reads in the ASCII as raster layer
#Some calculations with 'asc':
asc_new1 <- 1/asc
asc_new2 <- asc * 100
})
output$Plot <- renderPlot({
inFile <- input$test
if (is.null(inFile)
return (plot(data()$asc_new1)) #here I want to call asc_new1
plot(data()$asc_new2)) #here I want to call asc_new2
})
})
很遗憾,我不知道如何在data() 中调用asc_new1 和asc_new2。这个不行:
data()$asc_new1
【问题讨论】: