getwd()
## [1] "C:/Users/dell/Desktop/test3"
setwd("C:/Users/dell/Desktop")
dir(,pattern = ".csv")
## [1] "BigDiamonds.csv"         "BigDiamonds.csv (2).zip"
memory.limit()
## [1] 1535
memory.size()
## [1] 18.5
rm(list = ls())
gc()
##          used (Mb) gc trigger (Mb) max used (Mb)
## Ncells 367092  9.9     750400 20.1   460000 12.3
## Vcells 381970  3.0    1023718  7.9   752284  5.8
plot(iris)

plot(iris[4:5])

plot(mtcars$mpg,mtcars$gear)

plot(mtcars$gear,mtcars$mpg)

plot(AirPassengers)

plot(mtcars$mpg)

plot(mtcars$mpg,type="l")

plot(mtcars$mpg,type="h")

boxplot(mtcars$mpg)

boxplot(mtcars$mpg~mtcars$gear)

barplot(mtcars$mpg)

table(mtcars$mpg,mtcars$gear)
##       
##        3 4 5
##   10.4 2 0 0
##   13.3 1 0 0
##   14.3 1 0 0
##   14.7 1 0 0
##   15   0 0 1
##   15.2 2 0 0
##   15.5 1 0 0
##   15.8 0 0 1
##   16.4 1 0 0
##   17.3 1 0 0
##   17.8 0 1 0
##   18.1 1 0 0
##   18.7 1 0 0
##   19.2 1 1 0
##   19.7 0 0 1
##   21   0 2 0
##   21.4 1 1 0
##   21.5 1 0 0
##   22.8 0 2 0
##   24.4 0 1 0
##   26   0 0 1
##   27.3 0 1 0
##   30.4 0 1 1
##   32.4 0 1 0
##   33.9 0 1 0
barplot(table(mtcars$mpg,mtcars$gear))

barplot(table(mtcars$gear,mtcars$mpg))

par(mfrow=c(1,1))

hist(mtcars$mpg)

hist(mtcars$mpg,breaks = 10)
rug(mtcars$mpg)

plot(density(mtcars$mpg))

pie(table(mtcars$cyl))

pie(table(mtcars$gear))

par(mfrow=c(2,4))
pie(table(mtcars$cyl))
barplot(table(mtcars$cyl))
hist(mtcars$cyl)
plot(table(mtcars$cyl),type='l')


pie(table(mtcars$gear))
barplot(table(mtcars$gear))
hist(mtcars$gear)
plot(table(mtcars$gear),type='l')

par(mfrow=c(1,1))
par(bg="grey")
boxplot(iris$Sepal.Length~iris$Species)

par(mfrow=c(1,1))
par(bg="green")
boxplot(iris$Sepal.Length~iris$Species)

par(bg="yellow")
boxplot(iris$Sepal.Length~iris$Species,main="Box Plot of Sepal Length by Species")

