- Set the seed
- Load plot_ly library
- Create a 5000 element sample of 'Diamonds' Data
- Create a sweet plot of carat vs. price with color=cut
February 9, 2020
install.packages("plotly", repos='http://cran.us.r-project.org')
## Installing package into 'C:/Users/James/Documents/R/win-library/3.6' ## (as 'lib' is unspecified)
## package 'plotly' successfully unpacked and MD5 sums checked ## ## The downloaded binary packages are in ## C:\Users\James\AppData\Local\Temp\RtmpUJOZyZ\downloaded_packages
require(plotly)
## Loading required package: plotly
## 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(plotly) smallsample<-diamonds[sample(nrow(diamonds),5000),]