Black Lives Matter. Please consider donating to Black Girls Code today.

Creating a box plot with Adding Jittered Points in Rstudio

Good afternoon. I am trying to create a box plot in Rstudio using plotly, and adding Jittered Points. I am a very new user. I have only been learning R, and Rstudio for about 3 weeks now, so i apologize if i misuse terms or misspeak. The code i found on the plotly website is the following:

p <- plot_ly(y = ~rnorm(50), type = “box”, boxpoints = “all”, jitter = 0.3,
pointpos = -1.8)

p

And when i plug it into the console, it works great! But I need to know how to make it read a data set I’ve created so it can show that data. How do i do that? Also, i would like to construct two box plots side-by-side to show how two data sets differ from one another. Thank you in advance for your help.