# histogram for raw data x=c(10, 51,34,68,29,12,15,84,78,73,94,97,25,66,10,3,5,8,48,39) hist(x,breaks=5,xlab="marks by students",ylab="Nos of students",main="histogram for raw data") #color histogram for group data lb=seq(15,45,5) ub=seq(20,50,5) hist_x=(lb+ub) /2 #lb+ub in bracket if not then wrong histogram hist_f=c(5,8,13,20,14,6,4)#jitne class hai utne number hist_f mein daalo agar galti then invalid times error hist_y=rep(hist_x,hist_f) hist(hist_y,breaks=7, main="color histogram of 70 students score", xlab="marks", ylab="Nos of students ",col="cyan",border="red") #breaks=7 as classes are 7 # hist_y in hist() as hist_y represent everything #frequency curve lb=seq(20,45,5) ub=seq(25,50,5) x=(lb+ub)/2 f=c(12, 24,43,38,22,11) y=rep(x,f) plot(x,f, "l",main="frequency curve",xlab="Class",ylab="frequency")# l can be o, p etc l is use to make lines if no l then sib points dikhenge #no rep use here as plot() use points(x,f,pch=20) # frequency polygon lb=seq(15, 50,5) ub=seq(20, 55,5) x=(lb+ub)/2 f=c(0,12,24,43, 30,22,11,0)#starting and ending frequency 0 and 0 as extra class marks plot(x,f, "o",main=" frequency polygon",xlab="Class",ylab="frequency") points(x, f, pch=16) # less than ogive ub=seq(20,60,10)# only upper bound no lower bound for less than f=c(3,5,13,12,8) lcf=cumsum(f) plot(ub,lcf,"l",main="less than ogive",xlab="Salary(in thousands)", ylab="Nos of workers") #no f put lcf points(ub,lcf,pch=16) #more than ogive lb=seq(10, 50,10) f=c(3,5,13,12, 6) mcf=1:5 for (i in 5:1) (mcf[i]=sum(f[5:i])) plot(lb, mcf, "l",main=" more than cf",xlab="salary",ylab="Nos of workers") points(lb, mcf, pch=16,) #stem and leaf x=c(66, 81,94,75,59,62,61,58,73,81,88,74,77,82,96) stem(x)
To embed this project on your website, copy the following code and paste it into your website's HTML: