Slip 8 - E) Write an R program to create a data frame using two given vectors and display the duplicated elements and unique rows of the said data frame.

Solution:

a = c(10,20,10,20,40,50,20,30)
b = c(10,30,10,20,0,50,30,30)
print("Original data frame:")
ab = data.frame(a,b)
print(ab)
print("Duplicate elements of the said data frame:")
print(duplicated(ab))
print("Unique rows of the said data frame:")
print(unique(ab))


Post a Comment

0 Comments