[R] Numbering entries for each subject

2011-09-21 Thread Toni Pitcher
Hi R Users I am hoping someone might be able to give some pointers on alternative code to the for loop described below. I have a dataset which is ordered by subject ID and date, what I would like to do is create a new variable that numbers the entries for each person (e.g. 1,2,3,) As an e

Re: [R] Changing some values within a variable

2010-07-22 Thread Toni Pitcher
uestion, see sub() (or gsub()) - again paying attention to whether or not you are dealing with factor or character variables. HTH Peter Alspach -Original Message- From: r-help-boun...@r-project.org [mailto:r-help-boun...@r- project.org] On Behalf Of Toni Pitcher Sent: Friday,

[R] Changing some values within a variable

2010-07-22 Thread Toni Pitcher
(999LLL). Some of the IDs have format 999LLL-LL, Thus I need to delete the -LL from the IDs. How do I generically specify "find 999LLL-LL and replace with 999LLL"? Many thanks in advance Toni -- Toni Pitcher PhD Dept. of Medicine University of Otago, Christchurch Van der Veer