colors()
##   [1] "white"                "aliceblue"            "antiquewhite"        
##   [4] "antiquewhite1"        "antiquewhite2"        "antiquewhite3"       
##   [7] "antiquewhite4"        "aquamarine"           "aquamarine1"         
##  [10] "aquamarine2"          "aquamarine3"          "aquamarine4"         
##  [13] "azure"                "azure1"               "azure2"              
##  [16] "azure3"               "azure4"               "beige"               
##  [19] "bisque"               "bisque1"              "bisque2"             
##  [22] "bisque3"              "bisque4"              "black"               
##  [25] "blanchedalmond"       "blue"                 "blue1"               
##  [28] "blue2"                "blue3"                "blue4"               
##  [31] "blueviolet"           "brown"                "brown1"              
##  [34] "brown2"               "brown3"               "brown4"              
##  [37] "burlywood"            "burlywood1"           "burlywood2"          
##  [40] "burlywood3"           "burlywood4"           "cadetblue"           
##  [43] "cadetblue1"           "cadetblue2"           "cadetblue3"          
##  [46] "cadetblue4"           "chartreuse"           "chartreuse1"         
##  [49] "chartreuse2"          "chartreuse3"          "chartreuse4"         
##  [52] "chocolate"            "chocolate1"           "chocolate2"          
##  [55] "chocolate3"           "chocolate4"           "coral"               
##  [58] "coral1"               "coral2"               "coral3"              
##  [61] "coral4"               "cornflowerblue"       "cornsilk"            
##  [64] "cornsilk1"            "cornsilk2"            "cornsilk3"           
##  [67] "cornsilk4"            "cyan"                 "cyan1"               
##  [70] "cyan2"                "cyan3"                "cyan4"               
##  [73] "darkblue"             "darkcyan"             "darkgoldenrod"       
##  [76] "darkgoldenrod1"       "darkgoldenrod2"       "darkgoldenrod3"      
##  [79] "darkgoldenrod4"       "darkgray"             "darkgreen"           
##  [82] "darkgrey"             "darkkhaki"            "darkmagenta"         
##  [85] "darkolivegreen"       "darkolivegreen1"      "darkolivegreen2"     
##  [88] "darkolivegreen3"      "darkolivegreen4"      "darkorange"          
##  [91] "darkorange1"          "darkorange2"          "darkorange3"         
##  [94] "darkorange4"          "darkorchid"           "darkorchid1"         
##  [97] "darkorchid2"          "darkorchid3"          "darkorchid4"         
## [100] "darkred"              "darksalmon"           "darkseagreen"        
## [103] "darkseagreen1"        "darkseagreen2"        "darkseagreen3"       
## [106] "darkseagreen4"        "darkslateblue"        "darkslategray"       
## [109] "darkslategray1"       "darkslategray2"       "darkslategray3"      
## [112] "darkslategray4"       "darkslategrey"        "darkturquoise"       
## [115] "darkviolet"           "deeppink"             "deeppink1"           
## [118] "deeppink2"            "deeppink3"            "deeppink4"           
## [121] "deepskyblue"          "deepskyblue1"         "deepskyblue2"        
## [124] "deepskyblue3"         "deepskyblue4"         "dimgray"             
## [127] "dimgrey"              "dodgerblue"           "dodgerblue1"         
## [130] "dodgerblue2"          "dodgerblue3"          "dodgerblue4"         
## [133] "firebrick"            "firebrick1"           "firebrick2"          
## [136] "firebrick3"           "firebrick4"           "floralwhite"         
## [139] "forestgreen"          "gainsboro"            "ghostwhite"          
## [142] "gold"                 "gold1"                "gold2"               
## [145] "gold3"                "gold4"                "goldenrod"           
## [148] "goldenrod1"           "goldenrod2"           "goldenrod3"          
## [151] "goldenrod4"           "gray"                 "gray0"               
## [154] "gray1"                "gray2"                "gray3"               
## [157] "gray4"                "gray5"                "gray6"               
## [160] "gray7"                "gray8"                "gray9"               
## [163] "gray10"               "gray11"               "gray12"              
## [166] "gray13"               "gray14"               "gray15"              
## [169] "gray16"               "gray17"               "gray18"              
## [172] "gray19"               "gray20"               "gray21"              
## [175] "gray22"               "gray23"               "gray24"              
## [178] "gray25"               "gray26"               "gray27"              
## [181] "gray28"               "gray29"               "gray30"              
## [184] "gray31"               "gray32"               "gray33"              
## [187] "gray34"               "gray35"               "gray36"              
## [190] "gray37"               "gray38"               "gray39"              
## [193] "gray40"               "gray41"               "gray42"              
## [196] "gray43"               "gray44"               "gray45"              
## [199] "gray46"               "gray47"               "gray48"              
## [202] "gray49"               "gray50"               "gray51"              
## [205] "gray52"               "gray53"               "gray54"              
## [208] "gray55"               "gray56"               "gray57"              
## [211] "gray58"               "gray59"               "gray60"              
## [214] "gray61"               "gray62"               "gray63"              
## [217] "gray64"               "gray65"               "gray66"              
## [220] "gray67"               "gray68"               "gray69"              
## [223] "gray70"               "gray71"               "gray72"              
## [226] "gray73"               "gray74"               "gray75"              
## [229] "gray76"               "gray77"               "gray78"              
## [232] "gray79"               "gray80"               "gray81"              
## [235] "gray82"               "gray83"               "gray84"              
## [238] "gray85"               "gray86"               "gray87"              
## [241] "gray88"               "gray89"               "gray90"              
## [244] "gray91"               "gray92"               "gray93"              
## [247] "gray94"               "gray95"               "gray96"              
## [250] "gray97"               "gray98"               "gray99"              
## [253] "gray100"              "green"                "green1"              
## [256] "green2"               "green3"               "green4"              
## [259] "greenyellow"          "grey"                 "grey0"               
## [262] "grey1"                "grey2"                "grey3"               
## [265] "grey4"                "grey5"                "grey6"               
## [268] "grey7"                "grey8"                "grey9"               
## [271] "grey10"               "grey11"               "grey12"              
## [274] "grey13"               "grey14"               "grey15"              
## [277] "grey16"               "grey17"               "grey18"              
## [280] "grey19"               "grey20"               "grey21"              
## [283] "grey22"               "grey23"               "grey24"              
## [286] "grey25"               "grey26"               "grey27"              
## [289] "grey28"               "grey29"               "grey30"              
## [292] "grey31"               "grey32"               "grey33"              
## [295] "grey34"               "grey35"               "grey36"              
## [298] "grey37"               "grey38"               "grey39"              
## [301] "grey40"               "grey41"               "grey42"              
## [304] "grey43"               "grey44"               "grey45"              
## [307] "grey46"               "grey47"               "grey48"              
## [310] "grey49"               "grey50"               "grey51"              
## [313] "grey52"               "grey53"               "grey54"              
## [316] "grey55"               "grey56"               "grey57"              
## [319] "grey58"               "grey59"               "grey60"              
## [322] "grey61"               "grey62"               "grey63"              
## [325] "grey64"               "grey65"               "grey66"              
## [328] "grey67"               "grey68"               "grey69"              
## [331] "grey70"               "grey71"               "grey72"              
## [334] "grey73"               "grey74"               "grey75"              
## [337] "grey76"               "grey77"               "grey78"              
## [340] "grey79"               "grey80"               "grey81"              
## [343] "grey82"               "grey83"               "grey84"              
## [346] "grey85"               "grey86"               "grey87"              
## [349] "grey88"               "grey89"               "grey90"              
## [352] "grey91"               "grey92"               "grey93"              
## [355] "grey94"               "grey95"               "grey96"              
## [358] "grey97"               "grey98"               "grey99"              
## [361] "grey100"              "honeydew"             "honeydew1"           
## [364] "honeydew2"            "honeydew3"            "honeydew4"           
## [367] "hotpink"              "hotpink1"             "hotpink2"            
## [370] "hotpink3"             "hotpink4"             "indianred"           
## [373] "indianred1"           "indianred2"           "indianred3"          
## [376] "indianred4"           "ivory"                "ivory1"              
## [379] "ivory2"               "ivory3"               "ivory4"              
## [382] "khaki"                "khaki1"               "khaki2"              
## [385] "khaki3"               "khaki4"               "lavender"            
## [388] "lavenderblush"        "lavenderblush1"       "lavenderblush2"      
## [391] "lavenderblush3"       "lavenderblush4"       "lawngreen"           
## [394] "lemonchiffon"         "lemonchiffon1"        "lemonchiffon2"       
## [397] "lemonchiffon3"        "lemonchiffon4"        "lightblue"           
## [400] "lightblue1"           "lightblue2"           "lightblue3"          
## [403] "lightblue4"           "lightcoral"           "lightcyan"           
## [406] "lightcyan1"           "lightcyan2"           "lightcyan3"          
## [409] "lightcyan4"           "lightgoldenrod"       "lightgoldenrod1"     
## [412] "lightgoldenrod2"      "lightgoldenrod3"      "lightgoldenrod4"     
## [415] "lightgoldenrodyellow" "lightgray"            "lightgreen"          
## [418] "lightgrey"            "lightpink"            "lightpink1"          
## [421] "lightpink2"           "lightpink3"           "lightpink4"          
## [424] "lightsalmon"          "lightsalmon1"         "lightsalmon2"        
## [427] "lightsalmon3"         "lightsalmon4"         "lightseagreen"       
## [430] "lightskyblue"         "lightskyblue1"        "lightskyblue2"       
## [433] "lightskyblue3"        "lightskyblue4"        "lightslateblue"      
## [436] "lightslategray"       "lightslategrey"       "lightsteelblue"      
## [439] "lightsteelblue1"      "lightsteelblue2"      "lightsteelblue3"     
## [442] "lightsteelblue4"      "lightyellow"          "lightyellow1"        
## [445] "lightyellow2"         "lightyellow3"         "lightyellow4"        
## [448] "limegreen"            "linen"                "magenta"             
## [451] "magenta1"             "magenta2"             "magenta3"            
## [454] "magenta4"             "maroon"               "maroon1"             
## [457] "maroon2"              "maroon3"              "maroon4"             
## [460] "mediumaquamarine"     "mediumblue"           "mediumorchid"        
## [463] "mediumorchid1"        "mediumorchid2"        "mediumorchid3"       
## [466] "mediumorchid4"        "mediumpurple"         "mediumpurple1"       
## [469] "mediumpurple2"        "mediumpurple3"        "mediumpurple4"       
## [472] "mediumseagreen"       "mediumslateblue"      "mediumspringgreen"   
## [475] "mediumturquoise"      "mediumvioletred"      "midnightblue"        
## [478] "mintcream"            "mistyrose"            "mistyrose1"          
## [481] "mistyrose2"           "mistyrose3"           "mistyrose4"          
## [484] "moccasin"             "navajowhite"          "navajowhite1"        
## [487] "navajowhite2"         "navajowhite3"         "navajowhite4"        
## [490] "navy"                 "navyblue"             "oldlace"             
## [493] "olivedrab"            "olivedrab1"           "olivedrab2"          
## [496] "olivedrab3"           "olivedrab4"           "orange"              
## [499] "orange1"              "orange2"              "orange3"             
## [502] "orange4"              "orangered"            "orangered1"          
## [505] "orangered2"           "orangered3"           "orangered4"          
## [508] "orchid"               "orchid1"              "orchid2"             
## [511] "orchid3"              "orchid4"              "palegoldenrod"       
## [514] "palegreen"            "palegreen1"           "palegreen2"          
## [517] "palegreen3"           "palegreen4"           "paleturquoise"       
## [520] "paleturquoise1"       "paleturquoise2"       "paleturquoise3"      
## [523] "paleturquoise4"       "palevioletred"        "palevioletred1"      
## [526] "palevioletred2"       "palevioletred3"       "palevioletred4"      
## [529] "papayawhip"           "peachpuff"            "peachpuff1"          
## [532] "peachpuff2"           "peachpuff3"           "peachpuff4"          
## [535] "peru"                 "pink"                 "pink1"               
## [538] "pink2"                "pink3"                "pink4"               
## [541] "plum"                 "plum1"                "plum2"               
## [544] "plum3"                "plum4"                "powderblue"          
## [547] "purple"               "purple1"              "purple2"             
## [550] "purple3"              "purple4"              "red"                 
## [553] "red1"                 "red2"                 "red3"                
## [556] "red4"                 "rosybrown"            "rosybrown1"          
## [559] "rosybrown2"           "rosybrown3"           "rosybrown4"          
## [562] "royalblue"            "royalblue1"           "royalblue2"          
## [565] "royalblue3"           "royalblue4"           "saddlebrown"         
## [568] "salmon"               "salmon1"              "salmon2"             
## [571] "salmon3"              "salmon4"              "sandybrown"          
## [574] "seagreen"             "seagreen1"            "seagreen2"           
## [577] "seagreen3"            "seagreen4"            "seashell"            
## [580] "seashell1"            "seashell2"            "seashell3"           
## [583] "seashell4"            "sienna"               "sienna1"             
## [586] "sienna2"              "sienna3"              "sienna4"             
## [589] "skyblue"              "skyblue1"             "skyblue2"            
## [592] "skyblue3"             "skyblue4"             "slateblue"           
## [595] "slateblue1"           "slateblue2"           "slateblue3"          
## [598] "slateblue4"           "slategray"            "slategray1"          
## [601] "slategray2"           "slategray3"           "slategray4"          
## [604] "slategrey"            "snow"                 "snow1"               
## [607] "snow2"                "snow3"                "snow4"               
## [610] "springgreen"          "springgreen1"         "springgreen2"        
## [613] "springgreen3"         "springgreen4"         "steelblue"           
## [616] "steelblue1"           "steelblue2"           "steelblue3"          
## [619] "steelblue4"           "tan"                  "tan1"                
## [622] "tan2"                 "tan3"                 "tan4"                
## [625] "thistle"              "thistle1"             "thistle2"            
## [628] "thistle3"             "thistle4"             "tomato"              
## [631] "tomato1"              "tomato2"              "tomato3"             
## [634] "tomato4"              "turquoise"            "turquoise1"          
## [637] "turquoise2"           "turquoise3"           "turquoise4"          
## [640] "violet"               "violetred"            "violetred1"          
## [643] "violetred2"           "violetred3"           "violetred4"          
## [646] "wheat"                "wheat1"               "wheat2"              
## [649] "wheat3"               "wheat4"               "whitesmoke"          
## [652] "yellow"               "yellow1"              "yellow2"             
## [655] "yellow3"              "yellow4"              "yellowgreen"
par(bg="yellowgreen")
boxplot(iris$Sepal.Length~iris$Species,main="Box Plot of Sepal Length by Species",xlab="Species",ylab="Sepal Length of Iris Flowers in cm")

