My R Shiny App не развертывается и имеет ошибки - PullRequest
0 голосов
/ 03 мая 2020

Это мое первое приложение Shiny, и я пытаюсь развернуть его, но получаю ошибки, которые не знаю, как исправить. Может ли кто-нибудь помочь мне понять, что мне нужно исправить? Я перепробовал все решения, которые смог найти на этом inte rnet, но, похоже, ничего не работает. Мне кажется, это должно работать, так как в коде нет функций install.package, и я уже обновил все пакеты. Спасибо

require(rlang)
require(shiny)
require(plotly)
require(tidyverse)
require(scales)
require(lubridate)
require(plyr)
require(rpivotTable)
require(htmlwidgets)
require(ggplot2)
require(stats)
require(graphics)
require(scales)
require(rlang)

load(url("https://github.com/garza4213/Projects/raw/master/Well_App_Data.RData"))


# Define UI for application that draws a histogram
ui <- fluidPage(
    sidebarLayout(
        sidebarPanel(selectInput("Operator","Well Operator",choices = wells2$Operator,
                                 selected = c("EOG","Chevron","BP"), multiple= TRUE),
                     sliderInput("Well_Start","Well Start",min = as.Date("2008-01-01","%Y-%M-%d"),
                                 max = as.Date("2019-12-01","%Y-%M-%d"), 
                                 value =  c(as.Date("2008-01-01","%Y-%M-%d"),as.Date("2019-12-01","%Y-%M-%d")),
                                 timeFormat="%Y-%m-%d")),
        mainPanel(

            tabsetPanel(
                tabPanel("Oil Basin Map",plotlyOutput(outputId =  "map"),plotlyOutput(outputId = "well_start")),
                tabPanel("Pivot Table",  rpivotTableOutput(outputId = "table"))))
        ))


# Define server logic required to draw a histogram
server <- function(input, output, session) {


    data_sub <-reactive({filter(wells2,wells2$Operator == input$Operator & wells2$well_start>=input$Well_Start[1] &
                                    wells2$well_start<=input$Well_Start[2])}) 
    output$map<-renderPlotly({
        map <- plot_ly( data = wells2,
                        lat = ~Latitude,
                        lon = ~Longitude,
                        type = "scattermapbox",
                        mode='marker',
                        hovertext = ~Operator,
                        color = ~ Operator)
        map <- map  %>%
            layout(mapbox= list(style = "white-bg",
                                zoom = 5,
                                center = list(lon = -103 ,lat= 32),
                                layers = list(list(below = 'traces',
                                                   sourcetype = "raster",
                                                   source = list("https://basemap.nationalmap.gov/
              arcgis/rest/services/USGSImageryOnly/MapServer/tile/{z}/{y}/{x}"))))
            )})

    output$map<-renderPlotly({
        map <- plot_ly( data = data_sub(),
                        lat = ~Latitude,
                        lon = ~Longitude,
                        type = "scattermapbox",
                        mode='marker',
                        hovertext = ~Operator,
                        color = ~ Operator)
        #group_by= ~ Operator.Type)
        map <- map  %>%
            layout(mapbox= list(style = "white-bg",
                                zoom = 5,
                                center = list(lon = -103 ,lat= 32),
                                layers = list(list(below = 'traces',
                                                   sourcetype = "raster",
                                                   source = list("https://basemap.nationalmap.gov/
              arcgis/rest/services/USGSImageryOnly/MapServer/tile/{z}/{y}/{x}"))))
            )})


    output$well_start<-renderPlotly( {p<-ggplot(data = data_sub(),aes(x = well_start,color=Operator))+
        geom_line(stat = 'count')+
        ggtitle('New Well Development Time-Series')+
        xlab('Date')+ylab('Well Count')

    ggplotly(p, tooltip = c("Operator","y")) 
    })
    output$table<-renderRpivotTable(rpivotTable(data_sub(),
                                                rows = "Basin",cols = "Operator",aggregatorName = "Count",
                                                vals = "wellID"))

}

shinyApp(ui = ui, server = server)
Добро пожаловать на сайт PullRequest, где вы можете задавать вопросы и получать ответы от других членов сообщества.
...