Q:

Write a R program to find elements which are present in two given data frames

0

Write a R program to find elements which are present in two given data frames.

All Answers

need an explanation for this answer? contact us directly to get an explanation for this answer

a = c("a", "b", "c", "d", "e")
b = c("d", "e", "f", "g")
print("Original Dataframes")
print(a)
print(b)
print("Elements which are present in both dataframe:")
result = intersect(a, b)
print(result)

Sample Output:

[1] "Original Dataframes"
[1] "a" "b" "c" "d" "e"
[1] "d" "e" "f" "g"
[1] "Elements which are present in both dataframe:"
[1] "d" "e"

need an explanation for this answer? contact us directly to get an explanation for this answer

total answers (1)

Similar questions


need a help?


find thousands of online teachers now