我想運行一個閃亮的應用程序,包括rpivottable。rpivotTable閃亮的服務器不能正常工作
我的配置: devtools 1.8.0,0.4.2 htmlwidgets,rpivotTable 0.1.4.1,有光澤0.12.0
[R版本3.1.2(2014年10月31日)
的Ubuntu 14.04。 1 LTS
我的代碼在本地完美工作,但在服務器上崩潰。在瀏覽器中,我得到的控制檯上的錯誤:
類型錯誤:未定義X
並將其鏈接到該代碼:
HTMLWidgets.widget({
name: 'rpivotTable',
type: 'output',
initialize: function(el, width, height) {
return {}
},
renderValue: function(el, x, instance) {
x.data = HTMLWidgets.dataframeToD3(x.data);
var derivers = $.pivotUtilities.derivers;
var tpl = $.pivotUtilities.aggregatorTemplates;
x.params.renderers = $.extend(
$.pivotUtilities.renderers,
$.pivotUtilities.d3_renderers,
$.pivotUtilities.c3_renderers
);
$('#'+el.id).pivotUI(
x.data, x.params
);
},
resize: function(el, width, height, instance) {
}
});
我的R代碼裏面如下:
if (interactive()) { lib.path <- my.path.local
} else { lib.path <- my.path.server }
### packages ###
library(shiny, lib.loc = lib.path)
library(htmlwidgets, lib.loc = lib.path)
library(rpivotTable, lib.loc = lib.path)
data <- data.frame(var1 = c("mod1", "mod2"), value = c(1, 2))
shinyApp(
ui = fluidPage(
sidebarLayout(
sidebarPanel(
textOutput("config"), textOutput("path"), textOutput("version"))
, mainPanel(
rpivotTableOutput("test")
)
)),
server = function(input, output) {
output$test <- rpivotTable::renderRpivotTable({
rpivotTable(data = data)
})
output$config <- renderText({
tt <- installed.packages()
paste(paste(tt[tt[, 1] %in% c("shiny", "htmlwidgets", "rpivotTable", "devtools") , 1],
tt[tt[, 1] %in% c("shiny", "htmlwidgets", "rpivotTable", "devtools") , 3]), collapse = ", ")
})
output$path <- renderText({
ll <- .libPaths()
ll
})
output$version <- renderText({
ss <- sessionInfo()
ss[[1]]$version.string
})
}
)
是否有人遇到此錯誤?
最好,
我發現了問題: 這是最有可能是內存的問題。 我將我的AWS版本從t2.micro升級到了t2.small,並且工作正常。 – YCR