Hello,

I am trying to find a direct way to write a nested if of sorts to find data
for a specific time range for a specific day (across a range of days) and
have exhausted my abilities with the manuals I have at hand.  I have a good
deal of data of this approximate form:

day   time   price
1      1am    5
1       2am    7
1      3am     9
1      4am     12
 2      1am    5
2       2am    7
2      3am     9
2      4am     12
etc

I am reading from a file I loaded and using a while statement.  I then am
trying the direct approach of writing the if:

if(time>=2am &time <=4am) { #specifying desired time range--since a while
loop format I don't think date is necessary and if it is I don't know how to
say this?
time1<-time #sets first time in desired interval to base time
px1<-px #sets first price in desired interval to base price
if(px>px1){ #nested if stmt to see if subsequent times are higher than base,
thus replacing base with new max (I am seeking max in the time period in
this instance)
px2<-px #px2 would be the new higher maximum
time2<-time #time associated with px2
px3<-px+1 #price immediately following max
time3<-time+1 #time immed. follows max
out<-(cur_date,px2,time2,px3,time3) #output the high price/time and the
immediately following price/time
cat(out,"\n")}

This code however, does nothing.  Any help would be apreciated.  The manuals
seem to only take one so far.

Thanks,

George

	[[alternative HTML version deleted]]