data("trees")

#box,bar,scatter,line plot in 1 screen
#titles, xlab, ylab, color bg 

str(trees)
## 'data.frame':    31 obs. of  3 variables:
##  $ Girth : num  8.3 8.6 8.8 10.5 10.7 10.8 11 11 11.1 11.2 ...
##  $ Height: num  70 65 63 72 81 83 66 75 80 75 ...
##  $ Volume: num  10.3 10.3 10.2 16.4 18.8 19.7 15.6 18.2 22.6 19.9 ...
par(mfrow=c(2,2))
par(bg="wheat1")
attach(trees)
boxplot(Girth~Volume,main="Girth vs Volume",xlab="Girth",ylab="Volume")
barplot(Girth,main="Girth",ylab="Girth")
plot(Girth,Volume,main="Girth vs Volume",xlab="Girth",ylab="Volume")
plot(Girth,type="l",main="Girth ",ylab="Girth")

par(mfrow=c(2,2))
par(bg="skyblue2")
boxplot(trees$Height~trees$Volume, main="box plot of tree height by volume", xlab="Volume", ylab="height of trees")
barplot(trees$Height, main="box plot of tree height by volume", xlab="Volume", ylab="height")
plot(table(trees$Girth),type='l')
plot(table(trees$Girth),type='h')

