12/04/2021

Objective

  • This objective of this project is to create a web page presentation using R Markdown and featuring a plot created with Plotly.

  • The interactive plot shows the results from an experiment studying the effect of vitamin C on tooth growth in 60 Guinea pigs. Each animal received one of three dose levels of vitamin C (0.5, 1, and 2 mg/day) by one of two delivery methods, orange juice or ascorbic acid. The data is from ToothGrowth dataset in datasets package.

Load the packages and data

library(plotly)
library(datasets)
library(reshape2)
## Loading data
data(ToothGrowth)

Code for plotting using plotly

Plots showing effect of different supplements on teeth growth.

p <- plot_ly(data=ToothGrowth, x = ~dose, y= ~len, 
             color=~supp, type = 'box')
p <- p %>% layout(autosize = F, width = 500, height = 400, 
title = "Effect of different supplements on teeth growth", 
xaxis=list(title="Dose"), yaxis=list(title="Teeth length"))
p

Plot of dose vs teeth growth by supplement