Black Lives Matter. Please consider donating to Black Girls Code today.
Learn how to use COVID-19 data in open source Dash apps. Register for the Sept 23rd webinar with IQT!

R: ggplot2 can't show the output

When i use the plotly with ggplot2 and dplyr,i hava some problem.The problem as follow:
code1:
p <- plot_ly(economics, x = date, y = uempmed)
p %>%
layout(title = “Median duration of unemployment (in weeks)”,showlegend = FALSE) %>%
dplyr::filter(uempmed == max(uempmed)) %>%
layout(annotations = list(x = date, y = uempmed, text = “Peak”, showarrow = T))

code2:
p <- ggplot(data=economics,aes(x=date,y=uempmed))
p <- p+geom_line()
p
gg <- ggplotly§
gg %>%
layout(title = “Median duration of unemployment (in weeks)”) %>%
dplyr::filter(uempmed == max(uempmed)) %>%
layout(annotations = list(x = date, y = uempmed, text = “Peak”, showarrow = T))

the code1 is ok to run ,but the code2 can’t have the output with the error" ‘options’ must be a fully named list, or have no names (NULL)".
anyone can solve this problem

This one is very tricky. I am looking into it.