```# LAB - 3
list_data<-list(c(‘Red’,‘Green’,‘Black’), list(‘Python’,‘PHP’,‘Java’)) print(‘List:’) print(list_data) print(‘Number of Objects in the said list:’) length(list_data)
#Practice Question 2
l= list(1,2,3,4,5) print(“Original list:”) print(l) print(‘Set 2nd and 3rd elements to NULL’) l[c(2,3)]<-NULL print(l)
#Practice Question 3
list1= list(g1=1:10, g2=‘R Programming’, g3= ‘HTML’) print(‘Original List:’) print(list1) print(‘New list:’) list1[[‘g1’]]<-list1[[‘g1’]]+10 print(list1)
#Practice Question 4 list1= list(g1=1:10, g2=‘R Programming’, g3= ‘HTML’) print(‘Original list’) print(list1) print(‘First Vector’) print(list1[[‘g1’]][-3])
#Practice Quetion 5
list1= list(g1=1:10, g2=‘R Programming’, g3= ‘HTML’) print(‘Original list’) print(list1) print(” Add a new vector to the said list:“) list1[[‘g4’]]<-‘python’ print(list1)
#Practice Question 6
list1= list(g1=1:10, g2=‘R Programming’, g3= ‘HTML’) print(‘Original list’) print(list1) print(” Length of the vector g1 and g2 of the said list”) print(length(list1\(g1)) print(length(list1\)g2))
#Practice Question 7
l1 =list(‘x’,‘y’,‘z’)
l2 = list(‘X’,‘Y’,‘Z’,‘x’,‘y’,‘z’) print(“Oiginal List:”) print(l1) print(l2)
print(‘All elements o l2 that are not in l1:’)
print(setdiff(l2,l1)) setdiff(l2, l1) ```
This is an R Markdown document. Markdown is a simple formatting syntax for authoring HTML, PDF, and MS Word documents. For more details on using R Markdown see http://rmarkdown.rstudio.com.
When you click the Knit button a document will be generated that includes both content as well as the output of any embedded R code chunks within the document. You can embed an R code chunk like this: