2017-10-31 5 views
0

私はShinyとSparkにはかなり新しいです。sparklyrを光沢につけることができません

私は、スパーク接続でShinyAppを展開したいと考えています。私はRunAppを打ったときにどのように動作するのですか?しかし、公開しようとするとエラーが発生します: "値の誤り[3L]: SPARK_HOMEディレクトリ '/ usr/lib/spark'が見つかりません 呼び出し:ローカル。 .. tryCatch - > tryCatchList - > tryCatchOne - > 実行が停止しました "

このディレクトリは私のクラスタ上に存在するので、なぜそれが見つからないのか分かりません。 ここに公開しようとしているコードです。他の誰がこの同じ問題を持っている場合

library(sparklyr) 
library(shiny) 
library(ggplot2) 
library(rmarkdown) 


Sys.setenv(SPARK_HOME = '/usr/lib/spark') 
config<- spark_config() 
spark_install(version = "2.2.0") 
sc<-spark_connect(master = 'yarn-client', version = '2.2.0') 
tbl_cache(sc, 'output_final_v2') 
output_tbl2<-tbl(sc, 'output_final_v2') 


ui <- fluidPage(

    textInput("name", "Enter Name", "company"), 
    textInput("item_name", "Enter Item Name"), 
    selectInput("month", "Choose Month", choice= 
c("January","February","March", "April", "May", "June", "July", 
"August", "September", "October", "November", "December")), 

selectInput("dow","Choose Day of Week", choice = c("Monday", "Tuesday", 
"Wednesday", "Thursday", "Friday", "Saturday", "Sunday")), 
    numericInput("count_customers", "Enter Number of Customers:", 2), 
    numericInput("views", "Enter Number of Views:", 30), 


    plotOutput("plot1"), 
    plotOutput("plot2"), 
    plotOutput("plot3") 

) 

server <- function(input, output, session) { 


    C2<-reactive(output_tbl2 %>% 
       mutate(views = input$views)%>% 
       filter(input$name == shortname)%>% 
       filter(input$dow== dow)%>% 
       filter (input$month == month)%>% 
       filter (input$item_name == item)%>% 
       filter (input$count_customers == count_customers)%>% 
       collect) 
    output$plot1 <- renderPlot({ 

p1<-ggplot2::ggplot(data = C2() , aes(x=price_per_customer, y=final_probability)) + geom_line() + ggtitle("Probability of Purchase") + labs(y="Probability",x= "Item Price") 
print(p1) 
    }) 


    output$plot2 <- renderPlot({ 

p2<-ggplot2::ggplot(data=C2(), aes(x=price_per_customer, y=((views*final_probability)*price_per_customer))) + geom_line() + geom_hline(aes(yintercept = max((views*final_probability)*price_per_customer))) + ggtitle("Projected Revenue") + labs(y="Expected Revenue",x="Item Price") 
print(p2) 

    }) 

    output$plot3<-renderPlot({ 

p3<-ggplot2::ggplot(data=C2(), aes(x=price_per_customer))+ geom_line(aes(y=(views*final_probability)*price_per_customer)) + geom_line(aes(y= (((views*final_probability)/price_per_customer)))) + ggtitle("Iso-Profit vs Expected Volume") 

print(p3) 
    }) 


} 

shinyApp(ui, server) 
+0

?また、私はあなたのスクリプトの最初の10行が問題を再現する最小限の例として十分であると推測しています... –

+0

私はそれを光沢のあるサーバーに公開しようとしています。あなたは問題の再現について正しいです。 – Alex

答えて

関連する問題