[R] Caculate first difference from a dataframe; write a simulation
dwinsemius at comcast.net
Wed Aug 5 15:06:16 CEST 2009
On Aug 4, 2009, at 2:12 PM, Meenu Sahi wrote:
> Dear R Users
> I'm writing my first simulation in R.
> I've put across my problems with a smaller example in the attachment
> with the questions.
> Please help.
See Simpson reply to Q1
##Question2: How can I easily identify which out of the 9 states does
ad fall into with Level =5.04 and spread=0.25?
But spread for state7 was -0.34?????
Had it been 0.24, then this should work (some of the time.)
> subset(mydat4, Level == 5.4 & spread==0.25)
 Level spread change State
<0 rows> (or 0-length row.names)
Perhaps you meant to specify an "or" condition?
> subset(mydat4, Level == 5.4 | spread==0.24)
Level spread change State
10 5.40 -0.34 BrF State7
11 4.89 0.24 BlF State8
> Best regards
> R-help at r-project.org mailing list
> PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
> and provide commented, minimal, self-contained, reproducible code.
David Winsemius, MD
West Hartford, CT
More information about the R-help