jeudi 5 juillet 2018

IF statements by groups

Apologies if this has been asked elsewhere - I am new to coding and struggling to find the correct terminology.

I have bird nest observation data, and have variables (among others): 'month of visit', 'activity code', 'days between visits', 'visit year', and 'nest ID'.

I would like to create an IF statement so I can see what brood number it is. So, if it is in May, June or July and there is a high level of activity at the nest then this is classed as the first brood. If there is at least 27 days between the high activity in May, June or July then it is the second brood.

My question is, how can I do this BY nest ID? Ideally in R, but ok to try in SAS.

I hope this makes sense - happy to provide more info

TIA

Aucun commentaire:

Enregistrer un commentaire