Slip 3 - E) Write an R program to compare two data frames to find the elements in first data frame that are not present in second data frame.

 Solution:

a = c("a", "b", "c", "d", "e")
b = c("d", "e", "f", "g","c")
print("Dataframes")
ab=data.frame(a,b)
print(ab)
print("Data in first dataframe  that are not present in second dataframe:")
result = setdiff(a, b)
print(result)

Post a Comment

0 Comments