O'Reilly logo

Mastering Social Media Mining with R by Vikram Garg, Sharan Kumar Ravindran

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Recommendations to friends

The objective of this chapter is to recommend to your friend, pages that they might like. We will build this recommendation using the Apriori algorithm. The following code will be useful for building the recommendation model. It makes use of the Apriori algorithm to build, generate the rules, and hence extract the patterns in the data that can be used as recommendation. Let's understand the code in detail:

friends<- getFriends(token, simplify = TRUE) head(friends, 26) friend1<- getLikes("500637447", n = 100, token) friend2<- getLikes("505108142", n = 100, token) friend1$user <- "friend1" friend2$user <- "friend2" friendlikedata<- rbind(friend1, friend2) head(friendlikedata) forRecc<- friendlikedata[,c("user", "id")] write.csv(forRecc,"C:/Users/Sharan/Desktop/Chapter ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required