par(mfrow=c(2,4))
par(bg="yellowgreen")
boxplot(trees$Girth~trees$Height)
barplot(trees$Girth)
scatter.smooth(trees$Girth)
line(trees$Height)
## 
## Call:
## line(trees$Height)
## 
## Coefficients:
## [1]  72.75   0.25
boxplot(trees$Girth~trees$Height,main="Trees,",xlab="Girth",ylab="Height")


par(mfrow=c(1,4))

#par(bg="redgreen")
attach(trees)
## The following objects are masked from trees (pos = 3):
## 
##     Girth, Height, Volume
boxplot(Height~Volume,main="Ravi - Height vs Volume",xlab="Girth",ylab="Volume")
barplot(Height,main="Girth",ylab="Girth")
plot(Height,Volume,main="Ravi - Height vs Volume",xlab="Height",ylab="Volume")
plot(Height,type="l",main="Height ",ylab="Height")

par(mfrow=c(1,1))

plot(Height,col="blue",type="l",main="Height ",ylab="Height")

barplot(Height,main="Girth",ylab="Girth",col = "wheat1")

par(mfrow=c(2,3))
hist(iris$Sepal.Length,col=topo.colors(3))
hist(iris$Sepal.Length,col=topo.colors(6))
hist(iris$Sepal.Length,col=topo.colors(9))
hist(iris$Sepal.Length,col=topo.colors(3,0.1))
hist(iris$Sepal.Length,col=topo.colors(3,0.6))
hist(iris$Sepal.Length,col=topo.colors(3,0.9))

