Having trouble making a graph interactive in r shiny

Hi,

So I have this error in my r shiny app: Aesthetics must be either length 1 or the same as the data (12): x when I try to choose 1 or 2 lines and I tried changing the data from wide to long but either I didn't do it right or it didn't work so I'm stuck. My made up data has some zeros in it as well. Below is my code and my data looks like this:

head(CeventData)
Month Ocurrence Events
1 1/1/2020 34 A Fib
2 2/1/2020 24 A Fib
3 3/1/2020 30 A Fib
4 4/1/2020 40 A Fib
5 5/1/2020 10 A Fib
6 6/1/2020 26 A Fib

Here is my code:
library(shiny)
library(shinydashboard)
#>
#> Attaching package: 'shinydashboard'
#> The following object is masked from 'package:graphics':
#>
#> box
library(tidyverse)
library(dplyr)
library(ggplot2)
library(shinyalert)
#>
#> Attaching package: 'shinyalert'
#> The following object is masked from 'package:shiny':
#>
#> runExample

CeventData<- read.csv("C:/Users/bookw/OneDrive/Documents/pmShinyApp-1/cardiac_events_type_of_events.csv")
CeventData[13,3] <- "V Fib"

ui <- dashboardPage(skin="red",
dashboardHeader(title = "PaceMaker App"),
dashboardSidebar(
sidebarMenu(
menuItem("Cardiac Events", tabName = "dashboard", icon = icon("heart")),
menuItem("Provider Contact", tabName = "Contacts", icon = icon("address-book"))
)
),
dashboardBody(
tabItems(
# First tab content
tabItem(tabName = "dashboard",
fluidRow(
box(plotOutput("EventGraphPlot", width= 800, height = 500)),

            box(
              
              checkboxGroupInput("cardiac_event_choose", "Choose a Cardiac Event", c("A Fib","V Fib", "VT"))
            ),
            useShinyalert(),
            actionButton("pbutton", "Print"),
          )
  ),
  
  # Second tab content
  tabItem(
    tabName = "Contacts",
    h1("Contact Provider"),
    # Set up shinyalert
    useShinyalert(),
    fluidRow( column=4,
              actionButton("button", "Contact Provider"),
              mainPanel(h2(" Enter up to 100 characters in your message:") ),
              #makes a textbox
              textAreaInput(inputId=NULL, label=NULL, value = "", width = 300,
                            height = 500, cols = NULL, rows = NULL, placeholder = 99,
                            resize = NULL),
    ),
    useShinyalert(),
    actionButton("sbutton", "Send"),
  )      
) 

)
)

server<- function(input,output) {

#contacts
#Set up shinyalert")

observeEvent(input$button, {
# Show a modal when the button is pressed
shinyalert("If this is a life-threatening emergency, call 911!")

})

observeEvent(input$pbutton, {
# Show a modal when the button is pressed
shinyalert("Would you like to print out this graph?")
})

observeEvent(input$sbutton, {
# Show a modal when the button is pressed
shinyalert("Your secure email was sent to your provider")
})
#Events
#data manipulation

data_1=reactive({
return(CeventData[CeventData$Events%in%input$cardiac_event_choose,])
})

output$EventGraphPlot <- renderPlot( ggplot(data=data_1(), aes(x=Months, y=Ocurrence, group=Events, color= Events)) +
geom_line(aes(linetype=Events),size=1.25) +geom_point( aes(shape=Events),size=4) +
scale_linetype_manual(values=c("dashed", "dotdash", "solid"))+
scale_color_manual(values=c("#8E44AD", "#5DADE2", "#C0392B"))+
scale_shape_manual(values=c(17,19,15))+
theme(legend.position="right",)+
theme(axis.text.x = element_text(angle=45, hjust = 1))
)

}

shinyApp(ui=ui, server=server)

![r

hi @AnimeKat,

just a note: we are not able to run your code directly since the dataset is not defined in the code and it's not a built-in dataset. If you can make your error reproducible, you are more likely to get help.