I am attempting to merge the following value data set, which is kind of dimensionalized. The variable here is
activity_labels <-
activity_id activity_name
1 WALKING
2 WALKING_UPSTAIRS
3 WALKING_DOWNSTAIRS
4 SITTING
5 STANDING
6 LAYING
with another data set that looks like the following.:
activities_raw <-
activity_id
5
5
3
3
4
2
What I would expect to see is:
activity_id activity_name
5 STANDING
5 STANDING
3 WALKING_DOWNSTAIRS
3 WALKING_DOWNSTAIRS
4 SITTING
2 WALKING_UPSTAIRS
However, what I see is something completely different. In fact, it looks like the merge that I'm doing is changing the values of activities_raw, which is my record level data. I see this:
activity_id activity_name
1 WALKING
1 WALKING
1 WALKING
1 WALKING
1 WALKING
1 WALKING
I've attempt inner join, left join, right join, etc. Here is an example of my inner join:
merge(activities_raw , activity_labels , by="activity_id")
Any help would be greatly appreciated.