I'm working a social network project where middle school students report their friends along with several qualities about themselves. I'm using R for analyses, and I'm trying to create a new variable that represents friends scores on social values.
So, let's say I have the following data:
I'd like to create a function that adds a new column labeled "FRIEND_VALUES" based on the ID Number mentioned in the FRIEND column. So the function would need to pull the VALUE for the ID based on what is listed in the FRIEND column. The final product would look like this:
In this scinareo, "ID" and "FRIEND" both represent ID numbers. The value of "FRIEND_VALUE" = the number of "VALUES" for the FRIEND ID. So, for ID 1, FRIEND = 2. The FRIEND_VALUE column should = the number under VALUE for ID 2 (which is 1.3).
**Note: I apologize for the images. I'm new to stackoverflow and need some practice.