Thanks for your help guys.
I've been doing some testing and seems to rendering the graph that is the problem. If I comment out line 40 ie. no graph displayed it works fine. But the script. including graph works in r studio (without tool_exec <- function...)
Here is the code I've been testing. Which the ArcGIS Toolbox script points to
################################################################################
### Interactive R and Arcgis Example
################################################################################
tool_exec <- function(in_params, out_params){
arc.progress_label("Loading packages ...")
arc.progress_pos(10)
library(shiny)
library(dplyr)
################################################################################
### Load Data
################################################################################
arc.progress_label("Loading data ...")
arc.progress_pos(20)
Year<-c(2000,2001,2002,2003,2000,2003,2000,2000,2005)
Dwells<-c(50,20,25,26,27,300,100,80,100)
df_test <- data.frame(Year,Dwells)
################################################################################
### Load App
################################################################################
arc.progress_label("Starting App ...")
arc.progress_pos(50)
ui <- fluidPage(
sidebarLayout(
sidebarPanel(sliderInput("Explore_Years", 'Select years to explore',
min=2000, max= 2005,value = c(2000,2005),sep='')),
mainPanel(textOutput("text_out")
, tableOutput("table_out")
, plotOutput("graph_out") #####<<<< Works if comment this line out#######
)
)
)
server <- function(input, output) {
Summary_test<-reactive({
df_test%>%
filter((Year >= input$Explore_Years[1]),
(Year <= input$Explore_Years[2]) ) %>%
group_by(Year)%>%
summarize(Dwellings = sum(Dwells))
})
output$text_out <- renderText({paste ("You have selected minimum year ",input$Explore_Years[1])
})
output$table_out <- renderTable({Summary_test()
})
output$graph_out <- renderPlot({
plot(Summary_test()$Year,Summary_test()$Dwellings)
})
}
runApp(list(ui = ui, server = server))
}