I am quite new to R and probably have a tricky question for you that might also challenge some more advanced coders.
I want to create a variable that tells me, if any of the Friends of the persons come from the same country, then how much.
So in case of "Alex" the new column in the dataset should show 51% because 51% of his friends come from the same country, in this case "Austria"
In the case of Bob the column should show me in Bob's row that 10% come from the same country.
In case of Felicia it would be 0% because her friends do not come from the same country
|Person Name||Person Country||Most friends come from||Most friends come from percent||Second most friends come from||Second most friends come from percent||Third most friends come from||Third most friends come from percent|
|Diana||The Netherlands||Spain||32,00%||Sweden||28,00%||United States||10,00%|
I would really appreciate it if you could help me with these lines of code because as a beginner I am quite overwhelmed with this task.
Thank you very much in advance,