Assignment 1: Create three vectors x,y,z of equal length, bind them together and create three dimensional plots for the same.
--> First create a data random data of 60 item, mean = 20 and standard deviation = 5.
> data<-rnorm(60,mean=20,sd=5)
> data
--> To create and display three vectors of length = 15 items.
> x<-sample(data,15)
> x
> y<-sample(data,15)
> y
> z<-sample(data,15)
> z
--> To bind the vectors together.
> p<-cbind(x,y,z)
> p
--> Plotting of graphs.
>plot3d(p[,1:3])
>plot3d(p[,1:3], xlab="X Axis" , ylab="Y Axis" , zlab="Z Axis", col=rainbow(500))
>plot3d(p[,1:3], xlab="X Axis" , ylab="Y Axis" , zlab="Z Axis", col=rainbow(5000), type='s')
> plot3d(p[,1:3], xlab="X Axis" , ylab="Y Axis" , zlab="Z Axis", col=rainbow(5000), type='p')
> plot3d(p[,1:3], xlab="X Axis" , ylab="Y Axis" , zlab="Z Axis", col=rainbow(5000), type='l')
Assignment 2:
Create 2 random variables
Create 3 plots:
1.X-Y
2.X-Y|Z(introducing a variable z and cbind it to z and y with 5 diff. categories)
3.Colour code and draw the graph
--> Creating a data set for two random variables and introducing a third variable z.
x <- rnorm(1000, mean= 30 , sd=10)
> y <- rnorm(1000, mean= 30, sd=10)
> z1 <- sample(letters, 5)
> z2 <- sample(z1, 1000, replace=TRUE)
> z <- as.factor(z2)
> z
--> Creating quick plots.
> qplot(x,y)
>qplot(x,z)
--> For semi transparent plot.
>qplot(x,z, alpha=I(2/10))
--> For coloured plot
> qplot(x,y, color=z)
--> For logarithmic coloured plot
>qplot(log(x),log(y), color=z)
--> Best fit and smooth curve using geom.
> qplot(x,y,geom=c("path","smooth"))
>qplot(x,y,geom=c("point","smooth"))
>qplot(x,y,geom=c("boxplot","jitter"))














































