1 Knowing the directory
getwd() # Knowing the present directory
## [1] "/Users/janakiramsundaraneedi/Desktop/trainingSet"
setwd("/Users/janakiramsundaraneedi/Desktop/trainingSet") # Setting the directory where dataset are present
2 Reading Dataset
patientT = read.csv('training_SyncPatient.csv')
patientCondT = read.csv('training_SyncPatientCondition.csv')
trnscrpT =read.csv('training_SyncTranscript.csv')
3 Installing the packages
install.packages("dplyr", repos = "http://cran.us.r-project.org")
##
## The downloaded binary packages are in
## /var/folders/4z/9kr7k7jd1q7gc792xjkrwf040000gn/T//Rtmpjxy0TI/downloaded_packages
library(dplyr)
##
## Attaching package: 'dplyr'
## The following objects are masked from 'package:stats':
##
## filter, lag
## The following objects are masked from 'package:base':
##
## intersect, setdiff, setequal, union
install.packages("plotly", repos = "http://cran.us.r-project.org")
##
## There is a binary version available but the source version is
## later:
## binary source needs_compilation
## plotly 4.5.6 4.6.0 FALSE
## installing the source package 'plotly'
library(plotly)
## Loading required package: ggplot2
## Warning: package 'ggplot2' was built under R version 3.3.2
##
## 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
install.packages("googleVis", repos = "http://cran.us.r-project.org")
##
## The downloaded binary packages are in
## /var/folders/4z/9kr7k7jd1q7gc792xjkrwf040000gn/T//Rtmpjxy0TI/downloaded_packages
library(googleVis)
## Warning: package 'googleVis' was built under R version 3.3.2
## Creating a generic function for 'toJSON' from package 'jsonlite' in package 'googleVis'
##
## Welcome to googleVis version 0.6.2
##
## Please read Google's Terms of Use
## before you start using the package:
## https://developers.google.com/terms/
##
## Note, the plot method of googleVis will by default use
## the standard browser to display its output.
##
## See the googleVis package vignettes for more details,
## or visit http://github.com/mages/googleVis.
##
## To suppress this message use:
## suppressPackageStartupMessages(library(googleVis))
4 Histogram Plot
Com_Women_men <- count(group_by(patientT, DMIndicator="1", Gender))
plot_ly(Com_Women_men, x = ~Gender, y = ~n)
## No trace type specified:
## Based on info supplied, a 'bar' trace seems appropriate.
## Read more about this trace type -> https://plot.ly/r/reference/#bar
5 Scatter Plot, State wise Diabetes.
count_state_wise <- count(group_by(patientT, DMIndicator="1", State))
p <- plot_ly(count_state_wise, x = ~State, y = ~n, type = 'scatter')
p
## No scatter mode specifed:
## Setting the mode to markers
## Read more about this attribute -> https://plot.ly/r/reference/#scatter-mode
United States, STATE wise diabetes using Geo.
# http://www.cs.uml.edu/~jsundara/Usmap/
7 Number of patient’s addmitted by year
## Source: local data frame [2 x 3]
## Groups: DMIndicator [?]
##
## DMIndicator CreatedYear n
## <chr> <int> <int>
## 1 1 2011 1931
## 2 1 2012 905
8 Classify Using Decision Tree
