csv", header=T)
data
summary(data)
#histogram
hist(data$Cost.Price...US.)
#interpretasi histogram
a <- hist(data$Cost.Price...US.)
hist(data$Cost.Price...US., freq = F)
density(data$Cost.Price...US.)
sd <- density(data$Cost.Price...US.)
plot(sd)
lines(sd)
lines(a)
hist(data$Cost.Price...US., breaks=14)
#memberi warna histogram, brewer.pal(berapa kolom yang akan diwarnai, jenis warna),
#accent=kualitatif palette
library(RColorBrewer)
par(mfrow=c(2,2))
cap_data
plot(x=cap_data$Advertis, y=cap_data$Sales)
#boxplot
boxplot(cap_data$Advertis)
boxplot(cap_data$Advertis, col=brewer.pal(3,"Pastel1"))
as <- boxplot(cap_data$Advertis)
summary(as)
names(as)
as$stats
barplot(cap_data$Advertis)
pairs(cap_data[,2:4])
ad <- cap_data$Advertis
#normalqqplot
qqnorm(ad, col=brewer.pal(3,"Pastel1"))
qqline(ad)
par(mfrow=c(3,3))
#librari lattice
library(lattice)
data("iris")
data
bwplot(Sepal.Width~Sepal.Length,data=iris)
dotplot(Sepal.Width~Sepal.Length,data=iris)
xyplot(Sepal.Width~Sepal.Length,data=iris)
xyplot(Sepal.Width~Sepal.Length|Species,data=iris)
xyplot(Sepal.Width~Sepal.Length|Petal.Width,data=iris)
#librari psych
library(psych)
pairs.panels(iris)
pairs.panels(iris,ellipses = F)
#GGplot
library(ggplot2)
data
g<-ggplot(mpg,aes(cty,hwy))
g+geom_point()+geom_smooth(method="lm",se=F)
#JitterPlot, theme_set=merubah warna tema sepenuhnya, theme_bw=warna brown, aes=variabel
#jiter sama point tetapi jiter lebih memberi banyak titik2 variabel acak ke lokasi titik(overplotng)
theme_set(theme_bw())
theme_set(theme_dark())
g<-ggplot(mpg,aes(cty,hwy))
g+geom_jitter(width=.5,size=1)
#ke area titik. Ini berguna ketika Anda memiliki data diskrit dan overplotting.
g<-ggplot(mpg,aes(cty,hwy))
g+geom_count(col="red",show.legend=F)
#bubbleplot
mpg_select<-mpg[mpg$manufacturer%in%c("audi","ford","honda","hyundai"),]
theme_set(theme_bw())
g<-ggplot(mpg_select,aes(displ,cty))
g+geom_jitter(aes(col=manufacturer,size=hwy))+geom_smooth(aes(col=manufacturer),method="lm",se
=F)
#round(cor(data),decimal)
library(ggcorrplot)
data(mtcars)
corr<-round(cor(mtcars),1)
library(ggcorrplot)
data(mtcars)
corr
library(animation)
library(gganimate)
library(cowplot)