library(rmarkdown)
library(tidyverse)
library(plotly)
With minor adaptations from the Plotly website
set.seed(123)
d <- diamonds[sample(nrow(diamonds), 1000), ]
plot_ly(d, x = ~carat, y = ~price, color = ~carat, size = ~carat, text = ~paste("Clarity: ", clarity))