I'm new at this.
I have two .txt files and I use R with sqldf pakage to request them
The first table (venues.txt) looks like this:
userID,venueID,year,month,date,hour 1302,47,2012,2,24,11 45,132,2012,2,24,11 24844,86,2012,2,24,11 896,248,2012,2,24,11 5020,29,2012,2,24,11
The second table (friends.txt) looks like this:
userID,friendID 1,5 1,9 1,50 1,102 1,300
I want to request places (siteID) that a user visited (say userID = 1) with one or more of his friends (friendID)
Note. The userID, friendID of friends can be associated with the user ID in the places table.
query results should look like this:
venueID friendID 47 5 47 9 29 102 86 102
I can do this using many separate queries and then attach them to the table, but my dataset is very large. Is there an easier way to do this?
I managed to request all the places that the user or his friends visited:
sqldf("select userID, venueID from data where userID=1 OR userID IN (select friendID from freind where userID=1)")
Many thanks.