我正在尝试使用闪亮+gridSVG 构建应用程序。这个问题经常发生,我对此一无所知。
我的服务器.R:
library(grid)
library(lattice)
library(gridSVG)
shinyServer(function(input, output) {
data = reactive({
inFile = input$file1
if (is.null(inFile))
return(NULL)
read.csv(inFile$datapath, header=input$header,
sep=input$sep, quote=input$quote)
})
featurelist = reactive({
return (colnames(data()))
})
output$classUI = renderUI({
selectInput("classlabel","Classify by:", featurelist())
})
output$svg.grid = reactive({
dat = data()
features = featurelist()
#group = dat[,c(which(features == input$classlabel))]
subsetted.features = features[-c(which(features == input$classlabel))]
#classlabel.level = levels(group)
xyplot.out = xyplot(subsetted.features[1] ~ subsetted.features[2]|input$classlabel,
data = dat
)
tempsvg <- tempfile(fileext=".svg")
on.exit(unlink(tempsvg))
gridToSVG(name=tempsvg)
svgoutput <- readLines(tempsvg, n=-1)
svgoutput
})
})
这是我的js:
<script>
var networkOutputBinding = new Shiny.OutputBinding();
$.extend(networkOutputBinding, {
find: function(scope) {
return $(scope).find('.shiny-network-output');
},
renderValue: function(el, data) {
$(el).html(data.join(''));
}
});
Shiny.outputBindings.register(networkOutputBinding, 'timelyportfolio.networkbinding');
</script>
控制台中的错误消息是:
Error in grobToDev.default(gTree, dev) : We shouldn't be here!
有人知道原因吗?