I have two data frames.
One is named "Friends" with the person's id and his/her friends, while the other one is named "Likes" describing the person's actions as shown below.
I want to create a new column in the second data frame to indicate whether the person likes his/her friend's post or not.
How can I do it in R? Thank You.
Friends
id friend's name
1 A
1 B
1 C
2 B
2 E
2 H
3 A
3 F
Likes
id title
1 1 likes A's post.
1 1 likes F's post.
2 2 likes G's post.
3 3 likes F's post.
3 3 likes B's post.
so I want to create a new column named "likedfriendspost", and the data frame to be like this:
id title likefriendspost
1 1 likes A's post. 1
1 1 likes his own post. 0
2 2 likes G's post. 0
3 3 likes F's post. 1
3 3 likes B's post. 0