Assignment 5 Big Data Roll No 18

You might also like

Download as pdf or txt
Download as pdf or txt
You are on page 1of 4

ASSIGNMENT 5 BIG DATA ROLL NO 18

Q1. Write a script in R to create a list of cities and perform the


following
1) Give name to the elements in the list
2) Add an element at the end of the list
3) Remove the last element
4) update the 3rd element

l<-list("pune","nashik","nanded","mumbai")
print(l)
names(l)<-c(" first city","second city","third city","fourth city")
print(l)
l[5]<-"Aurangbad"
print(l)
l[5]<-NULL
print(l)
l[3]<-"Delhi"
print(l)

FINAL OUTPUT :
Q2) Write a script in R to create two vectors of different lengths
and give these vectors as input an array and print addition and
subtraction of those matrices.

print(" two vectors with different length" )


" two vectors with different length"
x1<-c(10,20,30)
x2<-c(5,6,7,8,9,10)
print(x1)
print(x2)
r<-array(c(x1,x2),dim=c(3,3,1))
print(r)
matricesaddition<-r+r
print(matricesaddition)
matrisubstraction<-r-r
print(matrisubstraction)

FINAL OUTPUT:

Q3) Write an R Program to calculate Multiplication Table.


for(i in 1:10)
{
print(paste(2 ,'*',i,'=',2*i) )
}

FINAL OUTPUT :

You might also like