par(mfrow=c(3,5))
hist(iris$Sepal.Length,col=topo.colors(6))
hist(iris$Sepal.Length,col=cm.colors(6))
hist(iris$Sepal.Length,col=terrain.colors(6))
hist(iris$Sepal.Length,col=heat.colors(6))
hist(iris$Sepal.Length,col=rainbow(6))


hist(iris$Sepal.Length,col=topo.colors(3))
hist(iris$Sepal.Length,col=cm.colors(3))
hist(iris$Sepal.Length,col=terrain.colors(3))
hist(iris$Sepal.Length,col=heat.colors(3))
hist(iris$Sepal.Length,col=rainbow(3))


hist(iris$Sepal.Length,col=topo.colors(6,0.2))
hist(iris$Sepal.Length,col=cm.colors(6,0.2))
hist(iris$Sepal.Length,col=terrain.colors(6,0.2))
hist(iris$Sepal.Length,col=heat.colors(6,0.2))
hist(iris$Sepal.Length,col=rainbow(6,0.2))

library(RColorBrewer)
par(mfrow=c(1,1))
display.brewer.all()

par(mfrow=c(2,3))

hist(iris$Sepal.Length,col=brewer.pal(6,"Set1"),main="Set1")
hist(iris$Sepal.Length,col=brewer.pal(6,"Set2"),main="Set2")
hist(iris$Sepal.Length,col=brewer.pal(6,"Set3"),main="Set3")
hist(iris$Sepal.Length,col=brewer.pal(6,"Greens"),main="Greens")
hist(iris$Sepal.Length,col=brewer.pal(6,"Blues"),main="Blues")
hist(iris$Sepal.Length,col=brewer.pal(6,"Reds"),main="Reds")

