The following demos are modified from https://www.r-graph-gallery.com/interactive-charts.html.

I. Examples with plotly

1) Scatterplots

fert<-read.csv("https://raw.githubusercontent.com/kitadasmalley/FA2020_DataViz/main/data/gapminderFert.csv", 
               header=TRUE)

library(tidyverse)
#install.packages("plotly")
library(plotly)

p<- fert%>%
  ggplot(aes(x=fert, y=life, size = pop, color = continent,frame = year)) +
  labs(x="Fertility Rate", y = "Life expectancy at birth (years)", 
       caption = "(Based on data from Hans Rosling - gapminder.com)", 
       color = 'Continent',size = "Population (millions)") + 
  ylim(30,100) +
  geom_point(aes(text=Country))

ggplotly(p)

2) Area Charts and Time Series

# Load dataset from github
data <- read.table("https://raw.githubusercontent.com/holtzy/data_to_viz/master/Example_dataset/3_TwoNumOrdered.csv", header=T)
data$date <- as.Date(data$date)

# Usual area chart
p <- data %>%
  ggplot( aes(x=date, y=value)) +
  geom_area(fill="#69b3a2", alpha=0.5) +
  geom_line(color="#69b3a2") +
  ylab("bitcoin price ($)") 

# Turn it interactive with ggplotly
p <- ggplotly(p)
p

II. Example with heatmaply

Here is an example showing 8 general features like population or life expectancy for about 30 countries in 2015. Data come from the French National Institute of Demographic Studies https://www.ined.fr/en/everything_about_population/data/all-countries/?lst_continent=908&lst_pays=926

Heatmap (left to right): * Pop * Birth rate * Mortality rate * Life expectancy * Infant Mortality * Children per woman * Growth rate * Population aged 65

library(viridis)

#install.packages("heatmaply")
library(heatmaply)

# Load data 
data <- read.table("https://raw.githubusercontent.com/holtzy/data_to_viz/master/Example_dataset/multivariate.csv", header=T, sep=";")
head(data)
##           Country  Pop Birth.rate Mortality.rate Life.expectancy
## 1 Channel Islands  166      9.280          9.140          81.269
## 2         Denmark 5733     10.707          9.620          80.839
## 3         Estonia 1302     10.698         12.657          77.342
## 4         Finland 5556     10.672          9.865          81.576
## 5         Iceland  337     12.836          6.467          83.220
## 6         Ireland 4791     13.179          6.562          81.621
##   Infant.mortality Children.per.woman Growth.rate Population.aged.65. Group
## 1            7.276              1.492        4.56                  30 North
## 2            3.495              1.758        3.67                1132 North
## 3            2.843              1.657       -2.63                 256 North
## 4            1.839              1.764        2.65                1212 North
## 5            1.752              1.893        7.83                  50 North
## 6            2.385              1.998        8.84                 682 North
##   Continent
## 1    Europe
## 2    Europe
## 3    Europe
## 4    Europe
## 5    Europe
## 6    Europe
colnames(data) <- gsub("\\.", " ", colnames(data))

# Select a few country
data <- data %>% 
  filter(Country %in% c("France", "Sweden", "Italy", "Spain", "England", "Portugal", "Greece", "Peru", "Chile", "Brazil", "Argentina", "Bolivia", "Venezuela", "Australia", "New Zealand", "Fiji", "China", "India", "Thailand", "Afghanistan", "Bangladesh", "United States of America", "Canada", "Burundi", "Angola", "Kenya", "Togo")) %>%
  arrange(Country) %>%
  mutate(Country = factor(Country, Country))

# Matrix format
mat <- data
rownames(mat) <- mat[,1]
mat <- mat %>% dplyr::select(-Country, -Group, -Continent)
mat <- as.matrix(mat)

head(mat)
##                Pop Birth rate Mortality rate Life expectancy Infant mortality
## Afghanistan  34936       31.0            7.6            61.7             62.8
## Angola       27498       43.6           12.6            53.9             86.8
## Argentina    44692       16.8            7.5            77.0             11.5
## Australia    24967       12.9            6.7            83.1              3.3
## Bangladesh  166735       18.4            5.2            73.1             24.8
## Bolivia      11218       22.8            7.2            69.8             34.3
##             Children per woman Growth rate Population aged 65 
## Afghanistan               4.15        21.8                 906
## Angola                    5.75        31.0                 658
## Argentina                 2.26         9.3                 507
## Australia                 1.86        12.9                3945
## Bangladesh                2.06        11.4                8373
## Bolivia                   2.81        14.7                 767
# Heatmap
p <- heatmaply(mat, 
               dendrogram = "none",
               xlab = "", ylab = "", 
               main = "",
               scale = "column",
               margins = c(60,100,40,20),
               grid_color = "white",
               grid_width = 0.00001,
               titleX = FALSE,
               hide_colorbar = TRUE,
               branches_lwd = 0.1,
               label_names = c("Country", "Feature:", "Value"),
               fontsize_row = 5, fontsize_col = 5,
               labCol = colnames(mat),
               labRow = rownames(mat),
               heatmap_layers = theme(axis.line=element_blank())
)
p

III. streamgraph

Here is a great resource about the streamgraph htmlwidgtet R Package! https://hrbrmstr.github.io/streamgraph/

Using the babynames dataset from (1880-2013)

library(dplyr)
library(babynames)
library(streamgraph)

babynames %>%
  filter(grepl("^Kr", name)) %>%
  group_by(year, name) %>%
  tally(wt=n) %>%
  streamgraph("name", "n", "year")

Or you can add a drop down

babynames %>%
  filter(grepl("^H", name)) %>%
  group_by(year, name) %>%
  tally(wt=n) %>%
  streamgraph("name", "n", "year", offset="zero", interpolate="linear") %>%
  sg_legend(show=TRUE, label="H- names: ")