[R] RE : Create sequence for dataset

ssim@lic.co.nz ssim at lic.co.nz
Sun Nov 21 22:28:17 CET 2004


Dear members,

I want to create a sequence of numbers for the multiple records of
individual animal in my dataset. The SAS code below will do the trick, but
I want to learn to do it in R. Can anyone help ?

data ht&ssn;
set ht&ssn;
by anml_key;
if first.anml_key then do;
seq_ht_rslt=0;
end;
seq_ht_rslt+1;

Thanks in advance.

Stella
___________________________________________________________________________
This message, including attachments, is confidential. If you are not the
intended recipient, please contact us as soon as possible and then destroy
the message. Do not copy, disclose or use the contents in any way.

The recipient should check this email and any attachments for viruses and
other defects. Livestock Improvement Corporation Limited and any of its
subsidiaries and associates are not responsible for the consequences of any
virus, data corruption, interception or unauthorised amendments to this
email.

Because of the many uncertainties of email transmission we cannot guarantee
that a reply to this email will be received even if correctly sent. Unless
specifically stated to the contrary, this email does not designate an
information system for the purposes of section 11(a) of the New Zealand
Electronic Transactions Act 2002.




More information about the R-help mailing list