par(mfrow=c(1,1))

library(hexbin)
hexbin(iris$Species,iris$Sepal.Length)
## 'hexbin' object from call: hexbin(x = iris$Species, y = iris$Sepal.Length) 
## n = 150  points in   nc = 48  hexagon cells in grid dimensions  36 by 31
plot(iris$Sepal.Length)

plot(hexbin(iris$Species,iris$Sepal.Length))

plot(mtcars$mpg,mtcars$cyl)

plot(hexbin(mtcars$mpg,mtcars$cyl))

library(tabplot)
## Loading required package: bit
## Attaching package bit
## package:bit (c) 2008-2012 Jens Oehlschlaegel (GPL-2)
## creators: bit bitwhich
## coercion: as.logical as.integer as.bit as.bitwhich which
## operator: ! & | xor != ==
## querying: print length any all min max range sum summary
## bit access: length<- [ [<- [[ [[<-
## for more help type ?bit
## 
## Attaching package: 'bit'
## The following object is masked from 'package:base':
## 
##     xor
## Loading required package: ff
## Attaching package ff
## - getOption("fftempdir")=="C:/Users/dell/AppData/Local/Temp/RtmpYVadJe"
## - getOption("ffextension")=="ff"
## - getOption("ffdrop")==TRUE
## - getOption("fffinonexit")==TRUE
## - getOption("ffpagesize")==65536
## - getOption("ffcaching")=="mmnoflush"  -- consider "ffeachflush" if your system stalls on large writes
## - getOption("ffbatchbytes")==16095641.6 -- consider a different value for tuning your system
## - getOption("ffmaxbytes")==804782080 -- consider a different value for tuning your system
## 
## Attaching package: 'ff'
## The following objects are masked from 'package:bit':
## 
##     clone, clone.default, clone.list
## The following objects are masked from 'package:utils':
## 
##     write.csv, write.csv2
## The following objects are masked from 'package:base':
## 
##     is.factor, is.ordered
## Loading required package: ffbase
## 
## Attaching package: 'ffbase'
## The following objects are masked from 'package:ff':
## 
##     [.ff, [.ffdf, [<-.ff, [<-.ffdf
## The following objects are masked from 'package:base':
## 
##     %in%, table
## Standard deviations are plot by default. See argument numMode of plot.tabplot.
tableplot(iris)

tableplot(mtcars)
## Warning in tableplot_checkBins(nBins, max(N, 2)): Setting nBins (100) to
## number of rows (32)

library(ggplot2)
tableplot(diamonds)

