Introduction

This is the week 3 assignment project of the Coursera cours-Developing Data Products. My goal is to create a HTML presentation page using R Markdown for a plot created by Plotly.

Data plotted

The association of probability of Diabetes Mellitus with two important diabetes risk factors, HOMA-B and HOMA-IR, were ploted as a 3D format.

library(foreign)
library(ggplot2)
## Warning: package 'ggplot2' was built under R version 3.4.4
library(plotly)
## Warning: package 'plotly' was built under R version 3.4.4
## 
## 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
try<-read.ssd("S:/WIHS/W14072/mydata", "plotlydt", sascmd="C:/Program Files/SASHome2/SASFoundation/9.4/sas.exe")
group1<-try[ which(try$STRATA=='HIV+ & L2+'), ]
g1<-plot_ly(group1, x=~LOG_HOMA, y=~LOGHOMA, z=~PROB, type = "scatter3d", colors = 'blue', mode="markers", 
            marker=list(symbol = 'diamond', size = 3, opacity=0.8)) %>% 
  #add_markers() %>%
  layout(title='DM probability 3D plot for HIV+ & L2+ WIHS women',
         scene = list(xaxis = list(title = 'Log HOMAB', 
                                   zerolinewidth = 1,
                                   ticklen = 5,
                                   gridwidth = 2,
                                   range = c(2.7, 8.7)),
                      yaxis = list(title = 'Log HOMAIR',
                                   zerolinewidth = 1,
                                   ticklen = 5,
                                   gridwidth = 2,
                                   range = c(-1.14, 3.7)),
                      zaxis = list(title = 'DM probability',
                                   zerolinewidth = 1,
                                   ticklen = 5,
                                   gridwidth = 2,
                                   range = c(0, 0.8))))
g1
## Warning: Ignoring 1 observations
## Warning: package 'bindrcpp' was built under R version 3.4.4