Re: [R] How to replicate SAS by group processing in R

2012-10-11 Thread Barry Rowlingson
On Wed, Oct 10, 2012 at 7:09 PM, ramoss wrote: > In SAS I use the following code: > > proc sort data=upper; > by tdate stock_symbol expire strike; > run; > data upper1; > set upper; > by tdate stock_symbol expire strike; > if first.expire then output; > rename strike=astrike; > run; > >

Re: [R] How to replicate SAS by group processing in R

2012-10-10 Thread Ista Zahn
Hi, here is one way using ddply (from the plyr package): dat <- read.table(text="tdate stock_symbolexpiration strike 9/11/2012 C 9/16/201211 9/11/2012 C 9/16/201212 9/11/2012 C 9/16/201

Re: [R] How to replicate SAS by group processing in R

2012-10-10 Thread arun
day, October 10, 2012 5:42 PM Subject: Re: [R] How to replicate SAS by group processing in R On Oct 10, 2012, at 11:09 AM, ramoss wrote: > Hello, > > I am trying to re-code all my programs from SAS into R. > > In SAS I use the following code: > > proc sort data=upper; > b

Re: [R] How to replicate SAS by group processing in R

2012-10-10 Thread David Winsemius
On Oct 10, 2012, at 11:09 AM, ramoss wrote: > Hello, > > I am trying to re-code all my programs from SAS into R. > > In SAS I use the following code: > > proc sort data=upper; > by tdate stock_symbol expire strike; > run; > data upper1; > set upper; > by tdate stock_symbol expire strike;

[R] How to replicate SAS by group processing in R

2012-10-10 Thread ramoss
Hello, I am trying to re-code all my programs from SAS into R. In SAS I use the following code: proc sort data=upper; by tdate stock_symbol expire strike; run; data upper1; set upper; by tdate stock_symbol expire strike; if first.expire then output; rename strike=astrike; run; on the