R

@Rushali_07

Densityplot in lattice

R
3 years ago
library (lattice) attach(mtcars) head(mtcars) densityplot(~hp,main="Density plot of HP ",xlab="HP")

Scatterplot in lattice

R
3 years ago
library (lattice) data(ToothGrowth) head(ToothGrowth) histogram (~len,data=ToothGrowth,main="Histogram of ToothGrowth") dev.off()

Scatterplot in lattice

R
3 years ago
library (lattice) data(ToothGrowth) head(ToothGrowth) xyplot(len~dose,data=ToothGrowth)

Densityplot in lattice

R
3 years ago
library (lattice) attach(mtcars) densityplot(~mpg,main="Density Plot",xlab="Miles per Gallon")

lattice

R
3 years ago
library (lattice) attach(mtcars) head(mtcars) gear.f<-factor(gear,levels=c(3,4,5),labels=c("3gears","4gears","5gears")) cyl.f<-factor(cyl,levels=c(4,6,8),labels=c("4cyl","6cyl","8cyl")) densityplot(~mpg|cyl.f,main="Density Plot by Number of Cylinders",xlab="Miles Per Gallon",layout=c(1,3)) bwplot(~mpg|cyl.f,main="Density Plot by Number of Cylinders",xlab="Miles Per Gallon",layout=c(1,3)) dotplot(~mpg|cyl.f,main="Density Plot by Number of Cylinder",xlab="Miles per Gallon ",layout=c(1,3))

3d plot lattice

R
3 years ago
library (lattice) data<-iris head(data) cloud(Sepal.Length~Sepal.Length*Petal.Width,data=(iris)) cloud (Sepal.Length~Sepal.Length*Petal.Width, group=Species,data=iris, auto.key=TRUE)

probability distribution

R
3 years ago
dbinom(1,size=20,prob=1/3) dbinom(11,size =20,prob=1/3) dbinom(4,size=20,prob=1/3) dbinom(15,size=20,prob=1/3) dbinom(18,size=20,prob=1/3) dbinom (25,size=20,prob=1/3)

Cumulative probability

R
3 years ago
pbinom(1,size=20,prob=1/3) pbinom(11,size=20 ,prob=1/3) pbinom(4,size=20,prob=1/3) pbinom(15,size=20,prob=1/3) pbinom(18,size=20,prob=1/3) pbinom(25,size=20,prob=1/3)

Find k in binom

R
3 years ago
qbinom(0.003007287,size=20,prob=1/3) qbinom(0.02466327,size=20,prob=1/3) qbinom(0.0910644,size=20, prob=1/3) qbinom(0.0001422881,size=20,prob=1/3) qbinom(2.179659e-07,size =20,prob=1/3) qbinom(0,size=20, prob=1/3)

Random number in binom

R
3 years ago
rbinom (10,size = 20,prob=1/3)

Normal distribution

R
3 years ago
x <-c (2,54,76,47,87,34,65) dnorm(54,mean(x),sd(x)) pnorm(54,mean(x),sd(x)) qnorm(0.1717431,mean(x),sd(x)) rnorm(25,mean(x),sd(x))

Practical no 4

R
3 years ago
x <-2:20 y<-30 :40 ceiling (y) floor(y) round(y) trunc(y) cos(y) sin(y) tan(x) log(x)

RRR

R
3 years ago
data(iris) head(iris) plot(iris$Petal.Length,iris$Petal.width) #x<-iris$Petal.Length #y<-iris$Petal.width #g=glm(x~y,family=binomial) #curve(predict(g,data.frame(iris$Petal.Length=x),type="resp"),add=TRUE) x<-c(rep(1:20)) y<-x*2 f<-lm(x ~ y)

Lattice

R
3 years ago
library (lattice) data(iris) head(iris) scatterplot3d(x,y=NULL,z=NULL) scatterplot3d(iris[,1:3])

ggplot

R
3 years ago
library ("ggplot2") data(iris) dim(iris) head(iris) summary (iris) ggplot(iris,aes(x=Sepal.Length, y=Petal.Length))+geom_point() ggplot(iris,aes(x=Sepal.Length, y=Petal.Length,col=Species,shape= Species))+geom_point() ggplot(iris,aes(x=Sepal.Length, y=Petal.Length, col=Species))+geom_smooth() ggplot(iris,aes(x=Sepal.Length, y=Petal.Length, col=Species))+geom_polygon() ggplot(iris,aes(x=Sepal.Length, y=Petal.Length, col=Species))+geom_line()

Scatterplot

R
3 years ago
library (lattice) data(ToothGrowth) xyplot(len~supp,data=ToothGrowth) xyplot(len~dose,data=ToothGrowth)

Hist

R
3 years ago
library(lattice) data(ToothGrowth) head(ToothGrowth) histogram (~len,data=ToothGrowth,main="Histogram of ToothGrowth ") dev.off

A

R
3 years ago
library(lattice) data(ToothGrowth) head(ToothGrowth)

Built

R
3 years ago
cat("in built function in numeric") x<-4 print (abs(x)) print(sqrt(x)) y<-4.5 ceiling (y) trunc(y) round(y) cos(x) sin(y)

Built-in function

R
3 years ago
x<- "987654321" substr(x,3,4) a<-"1234567890" substr(a,3,5) r<-"RUSHALI"