Well, your dataset isn't really a dataset, its some text, so I'm sure i don't know what's going on.
I recommend that you demo one state of your shiny app in a plain r script without shiny first before you then grow a shiny app out of it.
I think I have the ingest of data figured out. Now I am having an issue what is probably stupid. I am getting an error with the beginning of my data carpentry
Error in ndl_data(var_one = c("2020", "2019", "2018", "2017"), var_two = c("SCI", :
could not find function "ndl_data"
ok I changed my script. I am trying to go piece by piece. Currently I have
library(shiny)
library(readxl)
library(plotly)
library(dplyr)
library(ggplot2)
library(forecast)
library(tidyverse)
library(lubridate)
library(zoo)
#read_excel(data)
data<-read_xlsx(".xlsx")
# convert the Closed column to an actual date so that we can easily select all days in a given year.
new.date.time<-as.POSIXct(data$Closed,format="%d/$m/$y")
# select everything by year
df$"2018" <- data[data$"Closed" >= "01/01/2018" & data$"Closed" <= "31/12/2018",]
df2018<-df$"2018"
df2018ts<-ts(df2018,frequency = 12,start("2018-01-01"))
df$"SCI" <- df2018[which(df2018$"Network"== "COE")]
I am having an issue with the last part
select everything by year
df$"2018" <- data[data$"Closed" >= "01/01/2018" & data$"Closed" <= "31/12/2018",]
Error in df$"2018" <- data[data$Closed >= "01/01/2018" & data$Closed <= :
object of type 'closure' is not subsettable
Its a bad idea to name your own objects with the names of existing R objects.
Both data and df fall into that camp.
Also I notice you are heavily leaning on base R rather than tidyverse/dplyr despite loading them. Applying a dplyr filter seems a lot more elegant to me than the base R subsetting syntax that involves repeating the dataframe name.