-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathRGraphix.Rmd
50 lines (45 loc) · 1006 Bytes
/
RGraphix.Rmd
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
---
title: "Practical2_R_Graphics_Btech_DSDBA"
author: "Puru.Joshi"
date: "Tuesday, February 07, 2017"
output: html_document
---
```{r, echo=FALSE}
x<-rnorm(100)
#x
y<-rnorm(100)
#y
z<-sample(c("M", "F"), 100, replace=T)
dt<-data.frame(x, y, z)
head(dt)
summary(dt)
plot(x, y, xlab="x", ylab="y", main="100 Random numbers", pch=24, col=as.factor(z))
legend("bottomright", c("M","F"), pch = 24, title = "Legend", col=c("brown2", "black"))
```
#Histogram
```{r, echo=FALSE}
hist(x, xlab= "100 Random numbers", ylab= "Frequency", col="red")
abline(v=median(x), col="red", lwd=2)
rug(x)
par(mfrow=c(1, 3))
plot(x,y)
hist(x)
hist(y)
```
#Bar Plot
```{r, echo=FALSE}
tab<-table(z)
tab<-prop.table(tab)
barplot(tab, col="red")
#heatmap(table(x,y))
```
#Heatmap on Iris dataset
```{r, echo=FALSE}
attach(iris)
heatmap(as.matrix(iris[,-5]))
barplot(table(iris$Species), col='orange')
```
#Box Plot on 'x'
```{r, echo=FALSE}
boxplot(x, xlab="x",col='orange')
```