Calculate variable based on criteria in r
How can i add a new column to my data frame that would take into
consideration some criteria such as:
ID AGE PERNO
1 30 1
1 25 2
2 25 1
2 24 2
2 3 3
3 65 1
3 55 2
to end with a table like:
ID AGE PERNO AGE_HEAD
1 30 1 30
1 25 2 30
2 25 1 25
2 24 2 25
2 3 3 25
3 65 1 65
3 55 2 65
Pretty much have the age of perno one in all the rows related to the id
No comments:
Post a Comment