1.
CREATE MATRIX AND PERFORM MATRIX OPERATIONS
PROGRAM :
A=matrix(c(1:9),nrow=3,byrow=TRUE)
B=matrix(c(1,3,4,5,6,7,8,9,1),nrow=3,byrow=TRUE)
print(A+B)
print(A-B)
print(A%*%B)
print(A/B)
print(A%%B)
2. GRAPHICAL DISPLAY OF POISSON DISTRIBUTION
PROGRAM :
# Set the seed for reproducibility
set.seed(123)
# Generate a poisson-distributed dataset
larbda <- 5 # Average rate of events
poisson_data <- rpois(100, larbda)
# Create a bar plot to visualize the probability mass function
barplot(table(poisson_data)/length(poisson_data),
col = "Skyblue",
main = "Poisson Distribution PMF",
xlab = "Number of Events",
ylab = "Probaility",
ylim = c(0,0.15))
#Add a red line reoresention the theoretical poisson PMF
3. HISTOGRAM
PROGRAM :
marks<-c(0,10,20,30,40,50,60)
num_students<-c(60,50,70,40,80,30)
hist(marks,breaks=seq(0,50,y=10),weights=num_students,xlab
="marks",ylab="Number of students", main + "Histogram of
marks")
4. PIE – CHART
PROGRAM :
# Data
Categories <- C("Agriculcure and rural development",
"Irrigation", "Energy","Transport and communication", "Social
service", "Industry")
Percentages <- C(12.9, 12.5, 27.2, 15.4, 16.1)
#Create pie chart
Pie(Percentages, tales = Categories, main = "Expenditure
Distribution")