library(plotly)
## Warning: package 'plotly' was built under R version 3.6.3
## Loading required package: ggplot2
##
## Attaching package: 'plotly'
## The following object is masked from 'package:ggplot2':
##
## last_plot
## The following object is masked from 'package:stats':
##
## filter
## The following object is masked from 'package:graphics':
##
## layout
library(dplyr)
##
## Attaching package: 'dplyr'
## The following objects are masked from 'package:stats':
##
## filter, lag
## The following objects are masked from 'package:base':
##
## intersect, setdiff, setequal, union
df1 <- df%>%group_by(country)%>%summarize(total_death = sum(death))
fig <- plot_ly(df1, x = ~country, y = ~total_death)
fig
## No trace type specified:
## Based on info supplied, a 'bar' trace seems appropriate.
## Read more about this trace type -> https://plot.ly/r/reference/#bar
Note that the echo = FALSE parameter was added to the code chunk to prevent printing of the R code that generated the plot.