library(vcd)
## Loading required package: grid
data("Titanic")
Titanic
## , , Age = Child, Survived = No
## 
##       Sex
## Class  Male Female
##   1st     0      0
##   2nd     0      0
##   3rd    35     17
##   Crew    0      0
## 
## , , Age = Adult, Survived = No
## 
##       Sex
## Class  Male Female
##   1st   118      4
##   2nd   154     13
##   3rd   387     89
##   Crew  670      3
## 
## , , Age = Child, Survived = Yes
## 
##       Sex
## Class  Male Female
##   1st     5      1
##   2nd    11     13
##   3rd    13     14
##   Crew    0      0
## 
## , , Age = Adult, Survived = Yes
## 
##       Sex
## Class  Male Female
##   1st    57    140
##   2nd    14     80
##   3rd    75     76
##   Crew  192     20
mosaic(Titanic)

HairEyeColor
## , , Sex = Male
## 
##        Eye
## Hair    Brown Blue Hazel Green
##   Black    32   11    10     3
##   Brown    53   50    25    15
##   Red      10   10     7     7
##   Blond     3   30     5     8
## 
## , , Sex = Female
## 
##        Eye
## Hair    Brown Blue Hazel Green
##   Black    36    9     5     2
##   Brown    66   34    29    14
##   Red      16    7     7     7
##   Blond     4   64     5     8
mosaic(HairEyeColor)

cor(mtcars)
##             mpg        cyl       disp         hp        drat         wt
## mpg   1.0000000 -0.8521620 -0.8475514 -0.7761684  0.68117191 -0.8676594
## cyl  -0.8521620  1.0000000  0.9020329  0.8324475 -0.69993811  0.7824958
## disp -0.8475514  0.9020329  1.0000000  0.7909486 -0.71021393  0.8879799
## hp   -0.7761684  0.8324475  0.7909486  1.0000000 -0.44875912  0.6587479
## drat  0.6811719 -0.6999381 -0.7102139 -0.4487591  1.00000000 -0.7124406
## wt   -0.8676594  0.7824958  0.8879799  0.6587479 -0.71244065  1.0000000
## qsec  0.4186840 -0.5912421 -0.4336979 -0.7082234  0.09120476 -0.1747159
## vs    0.6640389 -0.8108118 -0.7104159 -0.7230967  0.44027846 -0.5549157
## am    0.5998324 -0.5226070 -0.5912270 -0.2432043  0.71271113 -0.6924953
## gear  0.4802848 -0.4926866 -0.5555692 -0.1257043  0.69961013 -0.5832870
## carb -0.5509251  0.5269883  0.3949769  0.7498125 -0.09078980  0.4276059
##             qsec         vs          am       gear        carb
## mpg   0.41868403  0.6640389  0.59983243  0.4802848 -0.55092507
## cyl  -0.59124207 -0.8108118 -0.52260705 -0.4926866  0.52698829
## disp -0.43369788 -0.7104159 -0.59122704 -0.5555692  0.39497686
## hp   -0.70822339 -0.7230967 -0.24320426 -0.1257043  0.74981247
## drat  0.09120476  0.4402785  0.71271113  0.6996101 -0.09078980
## wt   -0.17471588 -0.5549157 -0.69249526 -0.5832870  0.42760594
## qsec  1.00000000  0.7445354 -0.22986086 -0.2126822 -0.65624923
## vs    0.74453544  1.0000000  0.16834512  0.2060233 -0.56960714
## am   -0.22986086  0.1683451  1.00000000  0.7940588  0.05753435
## gear -0.21268223  0.2060233  0.79405876  1.0000000  0.27407284
## carb -0.65624923 -0.5696071  0.05753435  0.2740728  1.00000000
#install.packages("corrgram")
library(corrgram)
corrgram(mtcars)

heatmap(as.matrix(mtcars))

library(ggplot2)
qplot(mpg,data=mtcars,geom = "density")

qplot(mpg,data=mtcars,geom = "density",fill=as.factor(gear))

qplot(mpg,data=mtcars,geom = "density",fill=as.factor(gear),alpha=I(0.5))

qplot(mpg,data=mtcars,geom = "density")+facet_grid(~gear)

#library(Rcmdr)

#install.packages("ggmap")
library(ggmap)

geocode("Connaught Place")
## Information from URL : http://maps.googleapis.com/maps/api/geocode/json?address=Connaught%20Place&sensor=false
##        lon      lat
## 1 77.21667 28.63145
#qmap("gateway of india",zoom=15)