我使用下面的平臺和R版本:閱讀對象是不允許
平臺x86_64的 - 蘋果darwin10.8.0
version.string [R版本3.0.3(2014年3月6日)
我新的閃亮,我試圖把一個簡單的應用程序一起使用rWBclimate數據集,這是在R A包:
http://cran.r-project.org/web/packages/rWBclimate/rWBclimate.pdf
我得到以下錯誤:
錯誤$.shinyoutput
(輸出,gvis): 不允許從shinyoutput對象讀取對象。
當使用下面的腳本。 ui.R
library(shiny)
suppressPackageStartupMessages(library(googleVis))
shinyUI(pageWithSidebar(
# Application title
headerPanel("Global Temperature"),
#sidebar with controls to select var to plot year
sidebarPanel(
selectInput("fromyr", "Select Years:", choices=c("1920", "1940","1960", "1980"))
),
mainPanel(
htmlOutput("gvis")#,
)
)
)
和server.R
library(shiny)
#install.packages("rWBclimate")
library(rWBclimate)
library(ggplot2)
library(rCharts)
suppressPackageStartupMessages(library(googleVis))
countries <-c("USA","BRA","CAN","YEM")
# get temperature data for ensembles
st=1900
en=2100
data_df_all <- get_ensemble_temp(countries, type="annualavg", start=st, end=en)
data_df<-subset(data_df_all,data_df_all$percentile==50) #subset to median percentile
data_df<-subset(data_df, select=-percentile)
data_df<-subset(data_df, data_df$scenario!="b1")
data_df<-subset(data_df, select=-scenario)
data_df<-subset(data_df, data_df$fromYear==1920)
shinyServer(function(input, output){
#df<-reactive({
# switch(subset(data_df, data_df$fromYear==input$fromyr),
# "1920"= 1920,
# "1940" = 1940,
# "1960" = 1960,
# "1980" = 1980)
#dfi<-subset(data_df, data_df$fromYear==input$fromyr)
#subset(data_df, data_df$fromYear==1920)
#data_df[data_df$fromYear == input$fromyr, ]
#subset(data_df, data_df$scenario==input$scenar)
#subset(alldat, alldat$fromYear==input$fromyr)
# })
output$gvis < renderGvis({
# gvisGeoChart(dat=df(), locationvar="locator", colorvar="data")
gvisGeoChart(data_df, locationvar="locator", colorvar="data")
})
})
任何見解將是巨大的。我嘗試使用反應語句,並將文件直接放入gvisGeoChart,就像上面的版本一樣。
非常感謝。一個愚蠢的錯誤,我希望永不再做! – 2014-10-10 17:31:17
@NicoleGoebel,我們都會犯錯誤,如果您滿意,隨時接受答案。 – cdeterman 2014-10-10 17:36:47
如果出現此錯誤,則檢查分配。我只是犯了同樣的愚蠢錯誤'輸出$測試> - renderUI等'所以'> - '不正確的'< - ' – micstr 2017-07-20 09:56:43